From: Benjamin Coddington <ben.coddington@hammerspace.com>
To: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Mike Snitzer <snitzer@kernel.org>
Cc: Olga Kornievskaia <okorniev@redhat.com>, linux-nfs@vger.kernel.org
Subject: [PATCH v4 0/4] pNFS/flexfiles: I/O without a layout under FF_FLAGS_NO_IO_THRU_MDS
Date: Thu, 3 Dec 2026 11:54:33 -0500 [thread overview]
Message-ID: <cover.1796315321.git.bcodding@hammerspace.com> (raw)
From: Benjamin Coddington <bcodding@hammerspace.com>
When a file's flexfiles layouts carry FF_FLAGS_NO_IO_THRU_MDS, the client
keeps reads and writes off the MDS when it has no layout segment for
them. Reads and writes handle that differently:
- Reads test the inode's NFS_INO_NO_IO_THRU_MDS bit, wait a second
between attempts, and honour io_maxretrans on soft mounts.
- Writes test a bit on the layout header and return -EAGAIN.
nfs_writepages() resends at once, so a writer spins for as long as
there is no layout. Once the header is freed the bit is gone and
writes go through the MDS, and ff_layout_pg_init_write() sends them
there whenever pnfs_generic_pg_check_layout() drops an invalidated
segment.
Neither direction uses the MDS when the server has said there is no
layout to give. After NFS4ERR_LAYOUTUNAVAILABLE, RFC 8435 says the I/O
is to go to the MDS (section 5.1.1). Today reads wait and writes spin
until the 120 second fail bit expires, then send a LAYOUTGET that can
fail the same way.
Patch 1 has writes test the inode bit in both places, and paces
nfs_writepages(): the first resend after -EAGAIN is immediate, then
data-integrity writeback waits a second before each resend and other
writeback leaves the folios dirty. Patch 2 removes the header bit,
which nothing tests after patch 1. Patch 3 sends reads, writes and the
resend after a data server error through the MDS while the fail bit for
their iomode is set. Patch 4 fixes two older MDS-fallback tracepoints
that read the layout header without i_lock, as patch 1 does for the one
it moves.
Patch 3 is how the server sends I/O to the MDS, as Trond described in
the v3 review: the client reports a data server it can't use with
LAYOUTERROR or LAYOUTRETURN, and the server decides whether to answer
the next LAYOUTGET with NFS4ERR_LAYOUTUNAVAILABLE. The client sends no
other I/O for these files through the MDS.
This is the rest of the v3 series, on top of "pNFS: layout recalls and
writes that have to be resent":
https://lore.kernel.org/linux-nfs/cover.1796306148.git.bcodding@hammerspace.com/
That series has what v3's 1/5 and 2/5 were for. Its patch 10 has
nfs_wb_folio() wait and resend a refused folio, its patch 5 is v3's 2/5,
and its patch 6 paces the O_DIRECT resend.
Tested on a KASAN kernel against a reffs MDS that hands out six-way
mirrored flexfiles layouts with FF_FLAGS_NO_IO_THRU_MDS, with knfsd as
the NFSv3 data server, injecting LAYOUTGET errors after a file recall:
- With NFS4ERR_LAYOUTUNAVAILABLE, reads and writes go through the MDS
at once, and the data written through the MDS is on every mirror.
That includes writeback stopped after queueing its first folio, with
a test-only delay, when the recall and the error arrive: the queued
folio and the rest go through the MDS.
- With a retryable error (NFS4ERR_SERVERFAULT) held for 6 to 8
seconds, fsync retries once a second with no I/O to the MDS. On
the base it resends without a pause, or writes through the MDS once
the layout header is gone. SIGKILL ends a writer blocked in fsync,
sync_file_range(SYNC_FILE_RANGE_WRITE) returns 0, and a soft mount
with io_maxretrans=3 returns EIO after about 2 seconds. A read of a
folio that another open context had dirtied waits for the layout,
flushes the folio to the data servers and returns the data.
- The recall tests from the series this is based on still pass:
buffered and O_DIRECT I/O under FSID, ALL and FILE recalls with
every mirror checked, the O_DIRECT write from an mmap of the same
file, writeback stopped between folios, and uncommitted UNSTABLE
data.
Not tested: layouts with a single mirror.
The base is that series on Trond's testing branch at 3e1999173432.
Changes since v3:
https://lore.kernel.org/linux-nfs/cover.1795122899.git.bcodding@hammerspace.com/
- 1/5 (writeback of a locked folio through the MDS) is dropped, and
pg_allow_mds with it.
- 2/5 is patch 5 of the base series.
- Patch 1 (was 3/5): the O_DIRECT changes are gone, since the base
series paces that resend. nfs_writepages() waits after any second
-EAGAIN, so the pg_nolayout descriptor bit is gone too, and the
first resend is immediate.
- Patches 2 and 3 (were 4/5 and 5/5): unchanged apart from a comment
that mentioned pg_allow_mds.
- New patch 4 (local sashiko review).
Benjamin Coddington (4):
pNFS/flexfiles: pace writes that have no layout and can't use the MDS
pNFS/flexfiles: remove the layout-header NO_IO_THRU_MDS bit
pNFS/flexfiles: use the MDS when the server has no layout to give
pNFS/flexfiles: emit the pg_init MDS-fallback tracepoints under i_lock
fs/nfs/flexfilelayout/flexfilelayout.c | 156 ++++++++++++++++---------
fs/nfs/flexfilelayout/flexfilelayout.h | 16 ---
fs/nfs/internal.h | 10 +-
fs/nfs/nfs4trace.c | 1 +
fs/nfs/nfs4trace.h | 1 +
fs/nfs/pnfs.c | 22 ++++
fs/nfs/pnfs.h | 1 +
fs/nfs/write.c | 13 +++
8 files changed, 144 insertions(+), 76 deletions(-)
base-commit: 3e19991734326332c736e24c9b47b2cffb8f9e42
prerequisite-patch-id: 1bf389e0665f28a4f66068858631884b3ff270aa
prerequisite-patch-id: 674a8beed30311c64efccf670996a549edf25c9e
prerequisite-patch-id: 02c555c4e0f0ca007f265128080e777217679463
prerequisite-patch-id: b6845ef891faa85557c023fdae602004e258e122
prerequisite-patch-id: a1dfade3905aa336e6d6a296a3e056e105041072
prerequisite-patch-id: 30b5addaf02ea29abd0a5e446c35c8b71926ef81
prerequisite-patch-id: 3d02a5ce811d297818b0cb44a4ff616feaf4be0b
prerequisite-patch-id: 4e11b1d4d8fa707791d03518391ec18d2b479f34
prerequisite-patch-id: dbeb9d6825f0bd79715266abd14f8da66bf085f5
prerequisite-patch-id: 5f6e4082c18157d4d185fb973c7faacb91badd2f
prerequisite-patch-id: 64d6171847787b2db7444a73ae5a686afe8afb0c
--
2.53.0
next reply other threads:[~2026-12-03 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 16:54 Benjamin Coddington [this message]
2026-12-03 16:54 ` [PATCH v4 1/4] pNFS/flexfiles: pace writes that have no layout and can't use the MDS Benjamin Coddington
2026-12-03 16:54 ` [PATCH v4 2/4] pNFS/flexfiles: remove the layout-header NO_IO_THRU_MDS bit Benjamin Coddington
2026-12-03 16:54 ` [PATCH v4 3/4] pNFS/flexfiles: use the MDS when the server has no layout to give Benjamin Coddington
2026-12-03 16:54 ` [PATCH v4 4/4] pNFS/flexfiles: emit the pg_init MDS-fallback tracepoints under i_lock 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=cover.1796315321.git.bcodding@hammerspace.com \
--to=ben.coddington@hammerspace.com \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=okorniev@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.