diff options
| author | NeilBrown <neil@brown.name> | 2026-07-17 19:27:56 +1000 |
|---|---|---|
| committer | Chuck Lever <cel@kernel.org> | 2026-08-26 16:40:23 -0400 |
| commit | 02c05256402e2a88f16839e3a13bc8cb7ff9170c (patch) | |
| tree | 7ecd102914fc119dde9889cac1b21aa8b58b52a5 /scripts | |
| parent | 7371201b92c8eeb39fc7f5cb2fbf19c58d284575 (diff) | |
| download | linux-next-02c05256402e2a88f16839e3a13bc8cb7ff9170c.tar.gz linux-next-02c05256402e2a88f16839e3a13bc8cb7ff9170c.zip | |
nfsd: in nfsd4_create_file() let VFS report if file was created.
nfsd4_create_file() currently assumes that if a lookup failed but then a
create succeeds, then the "create" operation actually created the file.
With atomic_open this may not be the case - some other actor might have
created the file between the lookup and the create.
So we move the call to nfsd4_vfs_create() earlier and set ->op_created
based on the FMODE_CREATED flag that it set. Then use "! ->op_created"
to trigger nfserr_exist handling.
The switch statement is split up into two if() statements.
First we check for the possibility of a successful exclusive
create and set ->op_create to true if appropriate.
Then we check for NFS4_CREATE_UNCHECKED to decide if a
pre-existing file means an error or success.
This allows us to combine the two fh_compose() calls to one place.
A subtle difference here is that we now must only pass O_EXCL to
dentry_create() for NFS4_CREATE_GUARDED. For the EXCLUSIVE create modes
we want a successful open even if the file already exists. We then
check the verifier after the open succeeded to see if it was exclusive.
The above requires changing dentry_create() to reliably set
FMODE_CREATED when the file was actually created. Previously it only
sets this flag when atomic_open is used.
Signed-off-by: NeilBrown <neil@brown.name>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260717093001.1972119-9-neilb@ownmail.net
Signed-off-by: Chuck Lever <cel@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
