On Mon, Oct 21, 2024 at 11:43:13PM +0100, Al Viro wrote: > 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? If you look at the history you'll find that STATX_MNT_ID has always been set unconditionally, i.e., userspace didn't have to request it explicitly. And that's fine. It's not like it's expensive. > > 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... Block people should know. But afaict, that's a block device thing which happens with CONFIG_BLOCK_LEGACY_AUTOLOAD enabled which is supposedly deprecated.