Skip to content

Commit b0dd940

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: fail i/o on soft mounts if sessionsetup errors out
RHBZ: 1579050 If we have a soft mount we should fail commands for session-setup failures (such as the password having changed/ account being deleted/ ...) and return an error back to the application. Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]>
1 parent 87f93d8 commit b0dd940

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/cifs/smb2pdu.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,14 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
350350
}
351351

352352
rc = cifs_negotiate_protocol(0, tcon->ses);
353-
if (!rc && tcon->ses->need_reconnect)
353+
if (!rc && tcon->ses->need_reconnect) {
354354
rc = cifs_setup_session(0, tcon->ses, nls_codepage);
355-
355+
if ((rc == -EACCES) && !tcon->retry) {
356+
rc = -EHOSTDOWN;
357+
mutex_unlock(&tcon->ses->session_mutex);
358+
goto failed;
359+
}
360+
}
356361
if (rc || !tcon->need_reconnect) {
357362
mutex_unlock(&tcon->ses->session_mutex);
358363
goto out;
@@ -397,6 +402,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
397402
case SMB2_SET_INFO:
398403
rc = -EAGAIN;
399404
}
405+
failed:
400406
unload_nls(nls_codepage);
401407
return rc;
402408
}

0 commit comments

Comments
 (0)