summaryrefslogtreecommitdiffstats
path: root/rust/helpers/workqueue.c
diff options
context:
space:
mode:
authorChunjie Zhu <chunjie.zhu@cloud.com>2025-04-12 21:15:55 -0500
committerSteve French <stfrench@microsoft.com>2025-04-13 17:24:55 -0500
commit262b73ef442e68e53220b9d6fc5a0d08b557fa42 (patch)
treee391505015800d9d922783ed9509a481f94c332b /rust/helpers/workqueue.c
parent8ffd015db85fea3e15a77027fda6c02ced4d2444 (diff)
downloadlinux-262b73ef442e68e53220b9d6fc5a0d08b557fa42.tar.gz
linux-262b73ef442e68e53220b9d6fc5a0d08b557fa42.tar.bz2
linux-262b73ef442e68e53220b9d6fc5a0d08b557fa42.zip
smb3 client: fix open hardlink on deferred close file error
The following Python script results in unexpected behaviour when run on a CIFS filesystem against a Windows Server: # Create file fd = os.open('test', os.O_WRONLY|os.O_CREAT) os.write(fd, b'foo') os.close(fd) # Open and close the file to leave a pending deferred close fd = os.open('test', os.O_RDONLY|os.O_DIRECT) os.close(fd) # Try to open the file via a hard link os.link('test', 'new') newfd = os.open('new', os.O_RDONLY|os.O_DIRECT) The final open returns EINVAL due to the server returning STATUS_INVALID_PARAMETER. The root cause of this is that the client caches lease keys per inode, but the spec requires them to be related to the filename which causes problems when hard links are involved: From MS-SMB2 section 3.3.5.9.11: "The server MUST attempt to locate a Lease by performing a lookup in the LeaseTable.LeaseList using the LeaseKey in the SMB2_CREATE_REQUEST_LEASE_V2 as the lookup key. If a lease is found, Lease.FileDeleteOnClose is FALSE, and Lease.Filename does not match the file name for the incoming request, the request MUST be failed with STATUS_INVALID_PARAMETER" On client side, we first check the context of file open, if it hits above conditions, we first close all opening files which are belong to the same inode, then we do open the hard link file. Cc: stable@vger.kernel.org Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'rust/helpers/workqueue.c')
0 files changed, 0 insertions, 0 deletions