Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Allison Henderson and committed by
Dave Chinner
9a39cdab 7b3ec2b2

+8
+8
fs/xfs/libxfs/xfs_attr.c
··· 412 412 if (error) 413 413 return error; 414 414 415 + /* 416 + * If addname was successful, and we dont need to alloc 417 + * or remove anymore blks, we're done. 418 + */ 419 + if (!args->rmtblkno && 420 + !(args->op_flags & XFS_DA_OP_RENAME)) 421 + return 0; 422 + 415 423 dac->dela_state = XFS_DAS_FOUND_NBLK; 416 424 } 417 425 trace_xfs_attr_set_iter_return(dac->dela_state, args->dp);