From: David Howells Date: Wed, 1 Nov 2023 22:03:28 +0000 (+0000) Subject: afs: Fix file locking on R/O volumes to operate in local mode X-Git-Tag: v6.1.68~364 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48b3ee0134dbc27380c1f74d92582d141f8aac7f;p=platform%2Fkernel%2Flinux-starfive.git afs: Fix file locking on R/O volumes to operate in local mode [ Upstream commit b590eb41be766c5a63acc7e8896a042f7a4e8293 ] AFS doesn't really do locking on R/O volumes as fileservers don't maintain state with each other and thus a lock on a R/O volume file on one fileserver will not be be visible to someone looking at the same file on another fileserver. Further, the server may return an error if you try it. Fix this by doing what other AFS clients do and handle filelocking on R/O volume files entirely within the client and don't touch the server. Fixes: 6c6c1d63c243 ("afs: Provide mount-time configurable byte-range file locking emulation") Signed-off-by: David Howells Reviewed-by: Marc Dionne cc: linux-afs@lists.infradead.org Signed-off-by: Sasha Levin --- diff --git a/fs/afs/super.c b/fs/afs/super.c index 95d7130..e95fb4c 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -407,6 +407,8 @@ static int afs_validate_fc(struct fs_context *fc) return PTR_ERR(volume); ctx->volume = volume; + if (volume->type != AFSVL_RWVOL) + ctx->flock_mode = afs_flock_mode_local; } return 0;