]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: use ->t_dfops for attr set/remove operations
authorBrian Foster <bfoster@redhat.com>
Thu, 4 Oct 2018 19:26:01 +0000 (14:26 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 4 Oct 2018 19:26:01 +0000 (14:26 -0500)
Source kernel commit: 40d03ac6aa2bebe05190462734690472310167e4

Attach the local dfops to the transaction allocated for xattr add
and remove operations. Add an earlier initialization in
xfs_attr_remove() to ensure the structure is valid if it remains
unused at transaction commit time.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 35a65d70f584ea6a1111555914675ad4190a45c3..802a7d5cc5a42ce942325f4a45a64a74be1a3b2f 100644 (file)
@@ -249,6 +249,8 @@ xfs_attr_set(
                        rsvd ? XFS_TRANS_RESERVE : 0, &args.trans);
        if (error)
                return error;
+       xfs_defer_init(&dfops, &firstblock);
+       args.trans->t_dfops = &dfops;
 
        xfs_ilock(dp, XFS_ILOCK_EXCL);
        error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0,
@@ -310,7 +312,6 @@ xfs_attr_set(
                 * It won't fit in the shortform, transform to a leaf block.
                 * GROT: another possible req'mt for a double-split btree op.
                 */
-               xfs_defer_init(args.dfops, args.firstblock);
                error = xfs_attr_shortform_to_leaf(&args, &leaf_bp);
                if (error)
                        goto out_defer_cancel;
@@ -320,9 +321,9 @@ xfs_attr_set(
                 * buffer and run into problems with the write verifier.
                 */
                xfs_trans_bhold(args.trans, leaf_bp);
-               xfs_defer_bjoin(args.dfops, leaf_bp);
-               xfs_defer_ijoin(args.dfops, dp);
-               error = xfs_defer_finish(&args.trans, args.dfops);
+               xfs_defer_bjoin(&dfops, leaf_bp);
+               xfs_defer_ijoin(&dfops, dp);
+               error = xfs_defer_finish(&args.trans, &dfops);
                if (error)
                        goto out_defer_cancel;
 
@@ -424,6 +425,8 @@ xfs_attr_remove(
                        &args.trans);
        if (error)
                return error;
+       xfs_defer_init(&dfops, &firstblock);
+       args.trans->t_dfops = &dfops;
 
        xfs_ilock(dp, XFS_ILOCK_EXCL);
        /*
index a22d21276e23be5a84619bca38779960d37c8509..edb6cfaf6af5652f6264278373a692a206abba85 100644 (file)
@@ -1048,6 +1048,8 @@ xfs_bmap_add_attrfork(
                        rsvd ? XFS_TRANS_RESERVE : 0, &tp);
        if (error)
                return error;
+       xfs_defer_init(&dfops, &firstblock);
+       tp->t_dfops = &dfops;
 
        xfs_ilock(ip, XFS_ILOCK_EXCL);
        error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
@@ -1095,7 +1097,6 @@ xfs_bmap_add_attrfork(
        ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP);
        ip->i_afp->if_flags = XFS_IFEXTENTS;
        logflags = 0;
-       xfs_defer_init(&dfops, &firstblock);
        switch (ip->i_d.di_format) {
        case XFS_DINODE_FMT_LOCAL:
                error = xfs_bmap_add_attrfork_local(tp, ip, &firstblock, &dfops,