Messages in this thread | | | Date | Tue, 28 Mar 2023 10:12:27 +0200 | From | Christian Brauner <> | Subject | Re: [PATCH] do_open(): Fix O_DIRECTORY | O_CREAT behavior |
| |
On Mon, Mar 27, 2023 at 09:13:18PM +0100, Pedro Falcato wrote: > On Tue, Mar 21, 2023 at 4:17 PM Christian Brauner <brauner@kernel.org> wrote: > > It would be very nice if we had tests for the new behavior. So if @Pedro > > would be up for it that would be highly appreciated. If not I'll put it > > on my ToDo... > > Where do you want them? selftests? I have a relatively self-contained > ""testsuite"" of namei stuff that could fit in there well, after some > cleanup.
I think I would prefer to have them as part of xfstests: https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
as that's where nearly all of the fs testing is taking place. It's never great when developers have to run 3 separate testsuites to get meaningful coverage. So having it central to xfstests would be my preference.
A while ago I added a testsuite that tests generic core VFS behavior it's located under src/vfs: https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/tree/src/vfs
and covers a lot of different things. So I would ask you to consider adding a new testsuite into that file:
https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/tree/src/vfs/vfstest.c
I think the structure should be somewhat understandable. Then create a new test in xfstests using the "new" helper in the generic sectionA
> ./new generic Next test id is 728 Append a name to the ID? Test name will be 728-$name. y,[n]: Creating test file '728' Add to group(s) [auto] (separate by space, ? for list): auto quick Creating skeletal script for you to edit ...
then call the vfstest binary from the generated test case:
echo "Silence is golden"
$here/src/vfs/vfstest --test-THAT-NEW-SWITCH-NAME-YOU-ADDED --device "$TEST_DEV" \ --mount "$TEST_DIR" --fstype "$FSTYP"
status=$? exit
(You can also submit this to LTP or tell them about this change and they'll likely add tests in addition to xfstests.)
> > > The expectation often is that this particular combination would create > > and open a directory. This suggests users who tried to use that > > combination would stumble upon the counterintuitive behavior no matter > > if pre-v5.7 or post v5.7 and quickly realize neither semantics give them > > what they want. For some examples see the code examples in [1] to [3] > > and the discussion in [4]. > > Ok so, silly question: Could it not be desirable to have these > semantics (open a dir or mkdir, atomically)? > It does seem to be why POSIX left this edge case implementation > defined, and if folks are asking for it, could it be the right move? > > And yes, I do understand (from reading the room) that no one here is > too excited about this possibility.
Forgive me for being lazy and instead of repeating everything I'll just leave a link to the other part of the thread https://lore.kernel.org/lkml/20230328075735.d3rs27jjvarmn6dw@wittgenstein
| |