aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorPaulo Alcantara (SUSE) <pc@cjr.nz>2019-12-04 11:25:06 -0300
committerSteve French <stfrench@microsoft.com>2019-12-04 11:50:32 -0600
commit3345bb44bacd99413a3dc0dcd9a99449d88d4dda (patch)
tree9c83a5b417a5809c2dee737d21f7e84252a00279 /fs/cifs/connect.c
parentsmb3: query attributes on file close (diff)
downloadlinux-dev-3345bb44bacd99413a3dc0dcd9a99449d88d4dda.tar.xz
linux-dev-3345bb44bacd99413a3dc0dcd9a99449d88d4dda.zip
cifs: Fix lookup of SMB connections on multichannel
With the addition of SMB session channels, we introduced new TCP server pointers that have no sessions or tcons associated with them. In this case, when we started looking for TCP connections, we might end up picking session channel rather than the master connection, hence failing to get either a session or a tcon. In order to fix that, this patch introduces a new "is_channel" field to TCP_Server_Info structure so we can skip session channels during lookup of connections. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to '')
-rw-r--r--fs/cifs/connect.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 86d1baedf21c..05ea0e2b7e0e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2712,7 +2712,11 @@ cifs_find_tcp_session(struct smb_vol *vol)
spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
- if (!match_server(server, vol))
+ /*
+ * Skip ses channels since they're only handled in lower layers
+ * (e.g. cifs_send_recv).
+ */
+ if (server->is_channel || !match_server(server, vol))
continue;
++server->srv_count;