diff options
author | Meetakshi Setiya <msetiya@microsoft.com> | 2024-03-06 08:07:52 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2024-03-11 03:33:54 +0300 |
commit | ffceb7640cbfe6ea60e7769e107451d63a2fe3d3 (patch) | |
tree | 0499df637d32a819c8d4d83c90686285cefe6d62 /fs/smb/client/cifsproto.h | |
parent | 2c7d399e551ccfd87bcae4ef5573097f3313d779 (diff) | |
download | linux-ffceb7640cbfe6ea60e7769e107451d63a2fe3d3.tar.xz |
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/cifsproto.h')
-rw-r--r-- | fs/smb/client/cifsproto.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h index cd1268fd843f..66d896d4b144 100644 --- a/fs/smb/client/cifsproto.h +++ b/fs/smb/client/cifsproto.h @@ -298,6 +298,10 @@ extern void cifs_close_all_deferred_files(struct cifs_tcon *cifs_tcon); extern void cifs_close_deferred_file_under_dentry(struct cifs_tcon *cifs_tcon, const char *path); + +extern void cifs_mark_open_handles_for_deleted_file(struct inode *inode, + const char *path); + extern struct TCP_Server_Info * cifs_get_tcp_session(struct smb3_fs_context *ctx, struct TCP_Server_Info *primary_server); |