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

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

Pull xfs fixes from Darrick Wong:

 - Fix a fairly serious problem where the reverse mapping btree key
   comparison functions were silently ignoring parts of the keyspace
   when doing comparisons

 - Fix a thinko in the online refcount scrubber

 - Fix a missing unlock in the pnfs code

* tag 'xfs-5.10-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: fix a missing unlock on error in xfs_fs_map_blocks
  xfs: fix brainos in the refcount scrubber's rmap fragment processor
  xfs: fix rmap key and record comparison functions
  xfs: set the unwritten bit in rmap lookup flags in xchk_bmap_get_rmapextents
  xfs: fix flags argument to rmap lookup when converting shared file rmaps
parents b5dea9c0 2bd3fa79
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1514,7 +1514,7 @@ xfs_rmap_convert_shared(
	 * record for our insertion point. This will also give us the record for
	 * start block contiguity tests.
	 */
	error = xfs_rmap_lookup_le_range(cur, bno, owner, offset, flags,
	error = xfs_rmap_lookup_le_range(cur, bno, owner, offset, oldext,
			&PREV, &i);
	if (error)
		goto done;
+8 −8
Original line number Diff line number Diff line
@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff(
	else if (y > x)
		return -1;

	x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset));
	y = rec->rm_offset;
	x = be64_to_cpu(kp->rm_offset);
	y = xfs_rmap_irec_offset_pack(rec);
	if (x > y)
		return 1;
	else if (y > x)
@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys(
	else if (y > x)
		return -1;

	x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset));
	y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset));
	x = be64_to_cpu(kp1->rm_offset);
	y = be64_to_cpu(kp2->rm_offset);
	if (x > y)
		return 1;
	else if (y > x)
@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder(
		return 1;
	else if (a > b)
		return 0;
	a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset));
	b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset));
	a = be64_to_cpu(k1->rmap.rm_offset);
	b = be64_to_cpu(k2->rmap.rm_offset);
	if (a <= b)
		return 1;
	return 0;
@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder(
		return 1;
	else if (a > b)
		return 0;
	a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset));
	b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset));
	a = be64_to_cpu(r1->rmap.rm_offset);
	b = be64_to_cpu(r2->rmap.rm_offset);
	if (a <= b)
		return 1;
	return 0;
+2 −0
Original line number Diff line number Diff line
@@ -113,6 +113,8 @@ xchk_bmap_get_rmap(

	if (info->whichfork == XFS_ATTR_FORK)
		rflags |= XFS_RMAP_ATTR_FORK;
	if (irec->br_state == XFS_EXT_UNWRITTEN)
		rflags |= XFS_RMAP_UNWRITTEN;

	/*
	 * CoW staging extents are owned (on disk) by the refcountbt, so
+3 −5
Original line number Diff line number Diff line
@@ -170,7 +170,6 @@ xchk_refcountbt_process_rmap_fragments(
	 */
	INIT_LIST_HEAD(&worklist);
	rbno = NULLAGBLOCK;
	nr = 1;

	/* Make sure the fragments actually /are/ in agbno order. */
	bno = 0;
@@ -184,15 +183,14 @@ xchk_refcountbt_process_rmap_fragments(
	 * Find all the rmaps that start at or before the refc extent,
	 * and put them on the worklist.
	 */
	nr = 0;
	list_for_each_entry_safe(frag, n, &refchk->fragments, list) {
		if (frag->rm.rm_startblock > refchk->bno)
			goto done;
		if (frag->rm.rm_startblock > refchk->bno || nr > target_nr)
			break;
		bno = frag->rm.rm_startblock + frag->rm.rm_blockcount;
		if (bno < rbno)
			rbno = bno;
		list_move_tail(&frag->list, &worklist);
		if (nr == target_nr)
			break;
		nr++;
	}

+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ xfs_fs_map_blocks(
		goto out_unlock;
	error = invalidate_inode_pages2(inode->i_mapping);
	if (WARN_ON_ONCE(error))
		return error;
		goto out_unlock;

	end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length);
	offset_fsb = XFS_B_TO_FSBT(mp, offset);