]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/cifs/smb2pdu.c
cifs: fail i/o on soft mounts if sessionsetup errors out
[mirror_ubuntu-bionic-kernel.git] / fs / cifs / smb2pdu.c
index f3288253c98fbd2071e383c2d8530c46caac57e7..c663594c331c687c2d0e444b83620abb9e49098e 100644 (file)
@@ -257,9 +257,14 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
        }
 
        rc = cifs_negotiate_protocol(0, tcon->ses);
-       if (!rc && tcon->ses->need_reconnect)
+       if (!rc && tcon->ses->need_reconnect) {
                rc = cifs_setup_session(0, tcon->ses, nls_codepage);
-
+               if ((rc == -EACCES) && !tcon->retry) {
+                       rc = -EHOSTDOWN;
+                       mutex_unlock(&tcon->ses->session_mutex);
+                       goto failed;
+               }
+       }
        if (rc || !tcon->need_reconnect) {
                mutex_unlock(&tcon->ses->session_mutex);
                goto out;
@@ -301,6 +306,7 @@ out:
        case SMB2_SET_INFO:
                rc = -EAGAIN;
        }
+failed:
        unload_nls(nls_codepage);
        return rc;
 }