Skip to content

Commit c6e02ee

Browse files
sprasad-microsoftSteve French
authored andcommitted
cifs: change tcon status when need_reconnect is set on it
When a tcon is marked for need_reconnect, the intention is to have it reconnected. This change adjusts tcon->status in cifs_tree_connect when need_reconnect is set. Also, this change has a minor correction in resetting need_reconnect on success. It makes sure that it is done with tc_lock held. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 55c7788 commit c6e02ee

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

fs/smb/client/connect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4228,6 +4228,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
42284228

42294229
/* only send once per connect */
42304230
spin_lock(&tcon->tc_lock);
4231+
4232+
/* if tcon is marked for needing reconnect, update state */
4233+
if (tcon->need_reconnect)
4234+
tcon->status = TID_NEED_TCON;
4235+
42314236
if (tcon->status == TID_GOOD) {
42324237
spin_unlock(&tcon->tc_lock);
42334238
return 0;

fs/smb/client/dfs.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
565565

566566
/* only send once per connect */
567567
spin_lock(&tcon->tc_lock);
568+
569+
/* if tcon is marked for needing reconnect, update state */
570+
if (tcon->need_reconnect)
571+
tcon->status = TID_NEED_TCON;
572+
568573
if (tcon->status == TID_GOOD) {
569574
spin_unlock(&tcon->tc_lock);
570575
return 0;
@@ -625,8 +630,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
625630
spin_lock(&tcon->tc_lock);
626631
if (tcon->status == TID_IN_TCON)
627632
tcon->status = TID_GOOD;
628-
spin_unlock(&tcon->tc_lock);
629633
tcon->need_reconnect = false;
634+
spin_unlock(&tcon->tc_lock);
630635
}
631636

632637
return rc;

fs/smb/client/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)
175175

176176
/* only send once per connect */
177177
spin_lock(&tcon->tc_lock);
178+
if (tcon->need_reconnect)
179+
tcon->status = TID_NEED_RECON;
180+
178181
if (tcon->status != TID_NEED_RECON) {
179182
spin_unlock(&tcon->tc_lock);
180183
return;

0 commit comments

Comments
 (0)