Skip to content

Commit 2a05137

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: mark sessions for reconnection in helper function
Today we have the code to mark connections and sessions (and tcons) for reconnect clubbed with the code to close the socket and abort all mids in the same function. Sometimes, we need to mark connections and sessions outside cifsd thread. So as a part of this change, I'm splitting this function into two different functions and calling them one after the other in cifs_reconnect. Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 52492ff commit 2a05137

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

fs/cifs/connect.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
175175
struct TCP_Server_Info *pserver;
176176
struct cifs_ses *ses;
177177
struct cifs_tcon *tcon;
178-
struct mid_q_entry *mid, *nmid;
179-
struct list_head retry_list;
180-
181-
server->maxBuf = 0;
182-
server->max_read = 0;
183178

184179
/*
185180
* before reconnecting the tcp session, mark the smb session (uid) and the tid bad so they
@@ -219,6 +214,16 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
219214
spin_unlock(&ses->chan_lock);
220215
}
221216
spin_unlock(&cifs_tcp_ses_lock);
217+
}
218+
219+
static void
220+
cifs_abort_connection(struct TCP_Server_Info *server)
221+
{
222+
struct mid_q_entry *mid, *nmid;
223+
struct list_head retry_list;
224+
225+
server->maxBuf = 0;
226+
server->max_read = 0;
222227

223228
/* do not want to be sending data on a socket we are freeing */
224229
cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
@@ -310,6 +315,8 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,
310315

311316
cifs_mark_tcp_ses_conns_for_reconnect(server, mark_smb_session);
312317

318+
cifs_abort_connection(server);
319+
313320
do {
314321
try_to_freeze();
315322
mutex_lock(&server->srv_mutex);
@@ -434,6 +441,8 @@ reconnect_dfs_server(struct TCP_Server_Info *server,
434441

435442
cifs_mark_tcp_ses_conns_for_reconnect(server, mark_smb_session);
436443

444+
cifs_abort_connection(server);
445+
437446
do {
438447
try_to_freeze();
439448
mutex_lock(&server->srv_mutex);

0 commit comments

Comments
 (0)