提交 d9315f56 编写于 作者: L Linus Torvalds

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
...@@ -1514,7 +1514,7 @@ xfs_rmap_convert_shared( ...@@ -1514,7 +1514,7 @@ xfs_rmap_convert_shared(
* record for our insertion point. This will also give us the record for * record for our insertion point. This will also give us the record for
* start block contiguity tests. * 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); &PREV, &i);
if (error) if (error)
goto done; goto done;
......
...@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff( ...@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff(
else if (y > x) else if (y > x)
return -1; return -1;
x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset)); x = be64_to_cpu(kp->rm_offset);
y = rec->rm_offset; y = xfs_rmap_irec_offset_pack(rec);
if (x > y) if (x > y)
return 1; return 1;
else if (y > x) else if (y > x)
...@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys( ...@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys(
else if (y > x) else if (y > x)
return -1; return -1;
x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset)); x = be64_to_cpu(kp1->rm_offset);
y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset)); y = be64_to_cpu(kp2->rm_offset);
if (x > y) if (x > y)
return 1; return 1;
else if (y > x) else if (y > x)
...@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder( ...@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder(
return 1; return 1;
else if (a > b) else if (a > b)
return 0; return 0;
a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset)); a = be64_to_cpu(k1->rmap.rm_offset);
b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset)); b = be64_to_cpu(k2->rmap.rm_offset);
if (a <= b) if (a <= b)
return 1; return 1;
return 0; return 0;
...@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder( ...@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder(
return 1; return 1;
else if (a > b) else if (a > b)
return 0; return 0;
a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset)); a = be64_to_cpu(r1->rmap.rm_offset);
b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset)); b = be64_to_cpu(r2->rmap.rm_offset);
if (a <= b) if (a <= b)
return 1; return 1;
return 0; return 0;
......
...@@ -113,6 +113,8 @@ xchk_bmap_get_rmap( ...@@ -113,6 +113,8 @@ xchk_bmap_get_rmap(
if (info->whichfork == XFS_ATTR_FORK) if (info->whichfork == XFS_ATTR_FORK)
rflags |= XFS_RMAP_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 * CoW staging extents are owned (on disk) by the refcountbt, so
......
...@@ -170,7 +170,6 @@ xchk_refcountbt_process_rmap_fragments( ...@@ -170,7 +170,6 @@ xchk_refcountbt_process_rmap_fragments(
*/ */
INIT_LIST_HEAD(&worklist); INIT_LIST_HEAD(&worklist);
rbno = NULLAGBLOCK; rbno = NULLAGBLOCK;
nr = 1;
/* Make sure the fragments actually /are/ in agbno order. */ /* Make sure the fragments actually /are/ in agbno order. */
bno = 0; bno = 0;
...@@ -184,15 +183,14 @@ xchk_refcountbt_process_rmap_fragments( ...@@ -184,15 +183,14 @@ xchk_refcountbt_process_rmap_fragments(
* Find all the rmaps that start at or before the refc extent, * Find all the rmaps that start at or before the refc extent,
* and put them on the worklist. * and put them on the worklist.
*/ */
nr = 0;
list_for_each_entry_safe(frag, n, &refchk->fragments, list) { list_for_each_entry_safe(frag, n, &refchk->fragments, list) {
if (frag->rm.rm_startblock > refchk->bno) if (frag->rm.rm_startblock > refchk->bno || nr > target_nr)
goto done; break;
bno = frag->rm.rm_startblock + frag->rm.rm_blockcount; bno = frag->rm.rm_startblock + frag->rm.rm_blockcount;
if (bno < rbno) if (bno < rbno)
rbno = bno; rbno = bno;
list_move_tail(&frag->list, &worklist); list_move_tail(&frag->list, &worklist);
if (nr == target_nr)
break;
nr++; nr++;
} }
......
...@@ -134,7 +134,7 @@ xfs_fs_map_blocks( ...@@ -134,7 +134,7 @@ xfs_fs_map_blocks(
goto out_unlock; goto out_unlock;
error = invalidate_inode_pages2(inode->i_mapping); error = invalidate_inode_pages2(inode->i_mapping);
if (WARN_ON_ONCE(error)) if (WARN_ON_ONCE(error))
return error; goto out_unlock;
end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length); end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length);
offset_fsb = XFS_B_TO_FSBT(mp, offset); offset_fsb = XFS_B_TO_FSBT(mp, offset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册