On Mon, Oct 21, 2024 at 06:09:10PM +0100, Al Viro wrote: > On Mon, Oct 21, 2024 at 02:39:58PM +0200, Christian Brauner wrote: > > > > See #getname.fixup; on top of #base.getname and IMO worth folding into it. > > > > Yes, please fold so I can rebase my series on top of it. > > OK... What I have is #base.getname-fixed, with two commits - trivial > "teach filename_lookup() to accept NULL" and introducing getname_maybe_null(), > with fix folded in. > > #work.xattr2 and #work.statx2 are on top of that. BTW, speaking of statx() - I would rather lift the call of cp_statx() out of do_statx() and do_statx_fd() into the callers. Yes, that needs making it non-static, due to io_uring; not a problem, IMO - it fits into the "how do we copy internal objects to userland ones" family of helpers. Another fun issue: for by-pathname case vfs_fstatat() ends up hitting the same vfs_statx_path() as statx(2); however, for by-descriptor case they do vfs_getattr() and vfs_statx_path() resp. The difference is, vfs_statx_path() has if (request_mask & STATX_MNT_ID_UNIQUE) { stat->mnt_id = real_mount(path->mnt)->mnt_id_unique; stat->result_mask |= STATX_MNT_ID_UNIQUE; } else { stat->mnt_id = real_mount(path->mnt)->mnt_id; stat->result_mask |= STATX_MNT_ID; } if (path_mounted(path)) stat->attributes |= STATX_ATTR_MOUNT_ROOT; stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT; /* * If this is a block device inode, override the filesystem * attributes with the block device specific parameters that need to be * obtained from the bdev backing inode. */ if (S_ISBLK(stat->mode)) bdev_statx(path, stat, request_mask); done after vfs_getattr(). Questions: 1) why is STATX_MNT_ID set without checking if it's in the mask passed to the damn thing? 2) why, in the name of everything unholy, does statx() on /dev/weird_shite trigger modprobe on that thing? Without even a permission check on it...