Re: [PATCH 4/6] fuse: return correct dentry for ->mkdir

From: Al Viro
Date: Sun Feb 23 2025 - 21:55:38 EST


On Mon, Feb 24, 2025 at 01:26:18PM +1100, NeilBrown wrote:

> Probably now. It would require S_IFDIR to be passed in the mode to
> vfs_mknod(). I don't think any current callers do that, but I don't see
> any code in vfs_mknod() to prevent it.

Not allowed (and that's caller's responsibility to enforce). Local filesystems
would break horribly if that ever happened.

->mknod() instance _may_ be a convenient helper for ->mkdir() et.al. to call,
but even for ramfs it won't coincide with ->mkdir() (wrong i_nlink, for one
thing).

If that's not documented, it really should be.

vfs_mknod() may be called for block devices, character devices, FIFOs and
sockets. Nothing else is allowed.