aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllison Henderson <allison.henderson@oracle.com>2022-06-22 14:28:52 -0500
committerEric Sandeen <sandeen@sandeen.net>2022-06-22 14:28:52 -0500
commiteddff049e816d172a06be8e43d5637f37be2ba9e (patch)
tree8163943f5680d12b0f1e588fd81c96339403f2b8
parent9c0383ad5eead6d4d18ee884610beff7d75d232d (diff)
downloadxfsprogs-dev-eddff049e816d172a06be8e43d5637f37be2ba9e.tar.gz
xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process
Source kernel commit: 9a39cdabc172ef2de3f21a34e73cdc1d02338d79 During an attr rename operation, blocks are saved for later removal as rmtblkno2. The rmtblkno is used in the case of needing to alloc more blocks if not enough were available. However, in the case that no further blocks need to be added or removed, we can return as soon as xfs_attr_node_addname completes, rather than rolling the transaction with an -EAGAIN return. This extra loop does not hurt anything right now, but it will be a problem later when we get into log items because we end up with an empty log transaction. So, add a simple check to cut out the unneeded iteration. Signed-off-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--libxfs/xfs_attr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index f08918024c..1450c221f8 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -412,6 +412,14 @@ xfs_attr_set_iter(
if (error)
return error;
+ /*
+ * If addname was successful, and we dont need to alloc
+ * or remove anymore blks, we're done.
+ */
+ if (!args->rmtblkno &&
+ !(args->op_flags & XFS_DA_OP_RENAME))
+ return 0;
+
dac->dela_state = XFS_DAS_FOUND_NBLK;
}
trace_xfs_attr_set_iter_return(dac->dela_state, args->dp);