All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision()
       [not found] <20220525023212.32642-1-huyue2@coolpad.com>
@ 2022-05-26  9:37 ` Gao Xiang
  2022-07-01  9:03 ` JeffleXu
  2022-07-05 14:59 ` Jeff Layton
  2 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2022-05-26  9:37 UTC (permalink / raw)
  To: Yue Hu; +Cc: dhowells, linux-cachefs, zhangwen, linux-kernel, zbestahu

On Wed, May 25, 2022 at 10:32:22AM +0800, Yue Hu wrote:
> After waiting for the volume to complete the acquisition with timeout,
> the if condition under which potential volume collision occurs should be
> acquire the volume is still pending rather than not pending so that we
> will continue to wait until the pending flag is cleared. Also, use the
> existing test pending wrapper directly instead of test_bit().
> 
> Signed-off-by: Yue Hu <huyue2@coolpad.com>
> ---

Looks good to me,

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

>  fs/fscache/volume.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fscache/volume.c b/fs/fscache/volume.c
> index 71d3a6d6d72c..f2009cc22002 100644
> --- a/fs/fscache/volume.c
> +++ b/fs/fscache/volume.c
> @@ -143,7 +143,7 @@ static void fscache_wait_on_volume_collision(struct fscache_volume *candidate,
>  {
>  	wait_var_event_timeout(&candidate->flags,
>  			       !fscache_is_acquire_pending(candidate), 20 * HZ);
> -	if (!fscache_is_acquire_pending(candidate)) {
> +	if (fscache_is_acquire_pending(candidate)) {
>  		pr_notice("Potential volume collision new=%08x old=%08x",
>  			  candidate->debug_id, collidee_debug_id);
>  		fscache_stat(&fscache_n_volumes_collision);
> @@ -182,7 +182,7 @@ static bool fscache_hash_volume(struct fscache_volume *candidate)
>  	hlist_bl_add_head(&candidate->hash_link, h);
>  	hlist_bl_unlock(h);
>  
> -	if (test_bit(FSCACHE_VOLUME_ACQUIRE_PENDING, &candidate->flags))
> +	if (fscache_is_acquire_pending(candidate))
>  		fscache_wait_on_volume_collision(candidate, collidee_debug_id);
>  	return true;
>  
> -- 
> 2.17.1
> --
> Linux-cachefs mailing list
> Linux-cachefs@redhat.com
> https://listman.redhat.com/mailman/listinfo/linux-cachefs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision()
       [not found] <20220525023212.32642-1-huyue2@coolpad.com>
  2022-05-26  9:37 ` [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision() Gao Xiang
@ 2022-07-01  9:03 ` JeffleXu
  2022-07-05 14:59 ` Jeff Layton
  2 siblings, 0 replies; 3+ messages in thread
From: JeffleXu @ 2022-07-01  9:03 UTC (permalink / raw)
  To: Yue Hu, dhowells, linux-cachefs; +Cc: zhangwen, linux-kernel, zbestahu



On 5/25/22 10:32 AM, Yue Hu wrote:
> After waiting for the volume to complete the acquisition with timeout,
> the if condition under which potential volume collision occurs should be
> acquire the volume is still pending rather than not pending so that we
> will continue to wait until the pending flag is cleared. Also, use the
> existing test pending wrapper directly instead of test_bit().
> 
> Signed-off-by: Yue Hu <huyue2@coolpad.com>
> ---
>  fs/fscache/volume.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fscache/volume.c b/fs/fscache/volume.c
> index 71d3a6d6d72c..f2009cc22002 100644
> --- a/fs/fscache/volume.c
> +++ b/fs/fscache/volume.c
> @@ -143,7 +143,7 @@ static void fscache_wait_on_volume_collision(struct fscache_volume *candidate,
>  {
>  	wait_var_event_timeout(&candidate->flags,
>  			       !fscache_is_acquire_pending(candidate), 20 * HZ);
> -	if (!fscache_is_acquire_pending(candidate)) {
> +	if (fscache_is_acquire_pending(candidate)) {
>  		pr_notice("Potential volume collision new=%08x old=%08x",
>  			  candidate->debug_id, collidee_debug_id);
>  		fscache_stat(&fscache_n_volumes_collision);

Yeah, I also noticed that before.



> @@ -182,7 +182,7 @@ static bool fscache_hash_volume(struct fscache_volume *candidate)
>  	hlist_bl_add_head(&candidate->hash_link, h);
>  	hlist_bl_unlock(h);
>  
> -	if (test_bit(FSCACHE_VOLUME_ACQUIRE_PENDING, &candidate->flags))
> +	if (fscache_is_acquire_pending(candidate))
>  		fscache_wait_on_volume_collision(candidate, collidee_debug_id);
>  	return true;
>  

LGTM.

Reviewed-by: Jeffle Xu <jefflexu@linux.alibaba.com>

-- 
Thanks,
Jeffle

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision()
       [not found] <20220525023212.32642-1-huyue2@coolpad.com>
  2022-05-26  9:37 ` [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision() Gao Xiang
  2022-07-01  9:03 ` JeffleXu
@ 2022-07-05 14:59 ` Jeff Layton
  2 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2022-07-05 14:59 UTC (permalink / raw)
  To: Yue Hu, dhowells, linux-cachefs; +Cc: zhangwen, linux-kernel, zbestahu

On Wed, 2022-05-25 at 10:32 +0800, Yue Hu wrote:
> After waiting for the volume to complete the acquisition with timeout,
> the if condition under which potential volume collision occurs should be
> acquire the volume is still pending rather than not pending so that we
> will continue to wait until the pending flag is cleared. Also, use the
> existing test pending wrapper directly instead of test_bit().
> 
> Signed-off-by: Yue Hu <huyue2@coolpad.com>
> ---
>  fs/fscache/volume.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fscache/volume.c b/fs/fscache/volume.c
> index 71d3a6d6d72c..f2009cc22002 100644
> --- a/fs/fscache/volume.c
> +++ b/fs/fscache/volume.c
> @@ -143,7 +143,7 @@ static void fscache_wait_on_volume_collision(struct fscache_volume *candidate,
>  {
>  	wait_var_event_timeout(&candidate->flags,
>  			       !fscache_is_acquire_pending(candidate), 20 * HZ);
> -	if (!fscache_is_acquire_pending(candidate)) {
> +	if (fscache_is_acquire_pending(candidate)) {
>  		pr_notice("Potential volume collision new=%08x old=%08x",
>  			  candidate->debug_id, collidee_debug_id);
>  		fscache_stat(&fscache_n_volumes_collision);
> @@ -182,7 +182,7 @@ static bool fscache_hash_volume(struct fscache_volume *candidate)
>  	hlist_bl_add_head(&candidate->hash_link, h);
>  	hlist_bl_unlock(h);
>  
> -	if (test_bit(FSCACHE_VOLUME_ACQUIRE_PENDING, &candidate->flags))
> +	if (fscache_is_acquire_pending(candidate))
>  		fscache_wait_on_volume_collision(candidate, collidee_debug_id);
>  	return true;
>  

Nice catch:

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-05 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220525023212.32642-1-huyue2@coolpad.com>
2022-05-26  9:37 ` [Linux-cachefs] [PATCH] fscache: Fix if condition in fscache_wait_on_volume_collision() Gao Xiang
2022-07-01  9:03 ` JeffleXu
2022-07-05 14:59 ` Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.