Skip to content

Commit 52492ff

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: call helper functions for marking channels for reconnect
cifs_mark_tcp_ses_conns_for_reconnect helper function is now meant to be used by any of the threads to mark a channel (or all the channels) for reconnect. Replace all such manual changes to tcpStatus to use this helper function, which takes care that the right channels, smb sessions and tcons are marked for reconnect. Also includes one line minor change Reported-by: kernel test robot <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent a81da65 commit 52492ff

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

fs/cifs/cifs_swn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ static int cifs_swn_resource_state_changed(struct cifs_swn_reg *swnreg, const ch
396396
switch (state) {
397397
case CIFS_SWN_RESOURCE_STATE_UNAVAILABLE:
398398
cifs_dbg(FYI, "%s: resource name '%s' become unavailable\n", __func__, name);
399-
cifs_reconnect(swnreg->tcon->ses->server, true);
399+
cifs_mark_tcp_ses_conns_for_reconnect(swnreg->tcon->ses->server, true);
400400
break;
401401
case CIFS_SWN_RESOURCE_STATE_AVAILABLE:
402402
cifs_dbg(FYI, "%s: resource name '%s' become available\n", __func__, name);
403-
cifs_reconnect(swnreg->tcon->ses->server, true);
403+
cifs_mark_tcp_ses_conns_for_reconnect(swnreg->tcon->ses->server, true);
404404
break;
405405
case CIFS_SWN_RESOURCE_STATE_UNKNOWN:
406406
cifs_dbg(FYI, "%s: resource name '%s' changed to unknown state\n", __func__, name);
@@ -498,7 +498,7 @@ static int cifs_swn_reconnect(struct cifs_tcon *tcon, struct sockaddr_storage *a
498498
goto unlock;
499499
}
500500

501-
cifs_reconnect(tcon->ses->server, false);
501+
cifs_mark_tcp_ses_conns_for_reconnect(tcon->ses->server, false);
502502

503503
unlock:
504504
mutex_unlock(&tcon->ses->server->srv_mutex);

fs/cifs/dfs_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ static void mark_for_reconnect_if_needed(struct cifs_tcon *tcon, struct dfs_cach
13551355
}
13561356

13571357
cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__);
1358-
cifs_reconnect(tcon->ses->server, true);
1358+
cifs_mark_tcp_ses_conns_for_reconnect(tcon->ses->server, true);
13591359
}
13601360

13611361
/* Refresh dfs referral of tcon and mark it for reconnect if needed */

fs/cifs/smb1ops.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)
228228
spin_unlock(&GlobalMid_Lock);
229229

230230
if (reconnect) {
231-
spin_lock(&cifs_tcp_ses_lock);
232-
server->tcpStatus = CifsNeedReconnect;
233-
spin_unlock(&cifs_tcp_ses_lock);
231+
cifs_mark_tcp_ses_conns_for_reconnect(server, false);
234232
}
235233

236234
return mid;

fs/cifs/transport.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
430430
* be taken as the remainder of this one. We need to kill the
431431
* socket so the server throws away the partial SMB
432432
*/
433-
spin_lock(&cifs_tcp_ses_lock);
434-
if (server->tcpStatus != CifsExiting)
435-
server->tcpStatus = CifsNeedReconnect;
436-
spin_unlock(&cifs_tcp_ses_lock);
433+
cifs_mark_tcp_ses_conns_for_reconnect(server, false);
437434
trace_smb3_partial_send_reconnect(server->CurrentMid,
438435
server->conn_id, server->hostname);
439436
}

0 commit comments

Comments
 (0)