]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[CIFS] redo existing session setup if needed in cifs_mount
authorJeff Layton <jlayton@redhat.com>
Mon, 31 Dec 2007 01:37:11 +0000 (01:37 +0000)
committerSteve French <sfrench@us.ibm.com>
Mon, 31 Dec 2007 01:37:11 +0000 (01:37 +0000)
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>
fs/cifs/CHANGES
fs/cifs/connect.c

index 13d788f9e5f05b0e0d1a5f81713ee80eb2c72b81..0c778765bd79e79439b2a1f978fc969f04e8ebfd 100644 (file)
@@ -3,7 +3,8 @@ Version 1.52
 Fix oops on second mount to server when null auth is used.
 Enable experimental Kerberos support.  Return writebehind errors on flush
 and sync so that events like out of disk space get reported properly on
-cached files. Fix setxattr failure to certain Samba versions.
+cached files. Fix setxattr failure to certain Samba versions. Fix mount
+of second share to disconnected server session (autoreconnect on this).
 
 Version 1.51
 ------------
index fd9147cdb5a98d76b8a354b3b2a8efd518aeb565..658f58b99e6f5b1f00aaafb1c0b339fdb9698a97 100644 (file)
@@ -1964,7 +1964,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
 
        if (existingCifsSes) {
                pSesInfo = existingCifsSes;
-               cFYI(1, ("Existing smb sess found"));
+               cFYI(1, ("Existing smb sess found (status=%d)",
+                       pSesInfo->status));
+               if (pSesInfo->status == CifsNeedReconnect) {
+                       cFYI(1, ("Session needs reconnect"));
+                       down(&pSesInfo->sesSem);
+                       rc = cifs_setup_session(xid, pSesInfo,
+                                               cifs_sb->local_nls);
+                       up(&pSesInfo->sesSem);
+               }
        } else if (!rc) {
                cFYI(1, ("Existing smb sess not found"));
                pSesInfo = sesInfoAlloc();