From: Allison Henderson Date: Wed, 4 May 2022 02:40:02 +0000 (+1000) Subject: xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9a39cdabc172ef2de3f21a34e73cdc1d02338d79;p=linux.git xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process 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 Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong Signed-off-by: Dave Chinner --- diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 2815cfbbae70a..e629bf51dc06c 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/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);