Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Bharath SM <bharathsm.hsk@gmail.com>
To: nspmangalore@gmail.com
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.org,
	 bharathsm@microsoft.com, dhowells@redhat.com,
	henrique.carvalho@suse.com,  ematsumiya@suse.de,
	Shyam Prasad N <sprasad@microsoft.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/7] cifs: change_conf needs to be called for session setup
Date: Tue, 21 Apr 2026 06:58:53 -0700	[thread overview]
Message-ID: <CAGypqWxMLSdPhpGcomCeokiRXFR5kb+CQGNON7bsUiOPfswLKg@mail.gmail.com> (raw)
In-Reply-To: <20260421063955.99164-1-sprasad@microsoft.com>

On Mon, Apr 20, 2026 at 11:40 PM <nspmangalore@gmail.com> wrote:
>
> From: Shyam Prasad N <sprasad@microsoft.com>
>
> Today we skip calling change_conf for negotiates and session setup
> requests. This can be a problem for mchan as the immediate next call
> after session setup could be due to an I/O that is made on the
> mount point. For single channel, this is not a problem as
> there will be several calls after setting up session.
>
> This change enforces calling change_conf for the last session setup
> response, so that echoes and oplocks are not disabled before the
> first request to the server. So if that first request is an open,
> it does not need to disable requesting leases.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> ---
>  fs/smb/client/smb2ops.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 509fcea28a429..3625030d1912f 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -111,10 +111,19 @@ smb2_add_credits(struct TCP_Server_Info *server,
>                                       cifs_trace_rw_credits_zero_in_flight);
>         }
>         server->in_flight--;
> +
> +       /*
> +        * Rebalance credits when an op drains in_flight. For session setup,
> +        * do this only when the server actually granted positive credits (>2) so a
> +        * newly established secondary channel can reserve echo/oplock credits.
> +        */
>         if (server->in_flight == 0 &&
>            ((optype & CIFS_OP_MASK) != CIFS_NEG_OP) &&
>            ((optype & CIFS_OP_MASK) != CIFS_SESS_OP))
>                 rc = change_conf(server);
> +       else if (server->in_flight == 0 &&
> +                ((optype & CIFS_OP_MASK) == CIFS_SESS_OP) && add > 2)
> +               rc = change_conf(server);
>         /*
>          * Sometimes server returns 0 credits on oplock break ack - we need to
>          * rebalance credits in this case.
> --
I think it would be good to add a comment explaining why the ' add >
2' threshold is chosen
here and the assumption that the final session setup response SMB
server returns '>2' credits.

Otherwise, Changes look good to me.

  parent reply	other threads:[~2026-04-21 13:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  6:39 [PATCH v2 1/7] cifs: change_conf needs to be called for session setup nspmangalore
2026-04-21  6:39 ` [PATCH v2 2/7] cifs: abort open_cached_dir if we don't request leases nspmangalore
2026-04-21 15:26   ` Bharath SM
2026-04-24  4:06     ` Shyam Prasad N
2026-04-21  6:39 ` [PATCH v2 3/7] cifs: invalidate cfid on unlink/rename/rmdir nspmangalore
2026-04-21  6:39 ` [PATCH v2 4/7] cifs: define variable sized buffer for querydir responses nspmangalore
2026-04-21  6:39 ` [PATCH v2 5/7] cifs: optimize readdir for small directories nspmangalore
2026-04-21  6:39 ` [PATCH v2 6/7] cifs: optimize readdir for larger directories nspmangalore
2026-04-21  6:39 ` [PATCH v2 7/7] cifs: reorganize cached dir helpers nspmangalore
2026-04-21 13:58 ` Bharath SM [this message]
2026-04-24  4:07   ` [PATCH v2 1/7] cifs: change_conf needs to be called for session setup Shyam Prasad N

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=CAGypqWxMLSdPhpGcomCeokiRXFR5kb+CQGNON7bsUiOPfswLKg@mail.gmail.com \
    --to=bharathsm.hsk@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=dhowells@redhat.com \
    --cc=ematsumiya@suse.de \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=pc@manguebit.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).