cifs: failure to add channel on iface should bump up weight
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 1 Feb 2024 11:15:29 +0000 (11:15 +0000)
committerSteve French <stfrench@microsoft.com>
Thu, 1 Feb 2024 18:13:05 +0000 (12:13 -0600)
commit6aac002bcfd554aff6d3ebb55e1660d078d70ab0
tree199e452c9f0a3da0d3bf2787d8bf726cc75443e6
parent88675b22d34e6e815ad4bde09c590ccb2d50c59d
cifs: failure to add channel on iface should bump up weight

After the interface selection policy change to do a weighted
round robin, each iface maintains a weight_fulfilled. When the
weight_fulfilled reaches the total weight for the iface, we know
that the weights can be reset and ifaces can be allocated from
scratch again.

During channel allocation failures on a particular channel,
weight_fulfilled is not incremented. If a few interfaces are
inactive, we could end up in a situation where the active
interfaces are all allocated for the total_weight, and inactive
ones are all that remain. This can cause a situation where
no more channels can be allocated further.

This change fixes it by increasing weight_fulfilled, even when
channel allocation failure happens. This could mean that if
there are temporary failures in channel allocation, the iface
weights may not strictly be adhered to. But that's still okay.

Fixes: a6d8fb54a515 ("cifs: distribute channels across interfaces based on speed")
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/sess.c