Patch "smb: client: fix rename(2) regression against samba" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    smb: client: fix rename(2) regression against samba

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     smb-client-fix-rename-2-regression-against-samba.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 08c529b400fa1c02f579fd87f590e1912989874b
Author: Paulo Alcantara <pc@xxxxxxxxxxxxx>
Date:   Fri Apr 19 12:05:07 2024 -0300

    smb: client: fix rename(2) regression against samba
    
    [ Upstream commit 18d86965e31f9be4d477da0744a7cdc9815858de ]
    
    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) <pc@xxxxxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 501bfd3afdc64..81fe60815885c 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -393,6 +393,7 @@ cifs_alloc_inode(struct super_block *sb)
 	 * server, can not assume caching of file data or metadata.
 	 */
 	cifs_set_oplock_level(cifs_inode, 0);
+	cifs_inode->lease_granted = false;
 	cifs_inode->flags = 0;
 	spin_lock_init(&cifs_inode->writers_lock);
 	cifs_inode->writers = 0;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux