Source kernel commit: 2b1c81a8c3f453ba16b6db8dae256723bf53c051 This is a clean up patch that skips the flip flag logic for delayed attr renames. Since the log replay keeps the inode locked, we do not need to worry about race windows with attr lookups. So we can skip over flipping the flag and the extra transaction roll for it Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx> --- libxfs/xfs_attr.c | 43 ++++++++++++++++++++++++------------------- libxfs/xfs_attr_leaf.c | 3 ++- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index a3f256f..955e434 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -805,6 +805,7 @@ xfs_attr_leaf_addname( struct xfs_buf *bp = NULL; int error, forkoff; struct xfs_inode *dp = args->dp; + struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ switch (dac->dela_state) { @@ -870,15 +871,17 @@ xfs_attr_leaf_addname( * In a separate transaction, set the incomplete flag on the "old" attr * and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - return error; - /* - * Commit the flag value change and start the next trans in series. - */ - dac->dela_state = XFS_DAS_FLIP_LFLAG; - trace_xfs_das_state_return(dac->dela_state); - return -EAGAIN; + if (!xfs_hasdelattr(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + return error; + /* + * Commit the flag value change and start the next trans in series. + */ + dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_das_state_return(dac->dela_state); + return -EAGAIN; + } das_flip_flag: /* * Dismantle the "old" attribute/value pair by removing a "remote" value @@ -1077,6 +1080,7 @@ xfs_attr_node_addname( struct xfs_da_state_blk *blk; int retval = 0; int error = 0; + struct xfs_mount *mp = args->dp->i_mount; trace_xfs_attr_node_addname(args); @@ -1238,15 +1242,17 @@ das_alloc_node: * In a separate transaction, set the incomplete flag on the "old" attr * and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - goto out; - /* - * Commit the flag value change and start the next trans in series - */ - dac->dela_state = XFS_DAS_FLIP_NFLAG; - trace_xfs_das_state_return(dac->dela_state); - return -EAGAIN; + if (!xfs_hasdelattr(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + goto out; + /* + * Commit the flag value change and start the next trans in series + */ + dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_das_state_return(dac->dela_state); + return -EAGAIN; + } das_flip_flag: /* * Dismantle the "old" attribute/value pair by removing a "remote" value @@ -1275,7 +1281,6 @@ das_rm_nblk: * Re-find the "old" attribute entry after any split ops. The INCOMPLETE * flag means that we will find the "old" attr, not the "new" one. */ - args->attr_filter |= XFS_ATTR_INCOMPLETE; state = xfs_da_state_alloc(args); state->inleaf = 0; error = xfs_da3_node_lookup_int(state, &retval); diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 2c7aa6b..9837bd5 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -1483,7 +1483,8 @@ xfs_attr3_leaf_add_work( if (tmp) entry->flags |= XFS_ATTR_LOCAL; if (args->op_flags & XFS_DA_OP_RENAME) { - entry->flags |= XFS_ATTR_INCOMPLETE; + if (!xfs_hasdelattr(mp)) + entry->flags |= XFS_ATTR_INCOMPLETE; if ((args->blkno2 == args->blkno) && (args->index2 <= args->index)) { args->index2++; -- 2.7.4