Skip to content

Change ->mkdir() and vfs_mkdir() to return a dentry.

NeilBrown ceph-devel linux-cifs linux-fsdevel linux-nfs linux-um lkml netfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 27 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6Change inode_operations.mkdir to return struct dentry *Documentation/filesystems/locking.rst Documentation/filesystems/porting.rst Documentation/filesystems/vfs.rst +54 more+275 -22610 replies
2/6hostfs: store inode in dentry after mkdir if possible.fs/hostfs/hostfs_kern.c+9 -11 reply
3/6ceph: return the correct dentry on mkdirfs/ceph/dir.c+8 -16 replies
4/6fuse: return correct dentry for ->mkdirfs/fuse/dir.c+34 -214 replies
5/6nfs: change mkdir inode_operation to return alternate dentry if needed.fs/nfs/dir.c fs/nfs/nfs3proc.c fs/nfs/nfs4proc.c +2 more+50 -292 replies
6/6VFS: Change vfs_mkdir() to return the dentry.drivers/base/devtmpfs.c fs/cachefiles/namei.c fs/ecryptfs/inode.c +10 more+105 -1304 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchJeff LaytonJan KaraViacheslav Dubeyko
1/6R-b R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/6] Change ->mkdir() and vfs_mkdir() to return a dentry.

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