Skip to content

Commit 7e0c066

Browse files
sprasad-microsoftgregkh
authored andcommitted
cifs: reset iface weights when we cannot find a candidate
commit 9d5eff7 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1b6310d commit 7e0c066

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
@@ -372,6 +372,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
372372
struct cifs_server_iface *old_iface = NULL;
373373
struct cifs_server_iface *last_iface = NULL;
374374
struct sockaddr_storage ss;
375+
int retry = 0;
375376

376377
spin_lock(&ses->chan_lock);
377378
chan_index = cifs_ses_get_chan_index(ses, server);
@@ -400,6 +401,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
400401
return;
401402
}
402403

404+
try_again:
403405
last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface,
404406
iface_head);
405407
iface_min_speed = last_iface->speed;
@@ -437,6 +439,13 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
437439
}
438440

439441
if (list_entry_is_head(iface, &ses->iface_list, iface_head)) {
442+
list_for_each_entry(iface, &ses->iface_list, iface_head)
443+
iface->weight_fulfilled = 0;
444+
445+
/* see if it can be satisfied in second attempt */
446+
if (!retry++)
447+
goto try_again;
448+
440449
iface = NULL;
441450
cifs_dbg(FYI, "unable to find a suitable iface\n");
442451
}

0 commit comments

Comments
 (0)