Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/3} Change ->mkdir() and vfs_mkdir() to return a dentry
@ 2025-02-14  5:16 NeilBrown
  2025-02-14  5:16 ` [PATCH 1/3] Change inode_operations.mkdir to return struct dentry * NeilBrown
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: NeilBrown @ 2025-02-14  5:16 UTC (permalink / raw)
  To: Al Viro, Christian Brauner, Trond Myklebust, Anna Schumaker
  Cc: linux-nfs, linux-fsdevel, linux-kernel

This is a small set of patches which are needed before we can make the
locking on directory operations more fine grained.  I think they are
useful even if we don't go that direction.

Some callers of vfs_mkdir() need to operation on the resulting directory
but cannot be guaranteed that the dentry will be hashed and positive on
success - another dentry might have been used.

This patch changes ->mkdir to return a dentry, changes NFS in particular
to return the correct dentry (I believe it is the only filesystem to
possibly not use the given dentry), and changes vfs_mkdir() to return
that dentry, removing the look that a few callers currently need.

I have not Cc: the developers of all the individual filesystems - only
NFS.  I have build-tested all the changes except hostfs.  I can email
them explicitly if/when this is otherwise acceptable.  If anyone sees
this on fs-devel and wants to provide a pre-emptive ack I will collect
those and avoid further posting for those fs.

Thanks,
NeilBrown


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH 0/3 RFC v2] change ->mkdir() and vfs_mkdir() to return a dentry
@ 2025-02-17  5:30 NeilBrown
  2025-02-17  5:30 ` [PATCH 3/3] VFS: Change vfs_mkdir() to return the dentry NeilBrown
  0 siblings, 1 reply; 15+ messages in thread
From: NeilBrown @ 2025-02-17  5:30 UTC (permalink / raw)
  To: Christian Brauner, Alexander Viro, Jan Kara; +Cc: linux-fsdevel, linux-kernel

Here is a second attempt at this change.  Guided by Al I have handled
other file systems which don't return a hashed positive dentry on success.

It is not always possible to provide a reliable answer.  One example is
that cifs might find, after successfully creating a directory, that the
name now leads to a non-directory (due to a race with another client).
So callers of vfs_mkdir() need to cope with successful mkdir but no
usable dentry.  There is nothing they can do to recover and must
continue gracefully.  This failre mode is detected by the returned
dentry being unhashed.

ORIGINAL DESCRIPTION - updated to reflect changes.

This is a small set of patches which are needed before we can make the
locking on directory operations more fine grained.  I think they are
useful even if we don't go that direction.

Some callers of vfs_mkdir() need to operate on the resulting directory
but cannot be guaranteed that the dentry will be hashed and positive on
success - another dentry might have been used.

This patch changes ->mkdir to return a dentry, changes several
filesystems to return the correct dentry, and changes vfs_mkdir() to
return that dentry, only performing a lookup as a last resort.

I have not Cc: the developers of all the individual filesystems NFS.  I
or kernel-test-robot have build-tested all the changes.  If anyone sees
this on fs-devel and wants to provide a pre-emptive ack I will collect
those and avoid further posting for those fs.

Thanks,
NeilBrown


 [PATCH 1/3] Change inode_operations.mkdir to return struct dentry *
 [PATCH 2/3] nfs: change mkdir inode_operation to return alternate
 [PATCH 3/3] VFS: Change vfs_mkdir() to return the dentry.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-02-19  0:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14  5:16 [PATCH 0/3} Change ->mkdir() and vfs_mkdir() to return a dentry NeilBrown
2025-02-14  5:16 ` [PATCH 1/3] Change inode_operations.mkdir to return struct dentry * NeilBrown
2025-02-15  8:09   ` kernel test robot
2025-02-17 15:58   ` kernel test robot
2025-02-14  5:16 ` [PATCH 2/3] nfs: change mkdir inode_operation to return alternate dentry if needed NeilBrown
2025-02-14  5:16 ` [PATCH 3/3] VFS: Change vfs_mkdir() to return the dentry NeilBrown
2025-02-15  4:10   ` kernel test robot
2025-02-15  6:36   ` kernel test robot
2025-02-14  6:00 ` [PATCH 0/3} Change ->mkdir() and vfs_mkdir() to return a dentry Al Viro
2025-02-14  6:13   ` Al Viro
2025-02-14  6:33     ` Al Viro
2025-02-17  3:53   ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2025-02-17  5:30 [PATCH 0/3 RFC v2] change " NeilBrown
2025-02-17  5:30 ` [PATCH 3/3] VFS: Change vfs_mkdir() to return the dentry NeilBrown
2025-02-18 13:43   ` Jeff Layton
2025-02-19  0:33     ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox