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

From: Al Viro

Date: Tue Nov 17 2026 - 13:35:23 EST


On Tue, Nov 17, 2026 at 06:30:59PM +0000, Al Viro wrote:
> On Tue, Nov 17, 2026 at 11:05:26PM +0800, Cai Xinchen wrote:
>
> > +notify_change() and do_truncate() now take a const struct path * instead
> > +of a struct dentry *. They use path->dentry, so callers that only have a
> > +dentry must provide a struct path. struct iattr has a new ia_path member,
> > +which notify_change() sets for the duration of the call; it must not be
> > +stored beyond that. Filesystems that forward a change to another inode
> > +can use notify_change_target() to update the target dentry while keeping
> > +the caller-supplied path in ia_path.
>
> 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.

Incidentally, will the mount reference you are supplying in case of overlayfs
upper layer be any good for LSM users?