• Meetakshi Setiya's avatar
    smb: client: do not defer close open handles to deleted files · ffceb764
    Meetakshi Setiya authored
    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: default avatarMeetakshi Setiya <msetiya@microsoft.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    ffceb764
file.c 131 KB