Commit b8f1fa24 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull xfs fixes from Chandan Babu:

 - Fix deadlock arising due to intent items in AIL not being cleared
   when log recovery fails

 - Fix stale data exposure bug when remapping COW fork extents to data
   fork

 - Fix deadlock when data device flush fails

 - Fix AGFL minimum size calculation

 - Select DEBUG_FS instead of XFS_DEBUG when XFS_ONLINE_SCRUB_STATS is
   selected

 - Fix corruption of log inode's extent count field when NREXT64 feature
   is enabled

* tag 'xfs-6.7-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: recovery should not clear di_flushiter unconditionally
  xfs: inode recovery does not validate the recovered inode
  xfs: fix again select in kconfig XFS_ONLINE_SCRUB_STATS
  xfs: fix internal error from AGFL exhaustion
  xfs: up(ic_sema) if flushing data device fails
  xfs: only remap the written blocks in xfs_reflink_end_cow_extent
  XFS: Update MAINTAINERS to catch all XFS documentation
  xfs: abort intent items when recovery intents fail
  xfs: factor out xfs_defer_pending_abort
parents bb28378a 7930d9e1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -23882,8 +23882,7 @@ T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
P:	Documentation/filesystems/xfs-maintainer-entry-profile.rst
F:	Documentation/ABI/testing/sysfs-fs-xfs
F:	Documentation/admin-guide/xfs.rst
F:	Documentation/filesystems/xfs-delayed-logging-design.rst
F:	Documentation/filesystems/xfs-self-describing-metadata.rst
F:	Documentation/filesystems/xfs-*
F:	fs/xfs/
F:	include/uapi/linux/dqblk_xfs.h
F:	include/uapi/linux/fsmap.h
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ config XFS_ONLINE_SCRUB_STATS
	bool "XFS online metadata check usage data collection"
	default y
	depends on XFS_ONLINE_SCRUB
	select XFS_DEBUG
	select DEBUG_FS
	help
	  If you say Y here, the kernel will gather usage data about
	  the online metadata check subsystem.  This includes the number
+24 −3
Original line number Diff line number Diff line
@@ -2275,16 +2275,37 @@ xfs_alloc_min_freelist(

	ASSERT(mp->m_alloc_maxlevels > 0);

	/*
	 * For a btree shorter than the maximum height, the worst case is that
	 * every level gets split and a new level is added, then while inserting
	 * another entry to refill the AGFL, every level under the old root gets
	 * split again. This is:
	 *
	 *   (full height split reservation) + (AGFL refill split height)
	 * = (current height + 1) + (current height - 1)
	 * = (new height) + (new height - 2)
	 * = 2 * new height - 2
	 *
	 * For a btree of maximum height, the worst case is that every level
	 * under the root gets split, then while inserting another entry to
	 * refill the AGFL, every level under the root gets split again. This is
	 * also:
	 *
	 *   2 * (current height - 1)
	 * = 2 * (new height - 1)
	 * = 2 * new height - 2
	 */

	/* space needed by-bno freespace btree */
	min_free = min_t(unsigned int, levels[XFS_BTNUM_BNOi] + 1,
				       mp->m_alloc_maxlevels);
				       mp->m_alloc_maxlevels) * 2 - 2;
	/* space needed by-size freespace btree */
	min_free += min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1,
				       mp->m_alloc_maxlevels);
				       mp->m_alloc_maxlevels) * 2 - 2;
	/* space needed reverse mapping used space btree */
	if (xfs_has_rmapbt(mp))
		min_free += min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1,
						mp->m_rmap_maxlevels);
						mp->m_rmap_maxlevels) * 2 - 2;

	return min_free;
}
+18 −10
Original line number Diff line number Diff line
@@ -245,21 +245,18 @@ xfs_defer_create_intents(
	return ret;
}

/* Abort all the intents that were committed. */
STATIC void
xfs_defer_trans_abort(
	struct xfs_trans		*tp,
	struct list_head		*dop_pending)
xfs_defer_pending_abort(
	struct xfs_mount		*mp,
	struct list_head		*dop_list)
{
	struct xfs_defer_pending	*dfp;
	const struct xfs_defer_op_type	*ops;

	trace_xfs_defer_trans_abort(tp, _RET_IP_);

	/* Abort intent items that don't have a done item. */
	list_for_each_entry(dfp, dop_pending, dfp_list) {
	list_for_each_entry(dfp, dop_list, dfp_list) {
		ops = defer_op_types[dfp->dfp_type];
		trace_xfs_defer_pending_abort(tp->t_mountp, dfp);
		trace_xfs_defer_pending_abort(mp, dfp);
		if (dfp->dfp_intent && !dfp->dfp_done) {
			ops->abort_intent(dfp->dfp_intent);
			dfp->dfp_intent = NULL;
@@ -267,6 +264,16 @@ xfs_defer_trans_abort(
	}
}

/* Abort all the intents that were committed. */
STATIC void
xfs_defer_trans_abort(
	struct xfs_trans		*tp,
	struct list_head		*dop_pending)
{
	trace_xfs_defer_trans_abort(tp, _RET_IP_);
	xfs_defer_pending_abort(tp->t_mountp, dop_pending);
}

/*
 * Capture resources that the caller said not to release ("held") when the
 * transaction commits.  Caller is responsible for zero-initializing @dres.
@@ -756,12 +763,13 @@ xfs_defer_ops_capture(

/* Release all resources that we used to capture deferred ops. */
void
xfs_defer_ops_capture_free(
xfs_defer_ops_capture_abort(
	struct xfs_mount		*mp,
	struct xfs_defer_capture	*dfc)
{
	unsigned short			i;

	xfs_defer_pending_abort(mp, &dfc->dfc_dfops);
	xfs_defer_cancel_list(mp, &dfc->dfc_dfops);

	for (i = 0; i < dfc->dfc_held.dr_bufs; i++)
@@ -802,7 +810,7 @@ xfs_defer_ops_capture_and_commit(
	/* Commit the transaction and add the capture structure to the list. */
	error = xfs_trans_commit(tp);
	if (error) {
		xfs_defer_ops_capture_free(mp, dfc);
		xfs_defer_ops_capture_abort(mp, dfc);
		return error;
	}

+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ int xfs_defer_ops_capture_and_commit(struct xfs_trans *tp,
		struct list_head *capture_list);
void xfs_defer_ops_continue(struct xfs_defer_capture *d, struct xfs_trans *tp,
		struct xfs_defer_resources *dres);
void xfs_defer_ops_capture_free(struct xfs_mount *mp,
void xfs_defer_ops_capture_abort(struct xfs_mount *mp,
		struct xfs_defer_capture *d);
void xfs_defer_resources_rele(struct xfs_defer_resources *dres);

Loading