Skip to content

Commit

Permalink
cifs: mark sessions for reconnection in helper function
Browse files Browse the repository at this point in the history
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 <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Shyam Prasad N authored and Steve French committed Feb 9, 2022
1 parent 52492ff commit 2a05137
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
struct TCP_Server_Info *pserver;
struct cifs_ses *ses;
struct cifs_tcon *tcon;
struct mid_q_entry *mid, *nmid;
struct list_head retry_list;

server->maxBuf = 0;
server->max_read = 0;

/*
* before reconnecting the tcp session, mark the smb session (uid) and the tid bad so they
Expand Down Expand Up @@ -219,6 +214,16 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
spin_unlock(&ses->chan_lock);
}
spin_unlock(&cifs_tcp_ses_lock);
}

static void
cifs_abort_connection(struct TCP_Server_Info *server)
{
struct mid_q_entry *mid, *nmid;
struct list_head retry_list;

server->maxBuf = 0;
server->max_read = 0;

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

cifs_mark_tcp_ses_conns_for_reconnect(server, mark_smb_session);

cifs_abort_connection(server);

do {
try_to_freeze();
mutex_lock(&server->srv_mutex);
Expand Down Expand Up @@ -434,6 +441,8 @@ reconnect_dfs_server(struct TCP_Server_Info *server,

cifs_mark_tcp_ses_conns_for_reconnect(server, mark_smb_session);

cifs_abort_connection(server);

do {
try_to_freeze();
mutex_lock(&server->srv_mutex);
Expand Down

0 comments on commit 2a05137

Please sign in to comment.