Skip to content

Commit 9d5eff7

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: reset iface weights when we cannot find a candidate
We now do a weighted selection of server interfaces when allocating new channels. The weights are decided based on the speed advertised. The fulfilled weight for an interface is a counter that is used to track the interface selection. It should be reset back to zero once all interfaces fulfilling their weight. In cifs_chan_update_iface, this reset logic was missing. As a result when the server interface list changes, the client may not be able to find a new candidate for other channels after all interfaces have been fulfilled. Fixes: a6d8fb5 ("cifs: distribute channels across interfaces based on speed") Cc: <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 59b33fa commit 9d5eff7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/smb/client/sess.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
332332
struct cifs_server_iface *old_iface = NULL;
333333
struct cifs_server_iface *last_iface = NULL;
334334
struct sockaddr_storage ss;
335+
int retry = 0;
335336

336337
spin_lock(&ses->chan_lock);
337338
chan_index = cifs_ses_get_chan_index(ses, server);
@@ -360,6 +361,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
360361
return;
361362
}
362363

364+
try_again:
363365
last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface,
364366
iface_head);
365367
iface_min_speed = last_iface->speed;
@@ -397,6 +399,13 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
397399
}
398400

399401
if (list_entry_is_head(iface, &ses->iface_list, iface_head)) {
402+
list_for_each_entry(iface, &ses->iface_list, iface_head)
403+
iface->weight_fulfilled = 0;
404+
405+
/* see if it can be satisfied in second attempt */
406+
if (!retry++)
407+
goto try_again;
408+
400409
iface = NULL;
401410
cifs_dbg(FYI, "unable to find a suitable iface\n");
402411
}

0 commit comments

Comments
 (0)