Linux NFS development
 help / color / mirror / Atom feed
From: "Anna Schumaker" <anna@kernel.org>
To: "Benjamin Coddington" <ben.coddington@hammerspace.com>,
	"Trond Myklebust" <trondmy@kernel.org>
Cc: linux-nfs@vger.kernel.org,
	"Jonathan Curley" <jcurley@purestorage.com>,
	"Mike Snitzer" <snitzer@kernel.org>,
	"Jeff Layton" <jlayton@kernel.org>
Subject: Re: [PATCH v2 14/23] NFSv4/flexfiles: Honor ndc_immediate on CB_NOTIFY_DEVICEID CHANGE
Date: Fri, 28 Aug 2026 13:41:48 -0400	[thread overview]
Message-ID: <fdf3cf24-a0b2-4350-961b-028847c47bc9@app.fastmail.com> (raw)
In-Reply-To: <da98de51fe276a11faef6b42d469ed73dd4ff53f.1787327939.git.bcodding@hammerspace.com>



On Fri, Aug 21, 2026, at 12:29 PM, Benjamin Coddington wrote:
> When a CHANGE notification carries ndc_immediate, RFC 8881 Section
> 20.12 says the change is enforced immediately and the client might not
> be able to complete pending I/O.  In addition to un-pinning the stripe's
> device node, mark the old node unavailable.
>
> Marking does not recall the references already handed out.  A write
> whose DS connection is already up keeps using the old node until that
> I/O errors: nfs4_ff_layout_prepare_ds() returns early on a live
> ds_clp, and the unavailable flag is only consulted when a connection
> is being established.  What the mark does change is that a read skips
> the node while another mirror is usable, and that an IOMODE_RW segment
> still pinning it stops counting as fully available -- so I/O the
> server rejects falls back to the MDS rather than being retried against
> a mapping the server has already withdrawn.
>
> The walk can also exchange out a node that already carries the new
> mapping: a re-resolve that completed between the unhash and the walk
> reaching the stripe, raced by this walk or by the walk of a later
> CHANGE for the same deviceid.  Ripping such a node out is harmless (it
> is still hashed, so the next I/O re-pins it from the cache), but it
> must not be marked unavailable.  Stale vintages are distinguishable by
> hashed-ness: every superseded node was unhashed before its walk began
> and is never re-inserted, while a fresh node is inserted before it is
> installed.  Only mark nodes that are no longer hashed.
>
> That test is hlist_unhashed_lockless(): the hook runs under the layout
> inode's i_lock and rcu_read_lock(), but not under nfs4_deviceid_lock,
> which is what serializes the writers of node.pprev -- and __hlist_del()
> stores a neighbour's pprev with WRITE_ONCE(), so removing any other
> entry in the same bucket can write the field this test reads.
>
> Without ndc_immediate, pending I/O drains on the old mapping and only
> new I/O re-resolves, as before.
>
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
> ---
>  fs/nfs/flexfilelayout/flexfilelayout.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c 
> b/fs/nfs/flexfilelayout/flexfilelayout.c
> index 46ca58e8e96b..ebb19a919f9d 100644
> --- a/fs/nfs/flexfilelayout/flexfilelayout.c
> +++ b/fs/nfs/flexfilelayout/flexfilelayout.c
> @@ -2541,6 +2541,14 @@ static void ff_layout_reresolve_deviceid(struct 
> pnfs_layout_hdr *lo,
>  				kfree(put);
>  				continue;
>  			}
> +			/* Only mark stale vintages: a node still hashed was

I don't think I've seen "vintage" used when talking about anything other than
wine before.

> +			 * fetched after the unhash and carries the new
> +			 * mapping.  Lockless -- nfs4_deviceid_lock, which
> +			 * serialises pprev, is not held here.
> +			 */

Nit: this comment is pretty wordy. Do we really need to define what "lockless"
means here?

Anna

> +			if (immediate &&
> +			    hlist_unhashed_lockless(&old->id_node.node))
> +				nfs4_mark_deviceid_unavailable(&old->id_node);
>  			put->dev = &old->id_node;
>  			list_add(&put->node, head);
>  		}
> -- 
> 2.53.0

  reply	other threads:[~2026-08-28 17:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 16:29 [PATCH v2 00/23] NFS: flexfiles device notifications and caching for wide striped layouts Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 01/23] NFSv4/flexfiles: reject a stripe_unit that does not fit 32 bits Benjamin Coddington
2026-08-27 19:25   ` Anna Schumaker
2026-08-28 11:24     ` Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 02/23] NFSv4/pnfs: bound the CB_NOTIFY_DEVICEID array count before allocating Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 03/23] pNFS: Fix CB_NOTIFY_DEVICEID CHANGE to consume ndc_immediate Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 04/23] NFSv4/flexfiles: Use the full 64-bit offset for read DS selection Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 05/23] NFSv4/flexfiles: Bound page coalescing on the absolute stripe offset Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 06/23] NFSv4/filelayout: Anchor page coalescing on pattern_offset Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 07/23] NFSv4/flexfiles: Reference the device node across DS setup Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 08/23] NFSv4/flexfiles: Carry the device node reference across each I/O Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 09/23] NFSv4/flexfiles: Hold a device node reference for layoutstats encoding Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 10/23] NFSv4/flexfiles: Make the pinned device node pointer RCU-managed Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 11/23] pNFS: Add a reresolve_deviceid layout driver hook Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 12/23] NFSv4/flexfiles: Implement in-place device re-resolve on CHANGE Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 13/23] NFSv4: Dispatch CB_NOTIFY_DEVICEID CHANGE to an in-place refresh Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 14/23] NFSv4/flexfiles: Honor ndc_immediate on CB_NOTIFY_DEVICEID CHANGE Benjamin Coddington
2026-08-28 17:41   ` Anna Schumaker [this message]
2026-08-28 20:50     ` Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 15/23] pNFS: Discard a GETDEVICEINFO reply that raced a CHANGE notification Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 16/23] pNFS: Add deviceid reference query and collection walkers Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 17/23] NFSv4/pnfs: Recover revoked layouts on a deleted deviceID Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 18/23] NFSv4/pnfs: Confirm a deviceID delete via GETDEVICEINFO Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 19/23] NFSv4/pnfs: Dispatch CB_NOTIFY_DEVICEID DELETE to race recovery Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 20/23] NFSv4/pnfs: Grow the deviceid cache hash table Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 21/23] NFSv4/pnfs: Re-home the data-server cache onto hash buckets Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 22/23] NFSv4/pnfs: Key the data-server cache by its address set Benjamin Coddington
2026-08-21 16:29 ` [PATCH v2 23/23] NFSv4/flexfiles: Add a dataserver_nconnect cap Benjamin Coddington

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=fdf3cf24-a0b2-4350-961b-028847c47bc9@app.fastmail.com \
    --to=anna@kernel.org \
    --cc=ben.coddington@hammerspace.com \
    --cc=jcurley@purestorage.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=snitzer@kernel.org \
    --cc=trondmy@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