[CIFS] Do not attempt to close invalidated file handles
If a connection with open file handles has gone down and come back up and reconnected without reopening the file handle yet, do not attempt to send an SMB close request for this handle in cifs_close. We were checking for the connection being invalid in cifs_close but since the connection may have been reconnected we also need to check whether the file handle was marked invalid (otherwise we could close the wrong file handle by accident). Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
@@ -741,11 +741,14 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
|
||||
(index_to_find < first_entry_in_buffer)) {
|
||||
/* close and restart search */
|
||||
cFYI(1, ("search backing up - close and restart search"));
|
||||
write_lock(&GlobalSMBSeslock);
|
||||
if (!cifsFile->srch_inf.endOfSearch &&
|
||||
!cifsFile->invalidHandle) {
|
||||
cifsFile->invalidHandle = true;
|
||||
write_unlock(&GlobalSMBSeslock);
|
||||
CIFSFindClose(xid, pTcon, cifsFile->netfid);
|
||||
}
|
||||
} else
|
||||
write_unlock(&GlobalSMBSeslock);
|
||||
if (cifsFile->srch_inf.ntwrk_buf_start) {
|
||||
cFYI(1, ("freeing SMB ff cache buf on search rewind"));
|
||||
if (cifsFile->srch_inf.smallBuf)
|
||||
|
Reference in New Issue
Block a user