From: "Chuck Lever" <cel@kernel.org>
To: NeilBrown <neil@brown.name>, fstests@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fstests: generic: Add test of seek in directories
Date: Sun, 30 Aug 2026 19:13:56 -0400 [thread overview]
Message-ID: <114f727b-86bc-40b8-8487-35bccf101d2c@app.fastmail.com> (raw)
In-Reply-To: <20260827234743.2389778-2-neilb@ownmail.net>
On Thu, Aug 27, 2026, at 7:36 PM, NeilBrown wrote:
> Add a test for consistency of readdir (getdents64) results.
Thanks for writing this!
Note that it asserts more than exactly-once: the relative order of
every stable name must hold for the life of the directory, across
independent opens. That is the right property needed for NFS. Either
the internal documentation or the commit message should say that,
and explain why: between two READDIRs there is no open state, so the
server can be handed any cookie against any later state of the
directory. POSIX does not require this, certainly, but NFS does.
The seek check picks n from all names, including unstable ones
unlinked many loops earlier, using the d_off from the first scan.
That is the "rm -rf over NFS" case and the most valuable check here,
but it reads like an oversight. Can you add a comment saying it is
deliberate?
The seven op classes run mixed in one invocation, so a failure says
"loop 37 with seed 1234567" and not which *semantic* broke. btrfs
fails only on renames onto a stable name, and nobody can tell that
from the output without rerunning with -T. It might be nicer to have
the wrapper invoke the binary once per class, or at least once each
for churn, rename onto an existing name, and RENAME_EXCHANGE. Then
put exchange in its own test gated by _require_renameat2 exchange,
which replaces the FSTYP == nfs check and _notruns everywhere the
flag is unsupported.
> +_begin_fstest auto dir quick
Add rename, perhaps?
> +$here/src/t_dir_seek -p $TEST_DIR -S 1234567 $extra
$TEST_DIR/testdir is not scoped to $seq and there is no _cleanup().
A run interrupted before clean_files() makes the next one fail in
mkdir with exit status 1. Use $TEST_DIR/$seq-dir and rm -rf it before
the run and in _cleanup().
> + case op_create:
> + n = get_file(&unused);
> + if (n > 0) {
n >= 0. Name 0 is a valid index. Drawn here it is removed from unused
and never put back anywhere.
> + lseek(fd, off, SEEK_SET);
For both get_order() and check_order(), a rejected cookie should fail
with the errno, not proceed from 0 and report bad order.
Nits: copyright 2025 vs 2026; typos in both header comments; %lu for
uint64_t; usage says "-p 10" for -o; the -n and -o range errors name
the wrong flags; d_name[] rather than d_name[0].
With the wrapper and op_create fixes:
Reviewed-by: Chuck Lever <cel@kernel.org>
I will also note that, despite the new failures, users of NFS-
exported tmpfs and btrfs filesystems have not observed or reported
problems. So the severity of these failures is not high, IMO, but it
would still be good to correct them. It's great to see more of the
specific NFS requirements for directories materialized in a set of
unit tests.
--
Chuck Lever (Come to NFS bake-a-thon! https://nfsv4bat.org)
next prev parent reply other threads:[~2026-08-30 23:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 23:36 fstests: Verify behaviour of "seek" in a directory NeilBrown
2026-08-27 23:36 ` [PATCH] fstests: generic: Add test of seek in directories NeilBrown
2026-08-28 4:13 ` Matthew Wilcox
2026-08-28 11:12 ` NeilBrown
2026-08-28 14:55 ` Theodore Tso
2026-08-30 22:22 ` NeilBrown
2026-08-31 1:37 ` Theodore Tso
2026-08-31 13:16 ` Christoph Hellwig
2026-09-01 1:05 ` NeilBrown
2026-09-01 9:18 ` Christoph Hellwig
2026-08-30 23:13 ` Chuck Lever [this message]
2026-08-31 12:59 ` Christoph Hellwig
2026-08-31 22:47 ` NeilBrown
2026-09-01 9:09 ` Christoph Hellwig
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=114f727b-86bc-40b8-8487-35bccf101d2c@app.fastmail.com \
--to=cel@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=neil@brown.name \
/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