Re: [PATCH -next -v4 01/17] fs: pass struct path to notify_change()

From: Cai Xinchen

Date: Wed Nov 18 2026 - 04:14:50 EST


On whether we want the mount references at all: they are not for NTFS.
The path-based LSM hooks need them - Landlock's check walks the hierarchy
up from the object with path->mnt->mnt_root and follow_up(), for every
layer, and the idmap we pass has to be the one of the mount the path was
checked in.  NTFS is only the reason for ia_path/notify_change_target():
->setattr() has no path argument, so a change forwarded to the base inode
would otherwise lose the mount.

On 11/18/2026 2:30 AM, Al Viro wrote:
That needs a bit along the lines of "path MUST be consistent - don't combine
a dentry from one filesystem with mount of another". All in-kernel callers
might have appropriate struct mount references on hand, but for out-of-tree
code that might be not true and we'd better be upfront about the headache
we are inflicting.

I'm not sure we really want to provide those mount references, TBH - it does
add a constraint not just on out-of-tree callers, but upon the future uses
in the kernel. If NTFS is the only reason... ugh.

ok, I will change in v5

BTW, why not something like

notify_change(&nop_mnt_idmap,
&(struct path){.mnt = path.mnt, .dentry = dentry},
&newattrs, NULL);
instead of that named local? Same question for other places like that...