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

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

Pull xfs fixes from Carlos Maiolino:
 "This contains a few fixes for zoned devices support, an UAF and a
  compiler warning, and some cleaning up"

* tag 'xfs-fixes-6.19-rc2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: fix the zoned RT growfs check for zone alignment
  xfs: validate that zoned RT devices are zone aligned
  xfs: fix XFS_ERRTAG_FORCE_ZERO_RANGE for zoned file system
  xfs: fix a memory leak in xfs_buf_item_init()
  xfs: fix stupid compiler warning
  xfs: fix a UAF problem in xattr repair
  xfs: ignore discard return value
parents f0ae3a50 dc68c0f6
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -301,6 +301,21 @@ xfs_validate_rt_geometry(
	    sbp->sb_rbmblocks != xfs_expected_rbmblocks(sbp))
		return false;

	if (xfs_sb_is_v5(sbp) &&
	    (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_ZONED)) {
		uint32_t		mod;

		/*
		 * Zoned RT devices must be aligned to the RT group size,
		 * because garbage collection assumes that all zones have the
		 * same size to avoid insane complexity if that weren't the
		 * case.
		 */
		div_u64_rem(sbp->sb_rextents, sbp->sb_rgextents, &mod);
		if (mod)
			return false;
	}

	return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,6 @@ xrep_xattr_salvage_remote_attr(
		.attr_filter		= ent->flags & XFS_ATTR_NSP_ONDISK_MASK,
		.namelen		= rentry->namelen,
		.name			= rentry->name,
		.value			= ab->value,
		.valuelen		= be32_to_cpu(rentry->valuelen),
	};
	unsigned int			namesize;
@@ -363,6 +362,7 @@ xrep_xattr_salvage_remote_attr(
		error = -EDEADLOCK;
	if (error)
		return error;
	args.value = ab->value;

	/* Look up the remote value and stash it for reconstruction. */
	error = xfs_attr3_leaf_getvalue(leaf_bp, &args);
+1 −1
Original line number Diff line number Diff line
@@ -737,7 +737,7 @@ xfs_attr_recover_work(
	struct xfs_attri_log_item	*attrip = ATTRI_ITEM(lip);
	struct xfs_attr_intent		*attr;
	struct xfs_mount		*mp = lip->li_log->l_mp;
	struct xfs_inode		*ip;
	struct xfs_inode		*ip = NULL;
	struct xfs_da_args		*args;
	struct xfs_trans		*tp;
	struct xfs_trans_res		resv;
+1 −0
Original line number Diff line number Diff line
@@ -896,6 +896,7 @@ xfs_buf_item_init(
		map_size = DIV_ROUND_UP(chunks, NBWORD);

		if (map_size > XFS_BLF_DATAMAP_SIZE) {
			xfs_buf_item_free_format(bip);
			kmem_cache_free(xfs_buf_item_cache, bip);
			xfs_err(mp,
	"buffer item dirty bitmap (%u uints) too small to reflect %u bytes!",
+5 −22
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ xfs_discard_endio(
 * list. We plug and chain the bios so that we only need a single completion
 * call to clear all the busy extents once the discards are complete.
 */
int
void
xfs_discard_extents(
	struct xfs_mount	*mp,
	struct xfs_busy_extents	*extents)
@@ -116,7 +116,6 @@ xfs_discard_extents(
	struct xfs_extent_busy	*busyp;
	struct bio		*bio = NULL;
	struct blk_plug		plug;
	int			error = 0;

	blk_start_plug(&plug);
	list_for_each_entry(busyp, &extents->extent_list, list) {
@@ -126,18 +125,10 @@ xfs_discard_extents(

		trace_xfs_discard_extent(xg, busyp->bno, busyp->length);

		error = __blkdev_issue_discard(btp->bt_bdev,
		__blkdev_issue_discard(btp->bt_bdev,
				xfs_gbno_to_daddr(xg, busyp->bno),
				XFS_FSB_TO_BB(mp, busyp->length),
				GFP_KERNEL, &bio);
		if (error && error != -EOPNOTSUPP) {
			xfs_info(mp,
	 "discard failed for extent [0x%llx,%u], error %d",
				 (unsigned long long)busyp->bno,
				 busyp->length,
				 error);
			break;
		}
	}

	if (bio) {
@@ -148,8 +139,6 @@ xfs_discard_extents(
		xfs_discard_endio_work(&extents->endio_work);
	}
	blk_finish_plug(&plug);

	return error;
}

/*
@@ -385,9 +374,7 @@ xfs_trim_perag_extents(
		 * list  after this function call, as it may have been freed by
		 * the time control returns to us.
		 */
		error = xfs_discard_extents(pag_mount(pag), extents);
		if (error)
			break;
		xfs_discard_extents(pag_mount(pag), extents);

		if (xfs_trim_should_stop())
			break;
@@ -496,12 +483,10 @@ xfs_discard_rtdev_extents(

		trace_xfs_discard_rtextent(mp, busyp->bno, busyp->length);

		error = __blkdev_issue_discard(bdev,
		__blkdev_issue_discard(bdev,
				xfs_rtb_to_daddr(mp, busyp->bno),
				XFS_FSB_TO_BB(mp, busyp->length),
				GFP_NOFS, &bio);
		if (error)
			break;
	}
	xfs_discard_free_rtdev_extents(tr);

@@ -741,9 +726,7 @@ xfs_trim_rtgroup_extents(
		 * list  after this function call, as it may have been freed by
		 * the time control returns to us.
		 */
		error = xfs_discard_extents(rtg_mount(rtg), tr.extents);
		if (error)
			break;
		xfs_discard_extents(rtg_mount(rtg), tr.extents);

		low = tr.restart_rtx;
	} while (!xfs_trim_should_stop() && low <= high);
Loading