Avoid reconnects of failed session setups on soft mounts
Subsystems (2)
cover Avoid reconnects of failed session setups on soft mounts
Commit b0dd940e582b6a6 ("cifs: fail i/o on soft mounts if sessionsetup errors out") didn't fix the whole problem. New i/o requests still try reconnects on the wire. But we need to avoid that in order to avoid locking out the user account.
The first patches consolidate the retry/reconnect handling between SMB1 and SMB2/3.
Then we map STATUS_ACCOUNT_LOCKED_OUT also to -EACCES, as it's the follow up of STATUS_LOGON_FAILURE when the wrong password was used too often.
Finally if we get -EACCES for a session setup on a soft mount, we'll turn the session into a CifsInvalidCredentials state and return -EKEYREVOKED for all i/o on the session, without trying to reconnect the network connection.
In future we could add ways to recover such sessions. cifs_demultiplex_thread() is already prepared for that. I tested this with a trivial /proc/fs/cifs/ResetInvalidCredentials to reset all sessions, but I don't think that's something that should be used in production.
For now the only way out is 'umount' (as before).
metze
PATCH 1/13 cifs: call wake_up(&server->response_q) inside of cifs_reconnect()
This means it's consistently called and the callers don't need to care about it.
--- fs/cifs/cifssmb.c | 1 - fs/cifs/connect.c | 7 ++----- fs/cifs/smb2ops.c | 3 --- 3 files changed, 2 insertions(+), 9 deletions(-)
fs/cifs/cifssmb.c +0 -1
@@ -1590,7 +1590,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)if (server->ops->is_session_expired && server->ops->is_session_expired (buf)) {cifs_reconnect (server); -wake_up (&server->response_q);return -1 ; }
fs/cifs/connect.c +2 -5
@@ -537,6 +537,7 @@ cifs_reconnect(struct TCP_Server_Info *server)dfs_cache_free_tgts (&tgt_list);put_tcp_super (sb);#endif +wake_up (&server->response_q);return rc; }else server->tcpStatus = CifsNeedReconnect;
@@ -671,6 +672,7 @@ cifs_reconnect(struct TCP_Server_Info *server)if (server->tcpStatus == CifsNeedNegotiate)mod_delayed_work (cifsiod_wq, &server->echo,0 ); +wake_up (&server->response_q);return rc; }
@@ -765,7 +767,6 @@ server_unresponsive(struct TCP_Server_Info *server)cifs_server_dbg (VFS ,"has not responded in %lu seconds. Reconnecting...\n" , (3 * server->echo_interval) /HZ );cifs_reconnect (server); -wake_up (&server->response_q);return true; }
@@ -898,7 +899,6 @@ is_smb_response(struct TCP_Server_Info *server, unsigned char type)*/ cifs_set_port ((struct sockaddr *)&server->dstaddr,CIFS_PORT );cifs_reconnect (server); -wake_up (&server->response_q);break ;default :cifs_server_dbg (VFS ,"RFC 1002 unknown response type 0x%x\n" , type);
@@ -1070,7 +1070,6 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid) server->vals->header_preamble_size) {cifs_server_dbg (VFS ,"SMB response too long (%u bytes)\n" , pdu_length);cifs_reconnect (server); -wake_up (&server->response_q);return -ECONNABORTED ; }
@@ -1118,7 +1117,6 @@ cifs_handle_standard(struct TCP_Server_Info *server, struct mid_q_entry *mid)if (server->ops->is_session_expired && server->ops->is_session_expired (buf)) {cifs_reconnect (server); -wake_up (&server->response_q);return -1 ; }
@@ -1212,7 +1210,6 @@ cifs_demultiplex_thread(void *p)cifs_server_dbg (VFS ,"SMB response too short (%u bytes)\n" , server->pdu_size);cifs_reconnect (server); -wake_up (&server->response_q);continue ; }
fs/cifs/smb2ops.c +0 -3
@@ -4148,7 +4148,6 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,if (server->ops->is_session_expired && server->ops->is_session_expired (buf)) {cifs_reconnect (server); -wake_up (&server->response_q);return -1 ; }
@@ -4512,14 +4511,12 @@ smb3_receive_transform(struct TCP_Server_Info *server,cifs_server_dbg (VFS ,"Transform message is too small (%u)\n" , pdu_length);cifs_reconnect (server); -wake_up (&server->response_q);return -ECONNABORTED ; }if (pdu_length < orig_len +sizeof (struct smb2_transform_hdr )) {cifs_server_dbg (VFS ,"Transform message is broken\n" );cifs_reconnect (server); -wake_up (&server->response_q);return -ECONNABORTED ; }
Signature · 1 line
2.17.1
PATCH 2/13 cifs: use mod_delayed_work() for &server->reconnect if already queued
In reply to Stefan Metzmachermod_delayed_work() is safer than queue_delayed_work() if there's a chance that the work is already in the queue.
--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -378,7 +378,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) }if (smb2_command !=SMB2_INTERNAL_CMD ) -queue_delayed_work (cifsiod_wq, &server->reconnect,0 ); +mod_delayed_work (cifsiod_wq, &server->reconnect,0 );atomic_inc (&tconInfoReconnectCount); out:
@@ -3558,7 +3558,7 @@ SMB2_echo(struct TCP_Server_Info *server)if (server->tcpStatus == CifsNeedNegotiate) {/* No need to send echo on newly established connections */ -queue_delayed_work (cifsiod_wq, &server->reconnect,0 ); +mod_delayed_work (cifsiod_wq, &server->reconnect,0 );return rc; }
Signature · 1 line
2.17.1
PATCH 3/13 cifs: make use of cap_unix(ses) in cifs_reconnect_tcon()
In reply to Stefan Metzmachercap_unix(ses) defaults to false for SMB2.
--- fs/cifs/cifssmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifssmb.c +1 -1
@@ -320,7 +320,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)atomic_inc (&tconInfoReconnectCount);/* tell server Unix caps we support */ -if (ses->capabilities &CAP_UNIX ) +if (cap_unix (ses))reset_cifs_unix_caps (0 , tcon,NULL ,NULL );/*
Signature · 1 line
2.17.1
Re: [PATCH v1 03/13] cifs: make use of cap_unix(ses) in cifs_reconnect_tcon()
Signature · 4 lines
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)
Re: [PATCH v1 03/13] cifs: make use of cap_unix(ses) in cifs_reconnect_tcon()
First three patches in this series merged into cifs-2.6.git for-next (and the buildbot's github tree) pending more testing and review
Quoted 8 lines · Aurélien Aptel
Reviewed-by Aurelien Aptel <[email protected]>--
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)
Signature · 3 lines
Thanks, Steve
Pavel Shilovsky
Reviewed-byRe: [PATCH v1 03/13] cifs: make use of cap_unix(ses) in cifs_reconnect_tcon()
The first tree patches look good.
--
Best regards,
Pavel Shilovsky
пн, 24 февр. 2020 г. в 12:39, Steve French <[email protected]>:
Quoted 20 lines
First three patches in this series merged into cifs-2.6.git for-next (and the buildbot's github tree) pending more testing and review
Quoted 8 lines · Aurélien Aptel
Reviewed-by Aurelien Aptel <[email protected]>--
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)--
Thanks,Steve
PATCH 4/13 cifs: split out a cifs_connect_session_locked() helper function
In reply to Stefan Metzmacher--- fs/cifs/cifsproto.h | 8 +++---- fs/cifs/cifssmb.c | 13 +++--------- fs/cifs/connect.c | 51 +++++++++++++++++++++++++++++---------------- fs/cifs/sess.c | 9 ++++---- fs/cifs/smb2pdu.c | 21 +++++-------------- 5 files changed, 49 insertions(+), 53 deletions(-)
fs/cifs/cifsproto.h +4 -4
@@ -263,10 +263,10 @@ extern void cifs_move_llist(struct list_head *source, struct list_head *dest);extern void cifs_free_llist (struct list_head *llist);extern void cifs_del_lock_waiters (struct cifsLockInfo *lock); -extern int cifs_negotiate_protocol (const unsigned int xid, -struct cifs_ses *ses); -extern int cifs_setup_session (const unsigned int xid,struct cifs_ses *ses, -struct nls_table *nls_info); +extern int cifs_connect_session_locked (const unsigned int xid, +struct cifs_ses *ses, +struct nls_table *nls_info, +bool retry);extern int cifs_enable_signing (struct TCP_Server_Info *server,bool mnt_sign_required);extern int CIFSSMBNegotiate (const unsigned int xid,struct cifs_ses *ses);
fs/cifs/cifssmb.c +3 -10
@@ -291,16 +291,9 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* and the server never sends an answer the socket will be closed * and tcpStatus set to reconnect. */ -if (server->tcpStatus == CifsNeedReconnect) { - rc = -EHOSTDOWN ; -mutex_unlock (&ses->session_mutex); - goto out; - } - - rc =cifs_negotiate_protocol (0 , ses); -if (rc ==0 && ses->need_reconnect) - rc =cifs_setup_session (0 , ses, nls_codepage); - + rc =cifs_connect_session_locked (0 , ses, + nls_codepage, + tcon->retry);/* do we need to reconnect tcon? */ if (rc || !tcon->need_reconnect) {mutex_unlock (&ses->session_mutex);
fs/cifs/connect.c +33 -18
87 lines not on this page · raw message
fs/cifs/sess.c +4 -5
@@ -252,11 +252,10 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface) } ses->binding = true; - rc =cifs_negotiate_protocol (xid, ses); -if (rc) - goto out; - - rc =cifs_setup_session (xid, ses, vol.local_nls); + rc =cifs_connect_session_locked (xid, + ses, + vol.local_nls, + true/* retry */ );if (rc) goto out;
fs/cifs/smb2pdu.c +5 -16
@@ -343,21 +343,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)* and the server never sends an answer the socket will be closed * and tcpStatus set to reconnect. */ -if (server->tcpStatus == CifsNeedReconnect) { - rc = -EHOSTDOWN ; -mutex_unlock (&tcon->ses->session_mutex); - goto out; - } - - rc =cifs_negotiate_protocol (0 , tcon->ses); -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; - } - } + rc =cifs_connect_session_locked (0 , tcon->ses, + nls_codepage, + tcon->retry); +/* do we need to reconnect tcon? */ if (rc || !tcon->need_reconnect) {mutex_unlock (&tcon->ses->session_mutex); goto out;
@@ -402,7 +391,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)case SMB2_SET_INFO : rc = -EAGAIN ; } -failed: +unload_nls (nls_codepage);return rc; }
Signature · 1 line
2.17.1
Re: [PATCH v1 04/13] cifs: split out a cifs_connect_session_locked() helper function
This LGTM but I think we should really test it on the buildbot. Especially DFS failover and multichannel.
fs/cifs/connect.c cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, · line 5303
Quoted 11 lines · Stefan Metzmacher
fs/cifs/connect.c +11
-0+int +cifs_connect_session_locked (const unsigned int xid, +struct cifs_ses *ses, +struct nls_table *nls_info, +bool retry) +{ +int rc; + +if (ses->server->tcpStatus == CifsNeedReconnect) { +return -EHOSTDOWN ; + }
This check is now done everytime. Probably it's correct, but worth pointing out.
Signature · 4 lines
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)
PATCH 5/13 cifs: merge __{cifs,smb2}_reconnect[_tcon]() into cifs_tree_connect()
In reply to Stefan MetzmacherThey were identical execpt to CIFSTCon() vs. SMB2_tcon(). These are also available via ops->tree_connect().
--- fs/cifs/cifsproto.h | 3 ++ fs/cifs/cifssmb.c | 82 +------------------------------------------ fs/cifs/connect.c | 84 +++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/smb2pdu.c | 82 +------------------------------------------ 4 files changed, 89 insertions(+), 162 deletions(-)
fs/cifs/cifsproto.h +3 -0
@@ -263,6 +263,9 @@ extern void cifs_move_llist(struct list_head *source, struct list_head *dest);extern void cifs_free_llist (struct list_head *llist);extern void cifs_del_lock_waiters (struct cifsLockInfo *lock); +extern int cifs_tree_connect (const unsigned int xid, +struct cifs_tcon *tcon, +const struct nls_table *nlsc); extern int cifs_connect_session_locked(const unsigned int xid, struct cifs_ses *ses, struct nls_table *nls_info,
fs/cifs/cifssmb.c +1 -81
94 lines not on this page · raw message
fs/cifs/connect.c +84 -0
90 lines not on this page · raw message
fs/cifs/smb2pdu.c +1 -81
94 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v1 05/13] cifs: merge __{cifs,smb2}_reconnect[_tcon]() into cifs_tree_connect()
This one LGTM but doesn't apply anymore.
Cheers,
Signature · 4 lines
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)
PATCH 6/13 cifs: abstract cifs_tcon_reconnect() out of smb2_reconnect()
In reply to Stefan Metzmachercifs_tcon_reconnect() will also be used in cifs_reconnect_tcon() with the next commit.
--- fs/cifs/cifsglob.h | 8 +++ fs/cifs/cifsproto.h | 3 + fs/cifs/connect.c | 125 ++++++++++++++++++++++++++++++++++++ fs/cifs/smb2pdu.c | 151 +++++++++----------------------------------- 4 files changed, 166 insertions(+), 121 deletions(-)
fs/cifs/cifsglob.h +8 -0
@@ -1074,6 +1074,14 @@ struct cached_fid {struct smb2_file_all_info file_all_info; }; +struct cifs_tcon_reconnect_params { +bool skip_reconnect; +bool exit_nodev; +bool early_eagain; +bool late_eagain; +bool start_timer; +}; +/* * there is one of these for each connection to a resource on a particular * session
fs/cifs/cifsproto.h +3 -0
@@ -270,6 +270,9 @@ extern int cifs_connect_session_locked(const unsigned int xid,struct cifs_ses *ses, struct nls_table *nls_info, bool retry); +extern int cifs_tcon_reconnect (struct cifs_tcon *tcon, +const struct cifs_tcon_reconnect_params *params); +extern int cifs_enable_signing (struct TCP_Server_Info *server,bool mnt_sign_required);extern int CIFSSMBNegotiate (const unsigned int xid,struct cifs_ses *ses);
fs/cifs/connect.c +125 -0
131 lines not on this page · raw message
fs/cifs/smb2pdu.c +30 -121
180 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v1 06/13] cifs: abstract cifs_tcon_reconnect() out of smb2_reconnect()
Any updates on this (rebase) on the remaining 10?
Quoted 368 lines · Stefan Metzmacher
cifs_tcon_reconnect()will also be used incifs_reconnect_tcon()with the next commit.Signed-off-by Stefan Metzmacher <[email protected]>--- fs/cifs/cifsglob.h | 8 +++ fs/cifs/cifsproto.h | 3 + fs/cifs/connect.c | 125 ++++++++++++++++++++++++++++++++++++ fs/cifs/smb2pdu.c | 151 +++++++++----------------------------------- 4 files changed, 166 insertions(+), 121 deletions(-)fs/cifs/cifsglob.h +8
-0@@ -1074,6 +1074,14 @@ struct cached_fid {struct smb2_file_all_info file_all_info; }; +struct cifs_tcon_reconnect_params { +bool skip_reconnect; +bool exit_nodev; +bool early_eagain; +bool late_eagain; +bool start_timer; +}; +/* * there is one of these for each connection to a resource on a particular * session fs/cifs/cifsproto.h +3
-0@@ -270,6 +270,9 @@ extern int cifs_connect_session_locked(const unsigned int xid,struct cifs_ses *ses, struct nls_table *nls_info, bool retry); +extern int cifs_tcon_reconnect (struct cifs_tcon *tcon, +const struct cifs_tcon_reconnect_params *params); +extern int cifs_enable_signing (struct TCP_Server_Info *server,bool mnt_sign_required);extern int CIFSSMBNegotiate (const unsigned int xid,struct cifs_ses *ses);fs/cifs/connect.c +125
-0@@ -5398,6 +5398,131 @@ cifs_connect_session_locked(const unsigned int xid,return rc; } +int +cifs_tcon_reconnect (struct cifs_tcon *tcon, +const struct cifs_tcon_reconnect_params *params) +{ +int rc; +struct nls_table *nls_codepage; +struct cifs_ses *ses; +struct TCP_Server_Info *server; +int retries; + +/* +* SMB2s NegProt, SessSetup, Logoff do not have tcon yet so +* check for tcp and smb session status done differently +* for those three - in the calling routine. +*/ +if (tcon ==NULL ) +return 0 ; + + ses = tcon->ses; + server = ses->server; + +if (params->skip_reconnect) +return 0 ; + +if (tcon->tidStatus == CifsExiting) { +if (params->exit_nodev) { +cifs_dbg (FYI ,"return ENODEV while umounting\n" ); +return -ENODEV ; + } + } +if ((!ses) || (ses->status == CifsExiting) || (!server)) +return -EIO ; + + retries = server->nr_targets; + +/* +* Give demultiplex thread up to 10 seconds to each target available for +* reconnect -- should be greater than cifs socket timeout which is 7 +* seconds. +*/ +while (server->tcpStatus == CifsNeedReconnect) { +if (params->early_eagain) { +return -EAGAIN ; + } + + rc =wait_event_interruptible_timeout (server->response_q, + (server->tcpStatus != CifsNeedReconnect), +10 *HZ ); +if (rc <0 ) { +cifs_dbg (FYI ,"%s: aborting reconnect due to a received" +" signal by the process\n" , __func__); +return -ERESTARTSYS ; + } + +/* are we still trying to reconnect? */ +if (server->tcpStatus != CifsNeedReconnect) +break ; + +if (retries && --retries) +continue ; + +/* +* on "soft" mounts we wait once. Hard mounts keep +* retrying until process is killed or server comes +* back on-line +*/ +if (!tcon->retry) { +cifs_dbg (FYI ,"gave up waiting on reconnect in smb_init\n" ); +return -EHOSTDOWN ; + } + retries = server->nr_targets; + } + +if (!ses->need_reconnect && !tcon->need_reconnect) +return 0 ; + + nls_codepage =load_nls_default (); + +/* +* need to prevent multiple threads trying to simultaneously reconnect +* the same SMB session +*/ +mutex_lock (&ses->session_mutex); + +/* +* Recheck after acquire mutex. If another thread is negotiating +* and the server never sends an answer the socket will be closed +* and tcpStatus set to reconnect. +*/ + rc =cifs_connect_session_locked (0 , ses, + nls_codepage, + tcon->retry); +/* do we need to reconnect tcon? */ +if (rc || !tcon->need_reconnect) { +mutex_unlock (&ses->session_mutex); + goto out; + } + +cifs_mark_open_files_invalid (tcon); +if (tcon->use_persistent) + tcon->need_reopen_files = true; + + rc =cifs_tree_connect (0 , tcon, nls_codepage); +mutex_unlock (&ses->session_mutex); + +cifs_dbg (FYI ,"reconnect tcon rc = %d\n" , rc); +if (rc) { +/* If sess reconnected but tcon didn't, something strange ... */ +printk_once (KERN_WARNING "reconnect tcon failed rc = %d\n" , rc); + goto out; + } + +if (params->start_timer) +mod_delayed_work (cifsiod_wq, &server->reconnect,0 ); + +atomic_inc (&tconInfoReconnectCount); +out: +if (params->late_eagain) { + rc = -EAGAIN ; + } + +unload_nls (nls_codepage); +return rc; +} +static int cifs_set_vol_auth (struct smb_vol *vol,struct cifs_ses *ses) {fs/cifs/smb2pdu.c +30
-122@@ -158,139 +158,48 @@ smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,static int smb2_reconnect (__le16 smb2_command,struct cifs_tcon *tcon) { -int rc; -struct nls_table *nls_codepage; -struct cifs_ses *ses; -struct TCP_Server_Info *server; -int retries; - -/* -* SMB2s NegProt, SessSetup, Logoff do not have tcon yet so -* check for tcp and smb session status done differently -* for those three - in the calling routine. -*/ -if (tcon ==NULL ) -return 0 ; +struct cifs_tcon_reconnect_params params = { + .skip_reconnect = false, + }; -if (smb2_command ==SMB2_TREE_CONNECT ) -return 0 ; - -if (tcon->tidStatus == CifsExiting) { -/* -* only tree disconnect, open, and write, -* (and ulogoff which does not have tcon) -* are allowed as we start force umount. -*/ -if ((smb2_command !=SMB2_WRITE ) && - (smb2_command !=SMB2_CREATE ) && - (smb2_command !=SMB2_TREE_DISCONNECT )) { -cifs_dbg (FYI ,"can not send cmd %d while umounting\n" , - smb2_command); -return -ENODEV ; - } +switch (smb2_command) { +case SMB2_TREE_CONNECT : + params.skip_reconnect = true; +break ; } -if ((!tcon->ses) || (tcon->ses->status == CifsExiting) || - (!tcon->ses->server)) -return -EIO ; - - ses = tcon->ses; - server = ses->server; - - retries = server->nr_targets;/* -* Give demultiplex thread up to 10 seconds to each target available for -* reconnect -- should be greater than cifs socket timeout which is 7 -* seconds. +* only tree disconnect, open, and write, +* (and ulogoff which does not have tcon) +* are allowed as we start force umount. */ -while (server->tcpStatus == CifsNeedReconnect) { -/* -* Return to caller for TREE_DISCONNECT and LOGOFF and CLOSE -* here since they are implicitly done when session drops. -*/ -switch (smb2_command) { -/* -* BB Should we keep oplock break and add flush to exceptions? -*/ -case SMB2_TREE_DISCONNECT : -case SMB2_CANCEL : -case SMB2_CLOSE : -case SMB2_OPLOCK_BREAK : -return -EAGAIN ; - } - - rc =wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect), -10 *HZ ); -if (rc <0 ) { -cifs_dbg (FYI ,"%s: aborting reconnect due to a received" -" signal by the process\n" , __func__); -return -ERESTARTSYS ; - } - -/* are we still trying to reconnect? */ -if (server->tcpStatus != CifsNeedReconnect) -break ; - -if (retries && --retries) -continue ; - -/* -* on "soft" mounts we wait once. Hard mounts keep -* retrying until process is killed or server comes -* back on-line -*/ -if (!tcon->retry) { -cifs_dbg (FYI ,"gave up waiting on reconnect in smb_init\n" ); -return -EHOSTDOWN ; - } - retries = server->nr_targets; +switch (smb2_command) { +case SMB2_WRITE : +case SMB2_CREATE : +case SMB2_TREE_DISCONNECT : + params.exit_nodev = true; +break ; } -if (!tcon->ses->need_reconnect && !tcon->need_reconnect) -return 0 ; - - nls_codepage =load_nls_default (); -/* -* need to prevent multiple threads trying to simultaneously reconnect -* the same SMB session +* Return to caller for TREE_DISCONNECT and LOGOFF and CLOSE +* here since they are implicitly done when session drops. */ -mutex_lock (&tcon->ses->session_mutex); - +switch (smb2_command) {/* -* Recheck after acquire mutex. If another thread is negotiating -* and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* BB Should we keep oplock break and add flush to exceptions? */ - rc =cifs_connect_session_locked (0 , tcon->ses, - nls_codepage, - tcon->retry); -/* do we need to reconnect tcon? */ -if (rc || !tcon->need_reconnect) { -mutex_unlock (&tcon->ses->session_mutex); - goto out; - } - -cifs_mark_open_files_invalid (tcon); -if (tcon->use_persistent) - tcon->need_reopen_files = true; - - rc =cifs_tree_connect (0 , tcon, nls_codepage); -mutex_unlock (&tcon->ses->session_mutex); - -cifs_dbg (FYI ,"reconnect tcon rc = %d\n" , rc); -if (rc) { -/* If sess reconnected but tcon didn't, something strange ... */ -printk_once (KERN_WARNING "reconnect tcon failed rc = %d\n" , rc); - goto out; +case SMB2_TREE_DISCONNECT : +case SMB2_CANCEL : +case SMB2_CLOSE : +case SMB2_OPLOCK_BREAK : + params.early_eagain = true; +break ; }if (smb2_command !=SMB2_INTERNAL_CMD ) -mod_delayed_work (cifsiod_wq, &server->reconnect,0 ); + params.start_timer = true; -atomic_inc (&tconInfoReconnectCount); -out:/* * Check if handle based operation so we know whether we can continue * or not without returning to caller to reset file handle. @@ -309,11 +218,11 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)case SMB2_CHANGE_NOTIFY :case SMB2_QUERY_INFO :case SMB2_SET_INFO : - rc = -EAGAIN ; + params.late_eagain = true; +break ; } -unload_nls (nls_codepage); -return rc; +return cifs_tcon_reconnect (tcon, ¶ms); } static void --
Quoted 2 lines
2.17.1
--
Thanks,
Steve
PATCH 7/13 cifs: cifs_reconnect_tcon() make use of the generic cifs_tcon_reconnect() function
In reply to Stefan Metzmacher--- fs/cifs/cifssmb.c | 117 +++++----------------------------------------- fs/cifs/connect.c | 7 +++ 2 files changed, 19 insertions(+), 105 deletions(-)
fs/cifs/cifssmb.c +12 -105
@@ -128,114 +128,22 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)static int cifs_reconnect_tcon (struct cifs_tcon *tcon,int smb_command) { -int rc; -struct cifs_ses *ses; -struct TCP_Server_Info *server; -struct nls_table *nls_codepage; -int retries; - -/* -* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for -* tcp and smb session status done differently for those three - in the -* calling routine -*/ -if (!tcon) -return 0 ; - - ses = tcon->ses; - server = ses->server; +struct cifs_tcon_reconnect_params params = { + .skip_reconnect = false, + };/* * only tree disconnect, open, and write, (and ulogoff which does not * have tcon) are allowed as we start force umount */ -if (tcon->tidStatus == CifsExiting) { -if (smb_command !=SMB_COM_WRITE_ANDX && - smb_command !=SMB_COM_OPEN_ANDX && - smb_command !=SMB_COM_TREE_DISCONNECT ) { -cifs_dbg (FYI ,"can not send cmd %d while umounting\n" , - smb_command); -return -ENODEV ; - } - } - - retries = server->nr_targets; - -/* -* Give demultiplex thread up to 10 seconds to each target available for -* reconnect -- should be greater than cifs socket timeout which is 7 -* seconds. -*/ -while (server->tcpStatus == CifsNeedReconnect) { - rc =wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect), -10 *HZ ); -if (rc <0 ) { -cifs_dbg (FYI ,"%s: aborting reconnect due to a received" -" signal by the process\n" , __func__); -return -ERESTARTSYS ; - } - -/* are we still trying to reconnect? */ -if (server->tcpStatus != CifsNeedReconnect) -break ; - -if (retries && --retries) -continue ; - -/* -* on "soft" mounts we wait once. Hard mounts keep -* retrying until process is killed or server comes -* back on-line -*/ -if (!tcon->retry) { -cifs_dbg (FYI ,"gave up waiting on reconnect in smb_init\n" ); -return -EHOSTDOWN ; - } - retries = server->nr_targets; - } - -if (!ses->need_reconnect && !tcon->need_reconnect) -return 0 ; - - nls_codepage =load_nls_default (); - -/* -* need to prevent multiple threads trying to simultaneously -* reconnect the same SMB session -*/ -mutex_lock (&ses->session_mutex); - -/* -* Recheck after acquire mutex. If another thread is negotiating -* and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. -*/ - rc =cifs_connect_session_locked (0 , ses, - nls_codepage, - tcon->retry); -/* do we need to reconnect tcon? */ -if (rc || !tcon->need_reconnect) { -mutex_unlock (&ses->session_mutex); - goto out; - } - -cifs_mark_open_files_invalid (tcon); - rc =cifs_tree_connect (0 , tcon, nls_codepage); -mutex_unlock (&ses->session_mutex); -cifs_dbg (FYI ,"reconnect tcon rc = %d\n" , rc); - -if (rc) { -printk_once (KERN_WARNING "reconnect tcon failed rc = %d\n" , rc); - goto out; +switch (smb_command) { +case SMB_COM_WRITE_ANDX : +case SMB_COM_OPEN_ANDX : +case SMB_COM_TREE_DISCONNECT : + params.exit_nodev = true; +break ; } -atomic_inc (&tconInfoReconnectCount); - -/* tell server Unix caps we support */ -if (cap_unix (ses)) -reset_cifs_unix_caps (0 , tcon,NULL ,NULL ); -/* * Removed call to reopen open files here. It is safer (and faster) to * reopen files one at a time as needed in read and write.
@@ -243,7 +151,6 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* FIXME: what about file locks? don't we need to reclaim them ASAP? */ -out:/* * Check if handle based operation so we know whether we can continue * or not without returning to caller to reset file handle
@@ -254,11 +161,11 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)case SMB_COM_CLOSE :case SMB_COM_FIND_CLOSE2 :case SMB_COM_LOCKING_ANDX : - rc = -EAGAIN ; + params.late_eagain = true; +break ; } -unload_nls (nls_codepage); -return rc; +return cifs_tcon_reconnect (tcon, ¶ms); }/* Allocate and return pointer to an SMB request buffer, and set basic
fs/cifs/connect.c +7 -0
@@ -5510,6 +5510,13 @@ cifs_tcon_reconnect(struct cifs_tcon *tcon, goto out; } +/* +* tell server Unix caps we support, +* note it's a noop for SMB2. +*/ +if (cap_unix (ses)) +reset_cifs_unix_caps (0 , tcon,NULL ,NULL ); +if (params->start_timer)mod_delayed_work (cifsiod_wq, &server->reconnect,0 );
Signature · 1 line
2.17.1
PATCH 8/13 cifs: make cifs_tree_connect() static
In reply to Stefan Metzmacher--- fs/cifs/cifsproto.h | 3 --- fs/cifs/connect.c | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-)
fs/cifs/cifsproto.h +0 -3
@@ -263,9 +263,6 @@ extern void cifs_move_llist(struct list_head *source, struct list_head *dest);extern void cifs_free_llist (struct list_head *llist);extern void cifs_del_lock_waiters (struct cifsLockInfo *lock); -extern int cifs_tree_connect (const unsigned int xid, -struct cifs_tcon *tcon, -const struct nls_table *nlsc); extern int cifs_connect_session_locked(const unsigned int xid, struct cifs_ses *ses, struct nls_table *nls_info,
fs/cifs/connect.c +6 -6
@@ -5291,9 +5291,9 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, }#ifdef CONFIG_CIFS_DFS_UPCALL -int cifs_tree_connect (const unsigned int xid, -struct cifs_tcon *tcon, -const struct nls_table *nlsc) +static int cifs_tree_connect (const unsigned int xid, +struct cifs_tcon *tcon, +const struct nls_table *nlsc) {const struct smb_version_operations *ops = tcon->ses->server->ops;int rc;
@@ -5365,9 +5365,9 @@ int cifs_tree_connect(const unsigned int xid, return rc; }#else -int cifs_tree_connect (const unsigned int xid, -struct cifs_tcon *tcon, -const struct nls_table *nlsc) +static int cifs_tree_connect (const unsigned int xid, +struct cifs_tcon *tcon, +const struct nls_table *nlsc) {const struct smb_version_operations *ops = tcon->ses->server->ops;return ops->tree_connect (xid, tcon->ses, tcon->treeName, tcon, nlsc);
Signature · 1 line
2.17.1
PATCH 9/13 cifs: turn smb2_reconnect_server() into a generic cifs_reconnect_server()
In reply to Stefan Metzmacher--- fs/cifs/connect.c | 2 +- fs/cifs/smb2pdu.c | 12 ++++++------ fs/cifs/smb2pdu.h | 2 -- fs/cifs/smb2proto.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-)
fs/cifs/connect.c +1 -1
@@ -2823,7 +2823,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)INIT_LIST_HEAD (&tcp_ses->tcp_ses_list);INIT_LIST_HEAD (&tcp_ses->smb_ses_list);INIT_DELAYED_WORK (&tcp_ses->echo, cifs_echo_request); -INIT_DELAYED_WORK (&tcp_ses->reconnect, smb2_reconnect_server); +INIT_DELAYED_WORK (&tcp_ses->reconnect, cifs_reconnect_tcons);mutex_init (&tcp_ses->reconnect_mutex);memcpy (&tcp_ses->srcaddr, &volume_info->srcaddr,sizeof (tcp_ses->srcaddr));
fs/cifs/smb2pdu.c +6 -6
@@ -159,7 +159,7 @@ static int smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) { struct cifs_tcon_reconnect_params params = { - .skip_reconnect = false, + .start_timer = true, };switch (smb2_command) {
@@ -197,9 +197,6 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)break ; } -if (smb2_command !=SMB2_INTERNAL_CMD ) - params.start_timer = true; -/* * Check if handle based operation so we know whether we can continue * or not without returning to caller to reset file handle.
@@ -3293,7 +3290,7 @@ smb2_echo_callback(struct mid_q_entry *mid)add_credits (server, &credits,CIFS_ECHO_OP ); } -void smb2_reconnect_server (struct work_struct *work) +void cifs_reconnect_tcons (struct work_struct *work) {struct TCP_Server_Info *server =container_of (work, struct TCP_Server_Info, reconnect.work);
@@ -3340,7 +3337,10 @@ void smb2_reconnect_server(struct work_struct *work)spin_unlock (&cifs_tcp_ses_lock);list_for_each_entry_safe (tcon, tcon2, &tmp_list, rlist) { - rc =smb2_reconnect (SMB2_INTERNAL_CMD , tcon); +struct cifs_tcon_reconnect_params params = { + .start_timer = false, + }; + rc =cifs_tcon_reconnect (tcon, ¶ms);if (!rc)cifs_reopen_persistent_handles (tcon);else
fs/cifs/smb2pdu.h +0 -2
@@ -81,8 +81,6 @@#define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE)#define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE) -#define SMB2_INTERNAL_CMD cpu_to_le16(0xFFFF) -#define NUMBER_OF_SMB2_COMMANDS 0x0013/* 52 transform hdr + 64 hdr + 88 create rsp */
fs/cifs/smb2proto.h +1 -1
@@ -116,7 +116,7 @@ extern int smb2_open_file(const unsigned int xid,extern int smb2_unlock_range (struct cifsFileInfo *cfile,struct file_lock *flock,const unsigned int xid);extern int smb2_push_mandatory_locks (struct cifsFileInfo *cfile); -extern void smb2_reconnect_server (struct work_struct *work); +extern void cifs_reconnect_tcons (struct work_struct *work);extern int smb3_crypto_aead_allocate (struct TCP_Server_Info *server);extern unsigned long smb_rqst_len (struct TCP_Server_Info *server,struct smb_rqst *rqst);
Signature · 1 line
2.17.1
PATCH 10/13 cifs: move cifs_reconnect_tcons() to fs/cifs/connect.c and make it static
In reply to Stefan Metzmacher--- fs/cifs/connect.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/smb2pdu.c | 72 --------------------------------------------- fs/cifs/smb2proto.h | 1 - 3 files changed, 72 insertions(+), 73 deletions(-)
fs/cifs/connect.c +72 -0
@@ -714,6 +714,78 @@ cifs_echo_request(struct work_struct *work)queue_delayed_work (cifsiod_wq, &server->echo, server->echo_interval); } +static void cifs_reconnect_tcons (struct work_struct *work) +{ +struct TCP_Server_Info *server =container_of (work, + struct TCP_Server_Info, reconnect.work); +struct cifs_ses *ses; +struct cifs_tcon *tcon, *tcon2; +struct list_head tmp_list; +int tcon_exist = false; +int rc; +int resched = false; + + +/* Prevent simultaneous reconnects that can corrupt tcon->rlist list */ +mutex_lock (&server->reconnect_mutex); + +INIT_LIST_HEAD (&tmp_list); +cifs_dbg (FYI ,"Need negotiate, reconnecting tcons\n" ); + +spin_lock (&cifs_tcp_ses_lock); +list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { +list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +if (tcon->need_reconnect || tcon->need_reopen_files) { + tcon->tc_count++; +list_add_tail (&tcon->rlist, &tmp_list); + tcon_exist = true; + } + } +/* +* IPC has the same lifetime as its session and uses its +* refcount. +*/ +if (ses->tcon_ipc && ses->tcon_ipc->need_reconnect) { +list_add_tail (&ses->tcon_ipc->rlist, &tmp_list); + tcon_exist = true; + ses->ses_count++; + } + } +/* +* Get the reference to server struct to be sure that the last call of +* cifs_put_tcon() in the loop below won't release the server pointer. +*/ +if (tcon_exist) + server->srv_count++; + +spin_unlock (&cifs_tcp_ses_lock); + +list_for_each_entry_safe (tcon, tcon2, &tmp_list, rlist) { +struct cifs_tcon_reconnect_params params = { + .start_timer = false, + }; + rc =cifs_tcon_reconnect (tcon, ¶ms); +if (!rc) +cifs_reopen_persistent_handles (tcon); +else + resched = true; +list_del_init (&tcon->rlist); +if (tcon->ipc) +cifs_put_smb_ses (tcon->ses); +else +cifs_put_tcon (tcon); + } + +cifs_dbg (FYI ,"Reconnecting tcons finished\n" ); +if (resched) +queue_delayed_work (cifsiod_wq, &server->reconnect,2 *HZ ); +mutex_unlock (&server->reconnect_mutex); + +/* now we can safely release srv struct */ +if (tcon_exist) +cifs_put_tcp_session (server,1 ); +} +static bool allocate_buffers (struct TCP_Server_Info *server) {
fs/cifs/smb2pdu.c +0 -72
78 lines not on this page · raw message
fs/cifs/smb2proto.h +0 -1
@@ -116,7 +116,6 @@ extern int smb2_open_file(const unsigned int xid,extern int smb2_unlock_range (struct cifsFileInfo *cfile,struct file_lock *flock,const unsigned int xid);extern int smb2_push_mandatory_locks (struct cifsFileInfo *cfile); -extern void cifs_reconnect_tcons (struct work_struct *work);extern int smb3_crypto_aead_allocate (struct TCP_Server_Info *server);extern unsigned long smb_rqst_len (struct TCP_Server_Info *server,struct smb_rqst *rqst);
Signature · 1 line
2.17.1
PATCH 11/13 cifs: use reconnect timer also for SMB1
In reply to Stefan Metzmacher--- fs/cifs/cifssmb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/cifs/cifssmb.c +7 -1
@@ -129,7 +129,7 @@ static int cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command) {struct cifs_tcon_reconnect_params params = { - .skip_reconnect = false, + .start_timer = true, };/*
@@ -662,6 +662,12 @@ CIFSSMBEcho(struct TCP_Server_Info *server)cifs_dbg (FYI ,"In echo request\n" ); +if (server->tcpStatus == CifsNeedNegotiate) { +/* No need to send echo on newly established connections */ +mod_delayed_work (cifsiod_wq, &server->reconnect,0 ); +return rc; + } + rc =small_smb_init (SMB_COM_ECHO ,0 ,NULL , (void **)&smb);if (rc)return rc;
Signature · 1 line
2.17.1
PATCH 12/13 cifs: map STATUS_ACCOUNT_LOCKED_OUT to -EACCES
In reply to Stefan MetzmacherThis is basically the same as STATUS_LOGON_FAILURE, but after the account is locked out.
--- fs/cifs/smb2maperror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2maperror.c +1 -1
@@ -814,7 +814,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { {STATUS_INVALID_VARIANT, -EIO, "STATUS_INVALID_VARIANT"}, {STATUS_DOMAIN_CONTROLLER_NOT_FOUND, -EIO, "STATUS_DOMAIN_CONTROLLER_NOT_FOUND"}, - {STATUS_ACCOUNT_LOCKED_OUT, -EIO, "STATUS_ACCOUNT_LOCKED_OUT"}, + {STATUS_ACCOUNT_LOCKED_OUT, -EACCES, "STATUS_ACCOUNT_LOCKED_OUT"}, {STATUS_HANDLE_NOT_CLOSABLE, -EIO, "STATUS_HANDLE_NOT_CLOSABLE"}, {STATUS_CONNECTION_REFUSED, -EIO, "STATUS_CONNECTION_REFUSED"}, {STATUS_GRACEFUL_DISCONNECT, -EIO, "STATUS_GRACEFUL_DISCONNECT"},
Signature · 1 line
2.17.1
PATCH 13/13 cifs: introduce the CifsInvalidCredentials session state
In reply to Stefan MetzmacherRHBZ: 1579050
If a session setup gets NT_STATUS_LOGON_FAILURE of NT_STATUS_ACCOUNT_LOCKED_OUT, we're not able to make any further progress with the credentials the kernel knowns about.
Instead of retrying for each new request, we should mark
the session with CifsInvalidCredentials (for know we only do that for soft mounts). We consistently return -EKEYREVOKED for such sessions, I guess that's better than -EHOSTDOWN.
A future addition would be an upcall to get new credentials from userspace, or a way to use a magic file per session under /proc/fs/cifs/ to provide new credentials.
But for now we want to avoid that we lock out the users account, by retrying every 2 seconds.
Note backports also need the other 12 patches before.
--- fs/cifs/cifs_debug.c | 2 + fs/cifs/cifsfs.c | 1 + fs/cifs/cifsglob.h | 4 +- fs/cifs/connect.c | 145 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 148 insertions(+), 4 deletions(-)
fs/cifs/cifs_debug.c +2 -0
@@ -392,6 +392,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)/* dump session id helpful for use with network trace */ seq_printf (m," SessionId: 0x%llx" , ses->Suid); +if (ses->status == CifsInvalidCredentials) +seq_printf (m," InvalidCredentials!" );if (ses->session_flags &SMB2_SESSION_FLAG_ENCRYPT_DATA )seq_puts (m," encrypted" );if (ses->sign)
fs/cifs/cifsfs.c +1 -0
@@ -650,6 +650,7 @@ static void cifs_umount_begin(struct super_block *sb)/* cancel_notify_requests(tcon); */ if (tcon->ses && tcon->ses->server) {cifs_dbg (FYI ,"wake up tasks now - umount begin not complete\n" ); +wake_up_all (&tcon->ses->server->demultiplex_q);wake_up_all (&tcon->ses->server->request_q);wake_up_all (&tcon->ses->server->response_q);msleep (1 );/* yield */
fs/cifs/cifsglob.h +3 -1
@@ -114,7 +114,8 @@ enum statusEnum { CifsGood, CifsExiting, CifsNeedReconnect, - CifsNeedNegotiate + CifsNeedNegotiate, + CifsInvalidCredentials, }; enum securityEnum {
@@ -687,6 +688,7 @@ struct TCP_Server_Info {#endif wait_queue_head_t response_q;wait_queue_head_t request_q;/* if more than maxmpx to srvr must block*/ +wait_queue_head_t demultiplex_q;struct list_head pending_mid_q;bool noblocksnd;/* use blocking sendmsg */ bool noautotune;/* do not autotune send buf sizes */
fs/cifs/connect.c +142 -3
223 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v1 13/13] cifs: introduce the CifsInvalidCredentials session state
Quoted 3 lines · Stefan Metzmacher
A future addition would be an upcall to get new credentials from userspace, or a way to use a magic file per session under
/proc/fs/cifs/to provide new credentials.
I've looked into this recently. cifscreds from cifs-utils can already store/update credentials in keyrings.
I believe this is only used in multiuser mode (-o multiuser). In that mode, when a process does a syscall, cifs.ko will try to use a cifs_ses matching the uid of that process, potentially opening a new one.
To open a new session for that user, cifs.ko looks at the current process session keyring for that uid credentials. Take a look at cifs_set_cifscreds(), it's the function that sets the credentials in the volume about to be connected to.
* the key is of type "logon",
* description is "cifs:<mode>:<host>" where mode determines what host is ('a' for an ip address, 'd' for a domain).
* value is "<user>:<password>"
[ side-note on that keyring: it is the process session keyring. So you need to make sure the keyring is created when the user first logs in the system (i.e. via pam), otherwise cifscreds will create it, and since it is the only user, will destroy it when cifscreds exits (refcount reaches zero). I don't know why it was decided to use the session keyring, I feel like we should make this keyring "global" instead of per session, it would be easier to setup and update but I don't know the security implications. (If anyone knows please share) ]
In any case, I think we should try to update cifs_ses->{user_name,password} before re-opening a session by looking at this keyring.
Cheers,
Signature · 4 lines
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)
Quoted 2 lines · Stefan Metzmacher
The first patches consolidate the retry/reconnect handling between SMB1 and SMB2/3.
This code is very tricky, we had to tweak it multiple times to deal with races, deadlocks and DFS (with DFS we have to failover to a different server and have to update TCP_Server_Info fields) and we can't test/repro those easily so we need to be very careful. I will start looking but it will take some time. In any case amazing work in unifying these things, reconnect code path is horribly complex.
Also, you should try to run checkpatch.pl (from the kernel repo) and sparse (kernel static analysis). You need a recent version of sparse to work on the kernel (get&build the git repo somewhere).
I like to use something this when working on a series:
git rebase -x 'bash -c "./scripts/checkpatch.pl <(git format-patch -1 --stdout)" && touch fs/cifs/*.[ch] && make CHECK=path_to_your_sparse_bin C=1' HEAD~13
(on one line)
Cheers,
Signature · 4 lines
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)