1. 06 1月, 2023 1 次提交
    • G
      xfs: get rid of assert from xfs_btree_islastblock · 837215b2
      Guo Xuenan 提交于
      mainline inclusion
      from mainline-v6.1-rc4
      commit 8c25febf
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
      CVE: NA
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8c25febf23963431686f04874b96321288504127
      
      --------------------------------
      
      xfs_btree_check_block contains debugging knobs. With XFS_DEBUG setting up,
      turn on the debugging knob can trigger the assert of xfs_btree_islastblock,
      test script as follows:
      
      while true
      do
          mount $disk $mountpoint
          fsstress -d $testdir -l 0 -n 10000 -p 4 >/dev/null
          echo 1 > /sys/fs/xfs/sda/errortag/btree_chk_sblk
          sleep 10
          umount $mountpoint
      done
      
      Kick off fsstress and only *then* turn on the debugging knob. If it
      happens that the knob gets turned on after the cntbt lookup succeeds
      but before the call to xfs_btree_islastblock, then we *can* end up in
      the situation where a previously checked btree block suddenly starts
      returning EFSCORRUPTED from xfs_btree_check_block. Kaboom.
      
      Darrick give a very detailed explanation as follows:
      Looking back at commit 27d9ee57, I think the point of all this was
      to make sure that the cursor has actually performed a lookup, and that
      the btree block at whatever level we're asking about is ok.
      
      If the caller hasn't ever done a lookup, the bc_levels array will be
      empty, so cur->bc_levels[level].bp pointer will be NULL.  The call to
      xfs_btree_get_block will crash anyway, so the "ASSERT(block);" part is
      pointless.
      
      If the caller did a lookup but the lookup failed due to block
      corruption, the corresponding cur->bc_levels[level].bp pointer will also
      be NULL, and we'll still crash.  The "ASSERT(xfs_btree_check_block);"
      logic is also unnecessary.
      
      If the cursor level points to an inode root, the block buffer will be
      incore, so it had better always be consistent.
      
      If the caller ignores a failed lookup after a successful one and calls
      this function, the cursor state is garbage and the assert wouldn't have
      tripped anyway. So get rid of the assert.
      
      Fixes: 27d9ee57 ("xfs: actually check xfs_btree_check_block return in xfs_btree_islastblock")
      Signed-off-by: NGuo Xuenan <guoxuenan@huawei.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NGuo Xuenan <guoxuenan@huawei.com>
      Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      (cherry picked from commit be18cd15)
      837215b2
  2. 14 5月, 2020 1 次提交
  3. 18 3月, 2020 3 次提交
    • D
      xfs: support bulk loading of staged btrees · 60e3d707
      Darrick J. Wong 提交于
      Add a new btree function that enables us to bulk load a btree cursor.
      This will be used by the upcoming online repair patches to generate new
      btrees.  This avoids the programmatic inefficiency of calling
      xfs_btree_insert in a loop (which generates a lot of log traffic) in
      favor of stamping out new btree blocks with ordered buffers, and then
      committing both the new root and scheduling the removal of the old btree
      blocks in a single transaction commit.
      
      The design of this new generic code is based off the btree rebuilding
      code in xfs_repair's phase 5 code, with the explicit goal of enabling us
      to share that code between scrub and repair.  It has the additional
      feature of being able to control btree block loading factors.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      60e3d707
    • D
      xfs: introduce fake roots for inode-rooted btrees · 349e1c03
      Darrick J. Wong 提交于
      Create an in-core fake root for inode-rooted btree types so that callers
      can generate a whole new btree using the upcoming btree bulk load
      function without making the new tree accessible from the rest of the
      filesystem.  It is up to the individual btree type to provide a function
      to create a staged cursor (presumably with the appropriate callouts to
      update the fakeroot) and then commit the staged root back into the
      filesystem.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      349e1c03
    • D
      xfs: introduce fake roots for ag-rooted btrees · e06536a6
      Darrick J. Wong 提交于
      Create an in-core fake root for AG-rooted btree types so that callers
      can generate a whole new btree using the upcoming btree bulk load
      function without making the new tree accessible from the rest of the
      filesystem.  It is up to the individual btree type to provide a function
      to create a staged cursor (presumably with the appropriate callouts to
      update the fakeroot) and then commit the staged root back into the
      filesystem.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      e06536a6
  4. 14 3月, 2020 5 次提交
  5. 27 1月, 2020 1 次提交
  6. 12 11月, 2019 1 次提交
  7. 30 10月, 2019 1 次提交
  8. 22 10月, 2019 1 次提交
  9. 31 8月, 2019 1 次提交
  10. 30 8月, 2019 1 次提交
  11. 03 7月, 2019 1 次提交
  12. 13 6月, 2019 1 次提交
  13. 03 8月, 2018 1 次提交
  14. 12 7月, 2018 3 次提交
  15. 07 6月, 2018 1 次提交
    • D
      xfs: convert to SPDX license tags · 0b61f8a4
      Dave Chinner 提交于
      Remove the verbose license text from XFS files and replace them
      with SPDX tags. This does not change the license of any of the code,
      merely refers to the common, up-to-date license files in LICENSES/
      
      This change was mostly scripted. fs/xfs/Makefile and
      fs/xfs/libxfs/xfs_fs.h were modified by hand, the rest were detected
      and modified by the following command:
      
      for f in `git grep -l "GNU General" fs/xfs/` ; do
      	echo $f
      	cat $f | awk -f hdr.awk > $f.new
      	mv -f $f.new $f
      done
      
      And the hdr.awk script that did the modification (including
      detecting the difference between GPL-2.0 and GPL-2.0+ licenses)
      is as follows:
      
      $ cat hdr.awk
      BEGIN {
      	hdr = 1.0
      	tag = "GPL-2.0"
      	str = ""
      }
      
      /^ \* This program is free software/ {
      	hdr = 2.0;
      	next
      }
      
      /any later version./ {
      	tag = "GPL-2.0+"
      	next
      }
      
      /^ \*\// {
      	if (hdr > 0.0) {
      		print "// SPDX-License-Identifier: " tag
      		print str
      		print $0
      		str=""
      		hdr = 0.0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \* / {
      	if (hdr > 1.0)
      		next
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \*/ {
      	if (hdr > 0.0)
      		next
      	print $0
      	next
      }
      
      // {
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	print $0
      }
      
      END { }
      $
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      0b61f8a4
  16. 16 5月, 2018 2 次提交
  17. 10 4月, 2018 1 次提交
  18. 12 3月, 2018 1 次提交
  19. 18 1月, 2018 1 次提交
  20. 09 1月, 2018 3 次提交
  21. 28 10月, 2017 1 次提交
  22. 27 10月, 2017 3 次提交
  23. 02 9月, 2017 1 次提交
    • B
      xfs: skip bmbt block ino validation during owner change · 99c794c6
      Brian Foster 提交于
      Extent swap uses xfs_btree_visit_blocks() to fix up bmbt block
      owners on v5 (!rmapbt) filesystems. The bmbt scan uses
      xfs_btree_lookup_get_block() to read bmbt blocks which verifies the
      current owner of the block against the parent inode of the bmbt.
      This works during extent swap because the bmbt owners are updated to
      the opposite inode number before the inode extent forks are swapped.
      
      The modified bmbt blocks are marked as ordered buffers which allows
      everything to commit in a single transaction. If the transaction
      commits to the log and the system crashes such that recovery of the
      extent swap is required, log recovery restarts the bmbt scan to fix
      up any bmbt blocks that may have not been written back before the
      crash. The log recovery bmbt scan occurs after the inode forks have
      been swapped, however. This causes the bmbt block owner verification
      to fail, leads to log recovery failure and requires xfs_repair to
      zap the log to recover.
      
      Define a new invalid inode owner flag to inform the btree block
      lookup mechanism that the current inode may be invalid with respect
      to the current owner of the bmbt block. Set this flag on the cursor
      used for change owner scans to allow this operation to work at
      runtime and during log recovery.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Fixes: bb3be7e7 ("xfs: check for bogus values in btree block headers")
      Cc: stable@vger.kernel.org
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      99c794c6
  24. 20 6月, 2017 3 次提交
  25. 04 4月, 2017 1 次提交