aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2007-12-30 20:37:11 -0500
committerSteve French <sfrench@us.ibm.com>2007-12-30 20:37:11 -0500
commit1d9a8852c365fb7f8db0f8364210138985f457b8 (patch)
tree277aa7baf9e458edc757fdbc267e0b331340be22 /fs/cifs/connect.c
parent05b3de63da2abe804f5dbe0174298bf48949079f (diff)
[CIFS] redo existing session setup if needed in cifs_mount
When cifs_mount finds an existing SMB session that it can use for a new mount, it does not check to see whether that session is in need of being reconnected. An easy way to reproduce: 1) mount //server/share1 2) watch /proc/fs/cifs/DebugData for the share to go DISCONNECTED 3) mount //server/share2 with same creds as in step 1. The second mount will fail because CIFSTCon returned -EAGAIN. If you do an operation in share1 and then reattempt the mount it will work (since the session is reestablished). The following patch fixes this by having cifs_mount check the status of the session when it picks an existing session and calling cifs_setup_session on it again if it's in need of reconnection. Thanks to Wojciech Pilorz for the initial bug report. Signed-off-by: Jeff Layton <jlayton@tupile.poochiereds.net> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index fd9147cdb5a9..658f58b99e6f 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1964,7 +1964,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1964 1964
1965 if (existingCifsSes) { 1965 if (existingCifsSes) {
1966 pSesInfo = existingCifsSes; 1966 pSesInfo = existingCifsSes;
1967 cFYI(1, ("Existing smb sess found")); 1967 cFYI(1, ("Existing smb sess found (status=%d)",
1968 pSesInfo->status));
1969 if (pSesInfo->status == CifsNeedReconnect) {
1970 cFYI(1, ("Session needs reconnect"));
1971 down(&pSesInfo->sesSem);
1972 rc = cifs_setup_session(xid, pSesInfo,
1973 cifs_sb->local_nls);
1974 up(&pSesInfo->sesSem);
1975 }
1968 } else if (!rc) { 1976 } else if (!rc) {
1969 cFYI(1, ("Existing smb sess not found")); 1977 cFYI(1, ("Existing smb sess not found"));
1970 pSesInfo = sesInfoAlloc(); 1978 pSesInfo = sesInfoAlloc();