linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Change ->mkdir() and vfs_mkdir() to return a dentry.
@ 2025-02-20 23:36 NeilBrown
  2025-02-20 23:36 ` [PATCH 1/6] Change inode_operations.mkdir to return struct dentry * NeilBrown
                   ` (5 more replies)
  0 siblings, 6 replies; 36+ messages in thread
From: NeilBrown @ 2025-02-20 23:36 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara, Miklos Szeredi,
	Xiubo Li, Ilya Dryomov, Richard Weinberger, Anton Ivanov,
	Johannes Berg, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Sergey Senozhatsky
  Cc: linux-fsdevel, linux-kernel, linux-cifs, linux-nfs, linux-um,
	ceph-devel, netfs

I'm posting this to a wider audience now as I think it is close to its final form.
I have not included every fs maintainer explicitly (though this patch touches every writable FS)
but hope that fsdevel will catch enough of those).  I have included the affected clients
of vfs_mkdir: nfsd, smb/server, cachefiles, and the filesystems with non-trivial changes:
nfs, cephfs, hostfs, fuse.

mkdir is unique among object creation interfaces as there can only be
one dentry for an directory inode.  There is a possibilty of races which
could result in the inode created by mkdir already having a dentry when
mkdir comes to attach one.  To cope with this, three users of
vfs_mkdir() sometimes do a lookup to find the correct dentry when the
one that was passed in wasn't used.  This lookup is clumsy and racy.

This patch set changes mkdir interface so that the filesystem can
provide the correct dentry.  Some times this still requires a look-up
which can be racey, but having the filesystem do it limits this to only
when it is absolutely necessary.

So this series changes ->mkdir and vfs_mkdir() to allow a dentry to be
returned, changes a few filesystems to actually return a dentry
sometimes, and changes the callers of vfs_mkdir() to use the returned dentry.

I think it best if this could all land through the VFS tree as ask maitainers of:
 cachefiles nfsd smb/server
 hostfs ceph nfs fuse
to provide a Reviewed-by.

Thanks,
NeilBrown




^ permalink raw reply	[flat|nested] 36+ messages in thread
* [PATCH 0/6 v2] Change ->mkdir() and vfs_mkdir() to return a dentry
@ 2025-02-27  1:32 NeilBrown
  2025-02-27  1:32 ` [PATCH 1/6] Change inode_operations.mkdir to return struct dentry * NeilBrown
  0 siblings, 1 reply; 36+ messages in thread
From: NeilBrown @ 2025-02-27  1:32 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara
  Cc: Chuck Lever, Jeff Layton, Trond Myklebust, Anna Schumaker,
	linux-nfs, Ilya Dryomov, Xiubo Li, ceph-devel, Miklos Szeredi,
	linux-fsdevel, Richard Weinberger, Anton Ivanov, Johannes Berg,
	linux-um, linux-kernel

This revised series contains a few clean-ups as requested by various
people but no substantial changes.

It is based on vfs/vfs-6.15.async.dir plus vfs/vfs-6.15.sysv: I dropped the
change to sysv as it seemed pointless preserving them.

I reviewed the mkdir functions in many (all?) filesystems and found a
few that use d_instantiate() on an unlocked inode (after
unlock_new_inode()) and also support export_operations.  These could
potentially call d_instantiate() on a directory inode which is already
attached to an dentry, though making that happen would usually require
guessing the filehandle correctly.  I haven't tried to address those
here, (this patch set doesn't make that situation any worse) but I may
in the future.

Thanks,
NeilBrown


 [PATCH 1/6] Change inode_operations.mkdir to return struct dentry *
 [PATCH 2/6] hostfs: store inode in dentry after mkdir if possible.
 [PATCH 3/6] ceph: return the correct dentry on mkdir
 [PATCH 4/6] fuse: return correct dentry for ->mkdir
 [PATCH 5/6] nfs: change mkdir inode_operation to return alternate
 [PATCH 6/6] VFS: Change vfs_mkdir() to return the dentry.


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

end of thread, other threads:[~2025-02-27 12:09 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 23:36 [PATCH 0/6] Change ->mkdir() and vfs_mkdir() to return a dentry NeilBrown
2025-02-20 23:36 ` [PATCH 1/6] Change inode_operations.mkdir to return struct dentry * NeilBrown
2025-02-22  4:19   ` Al Viro
2025-02-24  1:34     ` NeilBrown
2025-02-24  2:09       ` Al Viro
2025-02-24  3:09         ` NeilBrown
2025-02-24 15:56           ` Trond Myklebust
2025-02-26  2:09             ` NeilBrown
2025-02-26  2:34               ` Trond Myklebust
2025-02-26  3:18                 ` NeilBrown
2025-02-26  3:35                   ` Al Viro
2025-02-22  4:56   ` Al Viro
2025-02-20 23:36 ` [PATCH 2/6] hostfs: store inode in dentry after mkdir if possible NeilBrown
2025-02-21 13:17   ` Jeff Layton
2025-02-20 23:36 ` [PATCH 3/6] ceph: return the correct dentry on mkdir NeilBrown
2025-02-21  1:48   ` Viacheslav Dubeyko
2025-02-24  2:15     ` NeilBrown
2025-02-24 22:09       ` Viacheslav Dubeyko
2025-02-24 22:53         ` Jeff Layton
2025-02-24 23:29         ` NeilBrown
2025-02-21 13:31   ` Jeff Layton
2025-02-20 23:36 ` [PATCH 4/6] fuse: return correct dentry for ->mkdir NeilBrown
2025-02-21 13:39   ` Jeff Layton
2025-02-22  4:24   ` Al Viro
2025-02-24  2:26     ` NeilBrown
2025-02-24  2:53       ` Al Viro
2025-02-20 23:36 ` [PATCH 5/6] nfs: change mkdir inode_operation to return alternate dentry if needed NeilBrown
2025-02-22  4:41   ` Al Viro
2025-02-24  2:41     ` NeilBrown
2025-02-20 23:36 ` [PATCH 6/6] VFS: Change vfs_mkdir() to return the dentry NeilBrown
2025-02-21 14:25   ` Jeff Layton
2025-02-22  0:32   ` Chuck Lever
2025-02-24  2:51     ` NeilBrown
2025-02-24 14:22       ` Chuck Lever
  -- strict thread matches above, loose matches on Subject: below --
2025-02-27  1:32 [PATCH 0/6 v2] Change ->mkdir() and vfs_mkdir() to return a dentry NeilBrown
2025-02-27  1:32 ` [PATCH 1/6] Change inode_operations.mkdir to return struct dentry * NeilBrown
2025-02-27 11:34   ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).