Skip to content

Commit

Permalink
afs: Fix file locking on R/O volumes to operate in local mode
Browse files Browse the repository at this point in the history
[ Upstream commit b590eb4 ]

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: 6c6c1d6 ("afs: Provide mount-time configurable byte-range file locking emulation")
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dhowells authored and gregkh committed Dec 3, 2023
1 parent f9cf178 commit 48b3ee0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 48b3ee0

Please sign in to comment.