diff options
author | Steve French <sfrench@us.ibm.com> | 2008-11-20 15:00:44 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-11-20 15:14:13 -0500 |
commit | ddb4cbfc53aa0913ee8da059fcbf628d14f40f63 (patch) | |
tree | d77a2d510fa3a3b6556052af024355ed5cfc43d8 /fs/cifs/readdir.c | |
parent | bfb59820ee46616a7bdb4af6b8f7e109646de6ec (diff) |
[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>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 58d57299f2a0..9f51f9bf0292 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -741,11 +741,14 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
741 | (index_to_find < first_entry_in_buffer)) { | 741 | (index_to_find < first_entry_in_buffer)) { |
742 | /* close and restart search */ | 742 | /* close and restart search */ |
743 | cFYI(1, ("search backing up - close and restart search")); | 743 | cFYI(1, ("search backing up - close and restart search")); |
744 | write_lock(&GlobalSMBSeslock); | ||
744 | if (!cifsFile->srch_inf.endOfSearch && | 745 | if (!cifsFile->srch_inf.endOfSearch && |
745 | !cifsFile->invalidHandle) { | 746 | !cifsFile->invalidHandle) { |
746 | cifsFile->invalidHandle = true; | 747 | cifsFile->invalidHandle = true; |
748 | write_unlock(&GlobalSMBSeslock); | ||
747 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 749 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
748 | } | 750 | } else |
751 | write_unlock(&GlobalSMBSeslock); | ||
749 | if (cifsFile->srch_inf.ntwrk_buf_start) { | 752 | if (cifsFile->srch_inf.ntwrk_buf_start) { |
750 | cFYI(1, ("freeing SMB ff cache buf on search rewind")); | 753 | cFYI(1, ("freeing SMB ff cache buf on search rewind")); |
751 | if (cifsFile->srch_inf.smallBuf) | 754 | if (cifsFile->srch_inf.smallBuf) |