summaryrefslogtreecommitdiffstats
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2022-04-08 13:31:37 +0000
committerSteve French <stfrench@microsoft.com>2022-05-24 14:16:32 -0500
commit5752bf645f9dd7db600651f726eb04a97c9f597f (patch)
treef486c71eb05d7e37800e182d49325838ac0c2af3 /fs/cifs/sess.c
parentdd3cd8709ed5f4ae8998e0cd44c05bd26bc879e8 (diff)
downloadlinux-stable-5752bf645f9dd7db600651f726eb04a97c9f597f.tar.gz
linux-stable-5752bf645f9dd7db600651f726eb04a97c9f597f.tar.bz2
linux-stable-5752bf645f9dd7db600651f726eb04a97c9f597f.zip
cifs: avoid parallel session setups on same channel
After allowing channels to reconnect in parallel, it now becomes important to take care that multiple processes do not call negotiate/session setup in parallel on the same channel. This change avoids that by marking a channel as "in_reconnect". During session setup if the channel in question has this flag set, we return immediately. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 32f478c7a66d..7c453f8701eb 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -86,6 +86,33 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
}
void
+cifs_chan_set_in_reconnect(struct cifs_ses *ses,
+ struct TCP_Server_Info *server)
+{
+ unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
+
+ ses->chans[chan_index].in_reconnect = true;
+}
+
+void
+cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
+ struct TCP_Server_Info *server)
+{
+ unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
+
+ ses->chans[chan_index].in_reconnect = false;
+}
+
+bool
+cifs_chan_in_reconnect(struct cifs_ses *ses,
+ struct TCP_Server_Info *server)
+{
+ unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
+
+ return CIFS_CHAN_IN_RECONNECT(ses, chan_index);
+}
+
+void
cifs_chan_set_need_reconnect(struct cifs_ses *ses,
struct TCP_Server_Info *server)
{