diff mbox series

[v2,10/16] rbd: wakeup requests when we get -EBLACKLISTED in lock acquiring

Message ID 1552900534-29026-11-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show
Series rbd journaling feature | expand

Commit Message

Dongsheng Yang March 18, 2019, 9:15 a.m. UTC
When we got an -EBLACKLISTED, we need to wakeup the waiters, otherwise,
they will wait forever.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
---
 drivers/block/rbd.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 57816c2..4c5f36e 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3031,14 +3031,19 @@  static void rbd_acquire_lock(struct work_struct *work)
 	dout("%s rbd_dev %p\n", __func__, rbd_dev);
 again:
 	lock_state = rbd_try_acquire_lock(rbd_dev, &ret);
-	if (lock_state != RBD_LOCK_STATE_UNLOCKED || ret == -EBLACKLISTED) {
-		if (lock_state == RBD_LOCK_STATE_LOCKED)
-			wake_requests(rbd_dev, true);
+	if (lock_state == RBD_LOCK_STATE_LOCKED) {
+		wake_requests(rbd_dev, true);
 		dout("%s rbd_dev %p lock_state %d ret %d - done\n", __func__,
 		     rbd_dev, lock_state, ret);
 		return;
 	}
 
+	if (ret == -EBLACKLISTED) {
+		set_bit(RBD_DEV_FLAG_BLACKLISTED, &rbd_dev->flags);
+		wake_requests(rbd_dev, true);
+		return;
+	}
+
 	ret = rbd_request_lock(rbd_dev);
 	if (ret == -ETIMEDOUT) {
 		goto again; /* treat this as a dead client */