diff options
| author | Enzo Matsumiya <ematsumiya@suse.de> | 2025-05-21 16:25:53 +0200 |
|---|---|---|
| committer | Enzo Matsumiya <ematsumiya@suse.de> | 2025-05-22 14:02:48 +0200 |
| commit | 192a0f9ef43af2d520ed4ac016595992660d24e0 (patch) | |
| tree | c9cc854c84eecf159b8605d9dfc6ad269c89cbea /fs/smb/client/sess.c | |
| parent | a87cf769d6b0be1a0e733e33945f3d6ba468240b (diff) | |
| download | linux-multichannel-fixes-v2.tar.gz linux-multichannel-fixes-v2.tar.bz2 linux-multichannel-fixes-v2.zip | |
smb: client: set interface for primary channelmultichannel-fixes-v2
On multichannel mounts, 2 sockets are created for the primary channel,
as the interface it's connected to is received and parsed/added again.
So compare ifaces IP with primary channel server IP (server->dstaddr)
and assign the matching iface to ses->chans[0].iface.
Add a ->is_primary flag to cifs_server_iface to allow skipping session
setup on the primary channel, and for pretty-printing on cifs_debug.c
as well.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Diffstat (limited to 'fs/smb/client/sess.c')
| -rw-r--r-- | fs/smb/client/sess.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index af39c819822f..5c2725eee933 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -170,8 +170,6 @@ static int try_adding_channels(struct cifs_ses *ses, struct list_head *ifaces) spin_unlock(&pserver->iface_lock); list_for_each_entry_safe(iface, niface, ifaces, iface_head) { - rc = 0; - /* do not mix rdma and non-rdma interfaces */ if (iface->rdma_capable != ses->server->rdma) continue; @@ -185,7 +183,15 @@ static int try_adding_channels(struct cifs_ses *ses, struct list_head *ifaces) if (iface->weight_fulfilled >= weight) continue; - rc = cifs_ses_add_channel(ses, iface); + rc = 0; + if (!iface->is_primary) { + rc = cifs_ses_add_channel(ses, iface); + } else { + spin_lock(&ses->chan_lock); + ses->chans[0].iface = iface; + spin_unlock(&ses->chan_lock); + } + if (!rc) { cifs_info("successfully opened new channel on iface:%pIS\n", &iface->sockaddr); iface->is_active = 1; @@ -195,7 +201,7 @@ static int try_adding_channels(struct cifs_ses *ses, struct list_head *ifaces) spin_lock(&pserver->iface_lock); pserver->iface_count++; - list_move(&iface->iface_head, &pserver->iface_list); + list_move_tail(&iface->iface_head, &pserver->iface_list); pserver->iface_last_update = jiffies; spin_unlock(&pserver->iface_lock); |
