Skip to content

Commit 25a76b1

Browse files
idryomovsmb49
authored andcommitted
rbd: rename RBD_LOCK_STATE_RELEASING and releasing_wait
BugLink: https://bugs.launchpad.net/bugs/2078428 commit f5c466a0fdb2d9f3650d2e3911b0735f17ba00cf upstream. ... to RBD_LOCK_STATE_QUIESCING and quiescing_wait to recognize that this state and the associated completion are backing rbd_quiesce_lock(), which isn't specific to releasing the lock. While exclusive lock does get quiesced before it's released, it also gets quiesced before an attempt to update the cookie is made and there the lock is not released as long as ceph_cls_set_cookie() succeeds. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Dongsheng Yang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Koichiro Den <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 723ca13 commit 25a76b1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/block/rbd.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ enum rbd_watch_state {
362362
enum rbd_lock_state {
363363
RBD_LOCK_STATE_UNLOCKED,
364364
RBD_LOCK_STATE_LOCKED,
365-
RBD_LOCK_STATE_RELEASING,
365+
RBD_LOCK_STATE_QUIESCING,
366366
};
367367

368368
/* WatchNotify::ClientId */
@@ -422,7 +422,7 @@ struct rbd_device {
422422
struct list_head running_list;
423423
struct completion acquire_wait;
424424
int acquire_err;
425-
struct completion releasing_wait;
425+
struct completion quiescing_wait;
426426

427427
spinlock_t object_map_lock;
428428
u8 *object_map;
@@ -525,7 +525,7 @@ static bool __rbd_is_lock_owner(struct rbd_device *rbd_dev)
525525
lockdep_assert_held(&rbd_dev->lock_rwsem);
526526

527527
return rbd_dev->lock_state == RBD_LOCK_STATE_LOCKED ||
528-
rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING;
528+
rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING;
529529
}
530530

531531
static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
@@ -3460,12 +3460,12 @@ static void rbd_lock_del_request(struct rbd_img_request *img_req)
34603460
spin_lock(&rbd_dev->lock_lists_lock);
34613461
if (!list_empty(&img_req->lock_item)) {
34623462
list_del_init(&img_req->lock_item);
3463-
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING &&
3463+
need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING &&
34643464
list_empty(&rbd_dev->running_list));
34653465
}
34663466
spin_unlock(&rbd_dev->lock_lists_lock);
34673467
if (need_wakeup)
3468-
complete(&rbd_dev->releasing_wait);
3468+
complete(&rbd_dev->quiescing_wait);
34693469
}
34703470

34713471
static int rbd_img_exclusive_lock(struct rbd_img_request *img_req)
@@ -4183,16 +4183,16 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
41834183
/*
41844184
* Ensure that all in-flight IO is flushed.
41854185
*/
4186-
rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING;
4187-
rbd_assert(!completion_done(&rbd_dev->releasing_wait));
4186+
rbd_dev->lock_state = RBD_LOCK_STATE_QUIESCING;
4187+
rbd_assert(!completion_done(&rbd_dev->quiescing_wait));
41884188
if (list_empty(&rbd_dev->running_list))
41894189
return true;
41904190

41914191
up_write(&rbd_dev->lock_rwsem);
4192-
wait_for_completion(&rbd_dev->releasing_wait);
4192+
wait_for_completion(&rbd_dev->quiescing_wait);
41934193

41944194
down_write(&rbd_dev->lock_rwsem);
4195-
if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING)
4195+
if (rbd_dev->lock_state != RBD_LOCK_STATE_QUIESCING)
41964196
return false;
41974197

41984198
rbd_assert(list_empty(&rbd_dev->running_list));
@@ -5387,7 +5387,7 @@ static struct rbd_device *__rbd_dev_create(struct rbd_spec *spec)
53875387
INIT_LIST_HEAD(&rbd_dev->acquiring_list);
53885388
INIT_LIST_HEAD(&rbd_dev->running_list);
53895389
init_completion(&rbd_dev->acquire_wait);
5390-
init_completion(&rbd_dev->releasing_wait);
5390+
init_completion(&rbd_dev->quiescing_wait);
53915391

53925392
spin_lock_init(&rbd_dev->object_map_lock);
53935393

0 commit comments

Comments
 (0)