From: Trond Myklebust <trondmy@kernel.org>
To: Cheng Yongkang <teel4res@gmail.com>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] NFS: keep in-flight slots when shrinking the session slot table
Date: Sat, 28 Nov 2026 19:56:35 -0500 [thread overview]
Message-ID: <1ea6f3606dc3c3caaed3e013a1a51a4b2c78d909.camel@kernel.org> (raw)
In-Reply-To: <20261026105215.1149970-1-teel4res@gmail.com>
On Mon, 2026-10-26 at 03:52 -0700, Cheng Yongkang wrote:
> nfs4_reset_slot_table() shrinks the forechannel slot table to the new
> session's max_reqs without checking whether any of the slots being
> freed are still in use. The session drain it follows only snapshots
> highest_used_slotid once, while nfs4_setup_sequence() and
> nfs41_assign_slot() deliberately let privileged RPCs (sa_privileged,
> e.g. the DELEGRETURN sent while an inode is being evicted) allocate a
> slot after that snapshot. If such an RPC owns a slot with
> slot_nr >= max_reqs, nfs4_shrink_slot_table() kfree()s it and the
> reply path (decode_sequence(), nfs41_release_slot(),
> nfs4_free_slot())
> later dereferences the freed slot: a slab-use-after-free.
>
> Clamp the shrink target to highest_used_slotid + 1 when the table is
> not empty, so only slots above the highest used slot are freed, and
> stop resetting highest_used_slotid: the high-water mark is still
> needed
> to release those slots and to complete a later drain. max_slotid is
> still set to the server's new highest slotid, so new RPCs cannot use
> the preserved slots above the new max_reqs. A server advertising
> max_reqs == 0 arrives with server_highest_slotid == NFS4_NO_SLOT;
> make
> that wrap explicit.
>
NACK. nfs4_reset_slot_table() is never called on a session table that
is in use. It is called as part of the create_session workflow, and as
part of the NFSv4.0 client initialisation.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trondmy@kernel.org, trond.myklebust@hammerspace.com
prev parent reply other threads:[~2026-11-29 0:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 10:52 Cheng Yongkang
2026-11-29 0:56 ` Trond Myklebust [this message]
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=1ea6f3606dc3c3caaed3e013a1a51a4b2c78d909.camel@kernel.org \
--to=trondmy@kernel.org \
--cc=anna@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=teel4res@gmail.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
all inboxes | Powered by JetHome®