[PATCH][v3] afs: Remove erroneous seq |= 1 in volume lookup loop

lirongqing posted 1 patch 3 weeks, 1 day ago
fs/afs/callback.c | 1 -
1 file changed, 1 deletion(-)
[PATCH][v3] afs: Remove erroneous seq |= 1 in volume lookup loop
Posted by lirongqing 3 weeks, 1 day ago
From: Li RongQing <lirongqing@baidu.com>

The `seq |= 1` operation in the volume lookup loop is incorrect because:
seq is already incremented at start, making it odd in next iteration
which triggers lock, but The `|= 1` operation causes seq to be even
and unintended lockless operation

Remove this erroneous operation to maintain proper lock sequencing.

Fixes: 32222f09782f ("afs: Apply server breaks to mmap'd files in the call processor")
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v2: add Reviewed-by, and Fixes tag
Diff with v1: rewrite the changelog

 fs/afs/callback.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index 69e1dd5..2c0d274 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -140,7 +140,6 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell,
 			break;
 		if (!need_seqretry(&cell->volume_lock, seq))
 			break;
-		seq |= 1; /* Want a lock next time */
 	}
 
 	done_seqretry(&cell->volume_lock, seq);
-- 
2.9.4
Re: [PATCH][v3] afs: Remove erroneous seq |= 1 in volume lookup loop
Posted by Li RongQing 2 days, 12 hours ago
On Wed, Sep 10, 2025 at 4:42 PM lirongqing <roy.qing.li@gmail.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> The `seq |= 1` operation in the volume lookup loop is incorrect because:
> seq is already incremented at start, making it odd in next iteration
> which triggers lock, but The `|= 1` operation causes seq to be even
> and unintended lockless operation
>
> Remove this erroneous operation to maintain proper lock sequencing.
>


ping

thanks

-Li


> Fixes: 32222f09782f ("afs: Apply server breaks to mmap'd files in the call processor")
> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> Diff with v2: add Reviewed-by, and Fixes tag
> Diff with v1: rewrite the changelog
>
>  fs/afs/callback.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/afs/callback.c b/fs/afs/callback.c
> index 69e1dd5..2c0d274 100644
> --- a/fs/afs/callback.c
> +++ b/fs/afs/callback.c
> @@ -140,7 +140,6 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell,
>                         break;
>                 if (!need_seqretry(&cell->volume_lock, seq))
>                         break;
> -               seq |= 1; /* Want a lock next time */
>         }
>
>         done_seqretry(&cell->volume_lock, seq);
> --
> 2.9.4
>