diff options
author | Meetakshi Setiya <msetiya@microsoft.com> | 2024-03-06 06:07:52 +0100 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2024-03-11 01:33:54 +0100 |
commit | ffceb7640cbfe6ea60e7769e107451d63a2fe3d3 (patch) | |
tree | 0499df637d32a819c8d4d83c90686285cefe6d62 /fs/smb/client/cifsglob.h | |
parent | smb: client: reuse file lease key in compound operations (diff) | |
download | linux-ffceb7640cbfe6ea60e7769e107451d63a2fe3d3.tar.xz linux-ffceb7640cbfe6ea60e7769e107451d63a2fe3d3.zip |
smb: client: do not defer close open handles to deleted files
When a file/dentry has been deleted before closing all its open
handles, currently, closing them can add them to the deferred
close list. This can lead to problems in creating file with the
same name when the file is re-created before the deferred close
completes. This issue was seen while reusing a client's already
existing lease on a file for compound operations and xfstest 591
failed because of the deferred close handle that remained valid
even after the file was deleted and was being reused to create a
file with the same name. The server in this case returns an error
on open with STATUS_DELETE_PENDING. Recreating the file would
fail till the deferred handles are closed (duration specified in
closetimeo).
This patch fixes the issue by flagging all open handles for the
deleted file (file path to be precise) by setting
status_file_deleted to true in the cifsFileInfo structure. As per
the information classes specified in MS-FSCC, SMB2 query info
response from the server has a DeletePending field, set to true
to indicate that deletion has been requested on that file. If
this is the case, flag the open handles for this file too.
When doing close in cifs_close for each of these handles, check the
value of this boolean field and do not defer close these handles
if the corresponding filepath has been deleted.
Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/cifsglob.h')
-rw-r--r-- | fs/smb/client/cifsglob.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 0ad08642b7cf..20d3243b7449 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -1422,6 +1422,7 @@ struct cifsFileInfo { bool invalidHandle:1; /* file closed via session abend */ bool swapfile:1; bool oplock_break_cancelled:1; + bool status_file_deleted:1; /* file has been deleted */ unsigned int oplock_epoch; /* epoch from the lease break */ __u32 oplock_level; /* oplock/lease level from the lease break */ int count; |