]> Git Repo - linux.git/commit
smb: client: fix rename(2) regression against samba
authorPaulo Alcantara <[email protected]>
Fri, 19 Apr 2024 15:05:07 +0000 (12:05 -0300)
committerSteve French <[email protected]>
Fri, 19 Apr 2024 21:02:45 +0000 (16:02 -0500)
commit18d86965e31f9be4d477da0744a7cdc9815858de
tree540fa545215e2cc05944e52d063cefbf1cba6e16
parentafc23febd51c7e24361e3a9c09f3e892eb0a41ea
smb: client: fix rename(2) regression against samba

After commit 2c7d399e551c ("smb: client: reuse file lease key in
compound operations") the client started reusing lease keys for
rename, unlink and set path size operations to prevent it from
breaking its own leases and thus causing unnecessary lease breaks to
same connection.

The implementation relies on positive dentries and
cifsInodeInfo::lease_granted to decide whether reusing lease keys for
the compound requests.  cifsInodeInfo::lease_granted was introduced by
commit 0ab95c2510b6 ("Defer close only when lease is enabled.") to
indicate whether lease caching is granted for a specific file, but
that can only happen until file is open, so
cifsInodeInfo::lease_granted was left uninitialised in ->alloc_inode
and then client started sending random lease keys for files that
hadn't any leases.

This fixes the following test case against samba:

mount.cifs //srv/share /mnt/1 -o ...,nosharesock
mount.cifs //srv/share /mnt/2 -o ...,nosharesock
touch /mnt/1/foo; tail -f /mnt/1/foo & pid=$!
mv /mnt/2/foo /mnt/2/bar # fails with -EIO
kill $pid

Fixes: 0ab95c2510b6 ("Defer close only when lease is enabled.")
Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
Signed-off-by: Steve French <[email protected]>
fs/smb/client/cifsfs.c
This page took 0.05543 seconds and 4 git commands to generate.