Skip to contentSkip to conversation

Patch "rbd: reacquire lock should update lock owner client id" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Jan 13, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

rbd: reacquire lock should update lock owner client id

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
rbd-reacquire-lock-should-update-lock-owner-client-id.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From edd8ca8015800b354453b891d38960f3a474b7e4 Mon Sep 17 00:00:00 2001

From: Florian Margaine <[email protected]>
Date: Wed, 13 Dec 2017 16:43:59 +0100
Subject: rbd: reacquire lock should update lock owner client id

From: Florian Margaine <[email protected]>

commit edd8ca8015800b354453b891d38960f3a474b7e4 upstream.

Otherwise, future operations on this RBD using exclusive-lock are going to require the lock from a non-existent client id.

Fixes 14bb211d324d ("rbd: support updating the lock cookie without releasing the lock")
[[email protected]: rbd_set_owner_cid() call, __rbd_lock() helper]
---
 drivers/block/rbd.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/block/rbd.c +11 -5
@@ -3074,13 +3074,21 @@ static void format_lock_cookie(struct rb
 	mutex_unlock(&rbd_dev->watch_mutex);
 }
 
+static void __rbd_lock(struct rbd_device *rbd_dev, const char *cookie)
+{
+	struct rbd_client_id cid = rbd_get_cid(rbd_dev);
+
+	strcpy(rbd_dev->lock_cookie, cookie);
+	rbd_set_owner_cid(rbd_dev, &cid);
+	queue_work(rbd_dev->task_wq, &rbd_dev->acquired_lock_work);
+}
+
 /*
  * lock_rwsem must be held for write
  */
 static int rbd_lock(struct rbd_device *rbd_dev)
 {
 	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
-	struct rbd_client_id cid = rbd_get_cid(rbd_dev);
 	char cookie[32];
 	int ret;
 
@@ -3095,9 +3103,7 @@ static int rbd_lock(struct rbd_device *r
 		return ret;
 
 	rbd_dev->lock_state = RBD_LOCK_STATE_LOCKED;
-	strcpy(rbd_dev->lock_cookie, cookie);
-	rbd_set_owner_cid(rbd_dev, &cid);
-	queue_work(rbd_dev->task_wq, &rbd_dev->acquired_lock_work);
+	__rbd_lock(rbd_dev, cookie);
 	return 0;
 }
 
@@ -3883,7 +3889,7 @@ static void rbd_reacquire_lock(struct rb
 			queue_delayed_work(rbd_dev->task_wq,
 					   &rbd_dev->lock_dwork, 0);
 	} else {
-		strcpy(rbd_dev->lock_cookie, cookie);
+		__rbd_lock(rbd_dev, cookie);
 	}
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/rbd-reacquire-lock-should-update-lock-owner-client-id.patch