]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove last of unnecessary xfs_defer_cancel() callers
authorBrian Foster <bfoster@redhat.com>
Tue, 9 Oct 2018 16:44:34 +0000 (11:44 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 9 Oct 2018 16:44:34 +0000 (11:44 -0500)
Source kernel commit: d5a2e2893da0d62c3888c91ae2da798adc17a9b9

Now that deferred operations are completely managed via
transactions, it's no longer necessary to cancel the dfops in error
paths that already cancel the associated transaction. There are a
few such calls lingering throughout the codebase.

Remove all remaining unnecessary calls to xfs_defer_cancel(). This
leaves xfs_defer_cancel() calls in two places. The first is the call
in the transaction cancel path itself, which facilitates this patch.
The second is made via the xfs_defer_finish() error path to provide
consistent error semantics with transaction commit. For example,
xfs_trans_commit() expects an xfs_defer_finish() failure to clean up
the dfops structure before it returns.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c
libxfs/xfs_attr_remote.c

index bbfe4ee0f59ddbf0916f9f1f3e69dbc8fe16f70c..0f20a571e14e98a56cef084dea87282e8b7c75e1 100644 (file)
@@ -582,7 +582,7 @@ xfs_attr_leaf_addname(
                 */
                error = xfs_attr3_leaf_to_node(args);
                if (error)
-                       goto out_defer_cancel;
+                       return error;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        return error;
@@ -670,7 +670,7 @@ xfs_attr_leaf_addname(
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
                        if (error)
-                               goto out_defer_cancel;
+                               return error;
                        error = xfs_defer_finish(&args->trans);
                        if (error)
                                return error;
@@ -688,9 +688,6 @@ xfs_attr_leaf_addname(
                error = xfs_attr3_leaf_clearflag(args);
        }
        return error;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       return error;
 }
 
 /*
@@ -733,15 +730,12 @@ xfs_attr_leaf_removename(
                error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                /* bp is gone due to xfs_da_shrink_inode */
                if (error)
-                       goto out_defer_cancel;
+                       return error;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        return error;
        }
        return 0;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       return error;
 }
 
 /*
@@ -859,7 +853,7 @@ restart:
                        state = NULL;
                        error = xfs_attr3_leaf_to_node(args);
                        if (error)
-                               goto out_defer_cancel;
+                               goto out;
                        error = xfs_defer_finish(&args->trans);
                        if (error)
                                goto out;
@@ -883,7 +877,7 @@ restart:
                 */
                error = xfs_da3_split(state);
                if (error)
-                       goto out_defer_cancel;
+                       goto out;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        goto out;
@@ -979,7 +973,7 @@ restart:
                if (retval && (state->path.active > 1)) {
                        error = xfs_da3_join(state);
                        if (error)
-                               goto out_defer_cancel;
+                               goto out;
                        error = xfs_defer_finish(&args->trans);
                        if (error)
                                goto out;
@@ -1008,9 +1002,6 @@ out:
        if (error)
                return error;
        return retval;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       goto out;
 }
 
 /*
@@ -1102,7 +1093,7 @@ xfs_attr_node_removename(
        if (retval && (state->path.active > 1)) {
                error = xfs_da3_join(state);
                if (error)
-                       goto out_defer_cancel;
+                       goto out;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        goto out;
@@ -1133,7 +1124,7 @@ xfs_attr_node_removename(
                        error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
                        /* bp is gone due to xfs_da_shrink_inode */
                        if (error)
-                               goto out_defer_cancel;
+                               goto out;
                        error = xfs_defer_finish(&args->trans);
                        if (error)
                                goto out;
@@ -1145,9 +1136,6 @@ xfs_attr_node_removename(
 out:
        xfs_da_state_free(state);
        return error;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       goto out;
 }
 
 /*
index 1d078efe7c689ff304f16d7f8e0f7d7229cd1e0a..da3728af5d6b2a0722feea2329e5a171aaeb0080 100644 (file)
@@ -480,7 +480,7 @@ xfs_attr_rmtval_set(
                                  blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map,
                                  &nmap);
                if (error)
-                       goto out_defer_cancel;
+                       return error;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        return error;
@@ -548,9 +548,6 @@ xfs_attr_rmtval_set(
        }
        ASSERT(valuelen == 0);
        return 0;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       return error;
 }
 
 /*
@@ -620,7 +617,7 @@ xfs_attr_rmtval_remove(
                error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
                                    XFS_BMAPI_ATTRFORK, 1, &done);
                if (error)
-                       goto out_defer_cancel;
+                       return error;
                error = xfs_defer_finish(&args->trans);
                if (error)
                        return error;
@@ -633,7 +630,4 @@ xfs_attr_rmtval_remove(
                        return error;
        }
        return 0;
-out_defer_cancel:
-       xfs_defer_cancel(args->trans);
-       return error;
 }