On Wed, Sep 21, 2022 at 08:46:20PM +0100, Al Viro wrote: > On Wed, Sep 21, 2022 at 10:26:12AM +0200, Christian Brauner wrote: > > - /* From now path refers to the tmpfile */ > > + > > + /* prepare tmp path */ > > + path.mnt = cache->mnt; > > path.dentry = file->f_path.dentry; > > Do we even want that struct path from that point on? Look: > > d_backing_inode(path.dentry) is a weird way to spell file_inode(file). > > cachefiles_mark_inode_in_use() is an overkill here - it *can't* fail > here, so all we want is > inode_lock(inode); > inode->i_flags |= S_KERNEL_FILE; > trace_cachefiles_mark_active(object, inode); > inode_unlock(inode); > where inode is, again, file_inode(file). > > cachefiles_do_unmark_inode_in_use() uses only inode. > > vfs_truncate() could use &file->f_path, but there's a potentially > nastier problem - theoretically, there are filesystems where we might > want struct file available for operation, especially for opened-and-unlinked > equivalents. In any case, &file->f_path would do just as well as its copy. Yeah, sounds reasonable.