On Wed, Sep 21, 2022 at 10:44:38PM -0700, allison.henderson@xxxxxxxxxx wrote: > From: Allison Henderson <allison.henderson@xxxxxxxxxx> > > Tmp files are used as part of rename operations and will need attr forks > initialized for parent pointers. Expose the init_xattrs parameter to > the calling function to initialize the fork. > > Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx> > --- > fs/xfs/xfs_inode.c | 8 +++++--- > fs/xfs/xfs_inode.h | 2 +- > fs/xfs/xfs_iops.c | 3 ++- > 3 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c > index 4bfa4a1579f0..ff680de560d2 100644 > --- a/fs/xfs/xfs_inode.c > +++ b/fs/xfs/xfs_inode.c > @@ -1108,6 +1108,7 @@ xfs_create_tmpfile( > struct user_namespace *mnt_userns, > struct xfs_inode *dp, > umode_t mode, > + bool init_xattrs, > struct xfs_inode **ipp) > { > struct xfs_mount *mp = dp->i_mount; > @@ -1148,7 +1149,7 @@ xfs_create_tmpfile( > error = xfs_dialloc(&tp, dp->i_ino, mode, &ino); > if (!error) > error = xfs_init_new_inode(mnt_userns, tp, dp, ino, mode, > - 0, 0, prid, false, &ip); > + 0, 0, prid, init_xattrs, &ip); > if (error) > goto out_trans_cancel; > > @@ -2726,6 +2727,7 @@ xfs_rename_alloc_whiteout( > struct user_namespace *mnt_userns, > struct xfs_name *src_name, > struct xfs_inode *dp, > + bool init_xattrs, > struct xfs_inode **wip) > { > struct xfs_inode *tmpfile; > @@ -2733,7 +2735,7 @@ xfs_rename_alloc_whiteout( > int error; > > error = xfs_create_tmpfile(mnt_userns, dp, S_IFCHR | WHITEOUT_MODE, > - &tmpfile); > + init_xattrs, &tmpfile); Whiteouts are created prior to being added to a directory, right? If so, shouldn't this be s/init_xattrs/true/g to save time? Everything else in here looks good though! --D > if (error) > return error; > > @@ -2797,7 +2799,7 @@ xfs_rename( > */ > if (flags & RENAME_WHITEOUT) { > error = xfs_rename_alloc_whiteout(mnt_userns, src_name, > - target_dp, &wip); > + target_dp, false, &wip); > if (error) > return error; > > diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h > index 2eaed98af814..5735de32beeb 100644 > --- a/fs/xfs/xfs_inode.h > +++ b/fs/xfs/xfs_inode.h > @@ -478,7 +478,7 @@ int xfs_create(struct user_namespace *mnt_userns, > umode_t mode, dev_t rdev, bool need_xattr, > struct xfs_inode **ipp); > int xfs_create_tmpfile(struct user_namespace *mnt_userns, > - struct xfs_inode *dp, umode_t mode, > + struct xfs_inode *dp, umode_t mode, bool init_xattrs, > struct xfs_inode **ipp); > int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, > struct xfs_inode *ip); > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > index 5d670c85dcc2..07a26f4f6348 100644 > --- a/fs/xfs/xfs_iops.c > +++ b/fs/xfs/xfs_iops.c > @@ -200,7 +200,8 @@ xfs_generic_create( > xfs_create_need_xattr(dir, default_acl, acl), > &ip); > } else { > - error = xfs_create_tmpfile(mnt_userns, XFS_I(dir), mode, &ip); > + error = xfs_create_tmpfile(mnt_userns, XFS_I(dir), mode, false, > + &ip); > } > if (unlikely(error)) > goto out_free_acl; > -- > 2.25.1 >