Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: Henrique Carvalho <henrique.carvalho@suse.com>, sfrench@samba.org
Cc: ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, ematsumiya@suse.de,
	linux-cifs@vger.kernel.org
Subject: Re: [PATCH] smb: client: fix cifs_pick_channel when channels are equally loaded
Date: Fri, 20 Feb 2026 13:21:03 -0300	[thread overview]
Message-ID: <180ef3d4933495c273eea31e09243130@manguebit.org> (raw)
In-Reply-To: <20260120201822.2218308-1-henrique.carvalho@suse.com>

Henrique Carvalho <henrique.carvalho@suse.com> writes:

> cifs_pick_channel uses (start % chan_count) when channels are equally
> loaded, but that can return a channel that failed the eligibility
> checks.
>
> Drop the fallback and return the scan-selected channel instead. If none
> is eligible, keep the existing behavior of using the primary channel.
>
> Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
> ---
>  fs/smb/client/transport.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
> index 75697f6d2566..26987f261850 100644
> --- a/fs/smb/client/transport.c
> +++ b/fs/smb/client/transport.c
> @@ -807,11 +807,16 @@ cifs_cancelled_callback(struct TCP_Server_Info *server, struct mid_q_entry *mid)
>  }
>  
>  /*
> - * Return a channel (master if none) of @ses that can be used to send
> - * regular requests.
> + * cifs_pick_channel - pick an eligible channel for network operations
>   *
> - * If we are currently binding a new channel (negprot/sess.setup),
> - * return the new incomplete channel.
> + * @ses: session reference
> + *
> + * Select an eligible channel (not terminating and not marked as needing
> + * reconnect), preferring the least loaded one. If no eligible channel is
> + * found, fall back to the primary channel (index 0).
> + *
> + * Return: TCP_Server_Info pointer for the chosen channel, or NULL if @ses is
> + * NULL.
>   */
>  struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
>  {
> @@ -850,10 +855,6 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
>  			max_in_flight = server->in_flight;
>  	}
>  
> -	/* if all channels are equally loaded, fall back to round-robin */
> -	if (min_in_flight == max_in_flight)
> -		index = (uint)start % ses->chan_count;
> -

After removing the check, @max_in_flight is no longer neeeded.

Otherwise, looks good.

  parent reply	other threads:[~2026-02-20 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 20:18 [PATCH] smb: client: fix cifs_pick_channel when channels are equally loaded Henrique Carvalho
2026-01-28 12:05 ` Shyam Prasad N
2026-02-19 16:07   ` Steve French
2026-02-20 16:21 ` Paulo Alcantara [this message]
2026-02-20 17:11   ` Henrique Carvalho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=180ef3d4933495c273eea31e09243130@manguebit.org \
    --to=pc@manguebit.org \
    --cc=bharathsm@microsoft.com \
    --cc=ematsumiya@suse.de \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox