Commit 3577cfd7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'xfs-fixes-7.0-rc6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Carlos Maiolino:
 "This includes a few important bug fixes, and some code refactoring
  that was necessary for one of the fixes"

* tag 'xfs-fixes-7.0-rc6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: remove file_path tracepoint data
  xfs: don't irele after failing to iget in xfs_attri_recover_work
  xfs: remove redundant validation in xlog_recover_attri_commit_pass2
  xfs: fix ri_total validation in xlog_recover_attri_commit_pass2
  xfs: close crash window in attr dabtree inactivation
  xfs: factor out xfs_attr3_leaf_init
  xfs: factor out xfs_attr3_node_entry_remove
  xfs: only assert new size for datafork during truncate extents
  xfs: annotate struct xfs_attr_list_context with __counted_by_ptr
  xfs: cleanup buftarg handling in XFS_IOC_VERIFY_MEDIA
  xfs: scrub: unlock dquot before early return in quota scrub
  xfs: refactor xfsaild_push loop into helper
  xfs: save ailp before dropping the AIL lock in push callbacks
  xfs: avoid dereferencing log items after push callbacks
  xfs: stop reclaim before pushing AIL during unmount
parents 34892992 e31c53a8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -55,7 +55,8 @@ struct xfs_attr_list_context {
	struct xfs_trans	*tp;
	struct xfs_inode	*dp;		/* inode */
	struct xfs_attrlist_cursor_kern cursor;	/* position in list */
	void			*buffer;	/* output buffer */
	/* output buffer */
	void			*buffer __counted_by_ptr(bufsize);

	/*
	 * Abort attribute list iteration if non-zero.  Can be used to pass
+22 −0
Original line number Diff line number Diff line
@@ -1415,6 +1415,28 @@ xfs_attr3_leaf_create(
	return 0;
}

/*
 * Reinitialize an existing attr fork block as an empty leaf, and attach
 * the buffer to tp.
 */
int
xfs_attr3_leaf_init(
	struct xfs_trans	*tp,
	struct xfs_inode	*dp,
	xfs_dablk_t		blkno)
{
	struct xfs_buf		*bp = NULL;
	struct xfs_da_args	args = {
		.trans		= tp,
		.dp		= dp,
		.owner		= dp->i_ino,
		.geo		= dp->i_mount->m_attr_geo,
	};

	ASSERT(tp != NULL);

	return xfs_attr3_leaf_create(&args, blkno, &bp);
}
/*
 * Split the leaf node, rebalance, then add the new entry.
 *
+3 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
/*
 * Routines used for shrinking the Btree.
 */

int	xfs_attr3_leaf_init(struct xfs_trans *tp, struct xfs_inode *dp,
				xfs_dablk_t blkno);
int	xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
void	xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
				       struct xfs_da_state_blk *drop_blk,
+42 −11
Original line number Diff line number Diff line
@@ -1506,11 +1506,13 @@ xfs_da3_fixhashpath(
}

/*
 * Remove an entry from an intermediate node.
 * Internal implementation to remove an entry from an intermediate node.
 */
STATIC void
xfs_da3_node_remove(
	struct xfs_da_state	*state,
__xfs_da3_node_remove(
	struct xfs_trans	*tp,
	struct xfs_inode	*dp,
	struct xfs_da_geometry  *geo,
	struct xfs_da_state_blk *drop_blk)
{
	struct xfs_da_intnode	*node;
@@ -1518,9 +1520,6 @@ xfs_da3_node_remove(
	struct xfs_da_node_entry *btree;
	int			index;
	int			tmp;
	struct xfs_inode	*dp = state->args->dp;

	trace_xfs_da_node_remove(state->args);

	node = drop_blk->bp->b_addr;
	xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr, node);
@@ -1536,17 +1535,17 @@ xfs_da3_node_remove(
		tmp  = nodehdr.count - index - 1;
		tmp *= (uint)sizeof(xfs_da_node_entry_t);
		memmove(&btree[index], &btree[index + 1], tmp);
		xfs_trans_log_buf(state->args->trans, drop_blk->bp,
		xfs_trans_log_buf(tp, drop_blk->bp,
		    XFS_DA_LOGRANGE(node, &btree[index], tmp));
		index = nodehdr.count - 1;
	}
	memset(&btree[index], 0, sizeof(xfs_da_node_entry_t));
	xfs_trans_log_buf(state->args->trans, drop_blk->bp,
	xfs_trans_log_buf(tp, drop_blk->bp,
	    XFS_DA_LOGRANGE(node, &btree[index], sizeof(btree[index])));
	nodehdr.count -= 1;
	xfs_da3_node_hdr_to_disk(dp->i_mount, node, &nodehdr);
	xfs_trans_log_buf(state->args->trans, drop_blk->bp,
	    XFS_DA_LOGRANGE(node, &node->hdr, state->args->geo->node_hdr_size));
	xfs_trans_log_buf(tp, drop_blk->bp,
	    XFS_DA_LOGRANGE(node, &node->hdr, geo->node_hdr_size));

	/*
	 * Copy the last hash value from the block to propagate upwards.
@@ -1554,6 +1553,38 @@ xfs_da3_node_remove(
	drop_blk->hashval = be32_to_cpu(btree[index - 1].hashval);
}

/*
 * Remove an entry from an intermediate node.
 */
STATIC void
xfs_da3_node_remove(
	struct xfs_da_state	*state,
	struct xfs_da_state_blk	*drop_blk)
{
	trace_xfs_da_node_remove(state->args);

	__xfs_da3_node_remove(state->args->trans, state->args->dp,
			state->args->geo, drop_blk);
}

/*
 * Remove an entry from an intermediate attr node at the specified index.
 */
void
xfs_attr3_node_entry_remove(
	struct xfs_trans	*tp,
	struct xfs_inode	*dp,
	struct xfs_buf		*bp,
	int			index)
{
	struct xfs_da_state_blk blk = {
		.index		= index,
		.bp		= bp,
	};

	__xfs_da3_node_remove(tp, dp, dp->i_mount->m_attr_geo, &blk);
}

/*
 * Unbalance the elements between two intermediate nodes,
 * move all Btree elements from one node into another.
+2 −0
Original line number Diff line number Diff line
@@ -184,6 +184,8 @@ int xfs_da3_split(xfs_da_state_t *state);
int	xfs_da3_join(xfs_da_state_t *state);
void	xfs_da3_fixhashpath(struct xfs_da_state *state,
			    struct xfs_da_state_path *path_to_to_fix);
void	xfs_attr3_node_entry_remove(struct xfs_trans *tp, struct xfs_inode *dp,
			    struct xfs_buf *bp, int index);

/*
 * Routines used for finding things in the Btree.
Loading