CEPH filesystem development
 help / color / mirror / Atom feed
From: Dongsheng Yang <dongsheng.yang@linux.dev>
To: Ilya Dryomov <idryomov@gmail.com>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] rbd: rename RBD_LOCK_STATE_RELEASING and releasing_wait
Date: Thu, 25 Jul 2024 16:46:13 +0800	[thread overview]
Message-ID: <eaaa29e9-0a3a-facb-cd46-fde4a4be1b9a@linux.dev> (raw)
In-Reply-To: <20240724062914.667734-2-idryomov@gmail.com>



在 2024/7/24 星期三 下午 2:29, Ilya Dryomov 写道:
> ... to RBD_LOCK_STATE_QUIESCING to quiescing_wait to recognize that

Hi Ilya,
   s/to quiescing_wait/and quiescing_wait

Otherwise:

Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>


> 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 <idryomov@gmail.com>
> ---
>   drivers/block/rbd.c | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 9c6cff54831f..77a9f19a0035 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -362,7 +362,7 @@ enum rbd_watch_state {
>   enum rbd_lock_state {
>   	RBD_LOCK_STATE_UNLOCKED,
>   	RBD_LOCK_STATE_LOCKED,
> -	RBD_LOCK_STATE_RELEASING,
> +	RBD_LOCK_STATE_QUIESCING,
>   };
>   
>   /* WatchNotify::ClientId */
> @@ -422,7 +422,7 @@ struct rbd_device {
>   	struct list_head	running_list;
>   	struct completion	acquire_wait;
>   	int			acquire_err;
> -	struct completion	releasing_wait;
> +	struct completion	quiescing_wait;
>   
>   	spinlock_t		object_map_lock;
>   	u8			*object_map;
> @@ -525,7 +525,7 @@ static bool __rbd_is_lock_owner(struct rbd_device *rbd_dev)
>   	lockdep_assert_held(&rbd_dev->lock_rwsem);
>   
>   	return rbd_dev->lock_state == RBD_LOCK_STATE_LOCKED ||
> -	       rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING;
> +	       rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING;
>   }
>   
>   static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
> @@ -3458,12 +3458,12 @@ static void rbd_lock_del_request(struct rbd_img_request *img_req)
>   	spin_lock(&rbd_dev->lock_lists_lock);
>   	if (!list_empty(&img_req->lock_item)) {
>   		list_del_init(&img_req->lock_item);
> -		need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING &&
> +		need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_QUIESCING &&
>   			       list_empty(&rbd_dev->running_list));
>   	}
>   	spin_unlock(&rbd_dev->lock_lists_lock);
>   	if (need_wakeup)
> -		complete(&rbd_dev->releasing_wait);
> +		complete(&rbd_dev->quiescing_wait);
>   }
>   
>   static int rbd_img_exclusive_lock(struct rbd_img_request *img_req)
> @@ -4181,16 +4181,16 @@ static bool rbd_quiesce_lock(struct rbd_device *rbd_dev)
>   	/*
>   	 * Ensure that all in-flight IO is flushed.
>   	 */
> -	rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING;
> -	rbd_assert(!completion_done(&rbd_dev->releasing_wait));
> +	rbd_dev->lock_state = RBD_LOCK_STATE_QUIESCING;
> +	rbd_assert(!completion_done(&rbd_dev->quiescing_wait));
>   	if (list_empty(&rbd_dev->running_list))
>   		return true;
>   
>   	up_write(&rbd_dev->lock_rwsem);
> -	wait_for_completion(&rbd_dev->releasing_wait);
> +	wait_for_completion(&rbd_dev->quiescing_wait);
>   
>   	down_write(&rbd_dev->lock_rwsem);
> -	if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING)
> +	if (rbd_dev->lock_state != RBD_LOCK_STATE_QUIESCING)
>   		return false;
>   
>   	rbd_assert(list_empty(&rbd_dev->running_list));
> @@ -5383,7 +5383,7 @@ static struct rbd_device *__rbd_dev_create(struct rbd_spec *spec)
>   	INIT_LIST_HEAD(&rbd_dev->acquiring_list);
>   	INIT_LIST_HEAD(&rbd_dev->running_list);
>   	init_completion(&rbd_dev->acquire_wait);
> -	init_completion(&rbd_dev->releasing_wait);
> +	init_completion(&rbd_dev->quiescing_wait);
>   
>   	spin_lock_init(&rbd_dev->object_map_lock);
>   
> 

  reply	other threads:[~2024-07-25  8:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24  6:29 [PATCH 0/3] rbd: exclusive mapping (-o exclusive) fixes Ilya Dryomov
2024-07-24  6:29 ` [PATCH 1/3] rbd: rename RBD_LOCK_STATE_RELEASING and releasing_wait Ilya Dryomov
2024-07-25  8:46   ` Dongsheng Yang [this message]
2024-07-24  6:29 ` [PATCH 2/3] rbd: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings Ilya Dryomov
2024-07-24  6:29 ` [PATCH 3/3] rbd: don't assume rbd_is_lock_owner() " Ilya Dryomov
2024-07-25  8:45   ` Dongsheng Yang
2024-07-25  9:31     ` Ilya Dryomov
2024-07-25 10:08       ` Dongsheng Yang
2024-07-25 10:22         ` Ilya Dryomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eaaa29e9-0a3a-facb-cd46-fde4a4be1b9a@linux.dev \
    --to=dongsheng.yang@linux.dev \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox