* [PATCH] cifs: fail i/o on soft mounts if sessionsetup errors out
@ 2020-02-05 0:05 Ronnie Sahlberg
0 siblings, 0 replies; 4+ messages in thread
From: Ronnie Sahlberg @ 2020-02-05 0:05 UTC (permalink / raw)
To: linux-cifs; +Cc: Ronnie Sahlberg
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 <lsahlber@redhat.com>
---
fs/cifs/smb2pdu.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 14f209f7376f..879e058a73f9 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -350,9 +350,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 && !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;
@@ -397,6 +402,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
case SMB2_SET_INFO:
rc = -EAGAIN;
}
+failed:
unload_nls(nls_codepage);
return rc;
}
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cifs: fail i/o on soft mounts if sessionsetup errors out
2020-02-05 9:45 ` Steve French
@ 2020-02-06 7:47 ` Aurélien Aptel
0 siblings, 0 replies; 4+ messages in thread
From: Aurélien Aptel @ 2020-02-06 7:47 UTC (permalink / raw)
To: Steve French, Ronnie Sahlberg; +Cc: linux-cifs
Steve French <smfrench@gmail.com> writes:
>> 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.
Looks good to me but we need to make sure it doesnt break failover on the
buildbot.
Cheers,
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cifs: fail i/o on soft mounts if sessionsetup errors out
2020-02-05 1:08 Ronnie Sahlberg
@ 2020-02-05 9:45 ` Steve French
2020-02-06 7:47 ` Aurélien Aptel
0 siblings, 1 reply; 4+ messages in thread
From: Steve French @ 2020-02-05 9:45 UTC (permalink / raw)
To: Ronnie Sahlberg; +Cc: linux-cifs
Added cc:stable and merged into cifs-2.6.git for-next
On Tue, Feb 4, 2020 at 7:08 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> 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 <lsahlber@redhat.com>
> ---
> fs/cifs/smb2pdu.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 14f209f7376f..7996d81230aa 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -350,9 +350,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;
> @@ -397,6 +402,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
> case SMB2_SET_INFO:
> rc = -EAGAIN;
> }
> +failed:
> unload_nls(nls_codepage);
> return rc;
> }
> --
> 2.13.6
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] cifs: fail i/o on soft mounts if sessionsetup errors out
@ 2020-02-05 1:08 Ronnie Sahlberg
2020-02-05 9:45 ` Steve French
0 siblings, 1 reply; 4+ messages in thread
From: Ronnie Sahlberg @ 2020-02-05 1:08 UTC (permalink / raw)
To: linux-cifs; +Cc: Ronnie Sahlberg
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 <lsahlber@redhat.com>
---
fs/cifs/smb2pdu.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 14f209f7376f..7996d81230aa 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -350,9 +350,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;
@@ -397,6 +402,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
case SMB2_SET_INFO:
rc = -EAGAIN;
}
+failed:
unload_nls(nls_codepage);
return rc;
}
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-06 7:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 0:05 [PATCH] cifs: fail i/o on soft mounts if sessionsetup errors out Ronnie Sahlberg
2020-02-05 1:08 Ronnie Sahlberg
2020-02-05 9:45 ` Steve French
2020-02-06 7:47 ` Aurélien Aptel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).