1. 13 2月, 2023 1 次提交
  2. 31 10月, 2022 1 次提交
    • D
      xfs: track cow/shared record domains explicitly in xfs_refcount_irec · 9a50ee4f
      Darrick J. Wong 提交于
      Just prior to committing the reflink code into upstream, the xfs
      maintainer at the time requested that I find a way to shard the refcount
      records into two domains -- one for records tracking shared extents, and
      a second for tracking CoW staging extents.  The idea here was to
      minimize mount time CoW reclamation by pushing all the CoW records to
      the right edge of the keyspace, and it was accomplished by setting the
      upper bit in rc_startblock.  We don't allow AGs to have more than 2^31
      blocks, so the bit was free.
      
      Unfortunately, this was a very late addition to the codebase, so most of
      the refcount record processing code still treats rc_startblock as a u32
      and pays no attention to whether or not the upper bit (the cow flag) is
      set.  This is a weakness is theoretically exploitable, since we're not
      fully validating the incoming metadata records.
      
      Fuzzing demonstrates practical exploits of this weakness.  If the cow
      flag of a node block key record is corrupted, a lookup operation can go
      to the wrong record block and start returning records from the wrong
      cow/shared domain.  This causes the math to go all wrong (since cow
      domain is still implicit in the upper bit of rc_startblock) and we can
      crash the kernel by tricking xfs into jumping into a nonexistent AG and
      tripping over xfs_perag_get(mp, <nonexistent AG>) returning NULL.
      
      To fix this, start tracking the domain as an explicit part of struct
      xfs_refcount_irec, adjust all refcount functions to check the domain
      of a returned record, and alter the function definitions to accept them
      where necessary.
      
      Found by fuzzing keys[2].cowflag = add in xfs/464.
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      9a50ee4f
  3. 07 7月, 2022 2 次提交
  4. 23 10月, 2021 1 次提交
  5. 20 10月, 2021 5 次提交
  6. 20 8月, 2021 2 次提交
  7. 19 8月, 2021 5 次提交
  8. 02 6月, 2021 5 次提交
  9. 29 7月, 2020 1 次提交
  10. 14 7月, 2020 1 次提交
    • G
      xfs: get rid of unnecessary xfs_perag_{get,put} pairs · 92a00544
      Gao Xiang 提交于
      In the course of some operations, we look up the perag from
      the mount multiple times to get or change perag information.
      These are often very short pieces of code, so while the
      lookup cost is generally low, the cost of the lookup is far
      higher than the cost of the operation we are doing on the
      perag.
      
      Since we changed buffers to hold references to the perag
      they are cached in, many modification contexts already hold
      active references to the perag that are held across these
      operations. This is especially true for any operation that
      is serialised by an allocation group header buffer.
      
      In these cases, we can just use the buffer's reference to
      the perag to avoid needing to do lookups to access the
      perag. This means that many operations don't need to do
      perag lookups at all to access the perag because they've
      already looked up objects that own persistent references
      and hence can use that reference instead.
      
      Cc: Dave Chinner <dchinner@redhat.com>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Signed-off-by: NGao Xiang <hsiangkao@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      92a00544
  11. 18 3月, 2020 1 次提交
  12. 14 3月, 2020 2 次提交
  13. 12 3月, 2020 1 次提交
  14. 29 6月, 2019 2 次提交
  15. 21 5月, 2019 1 次提交
    • D
      xfs: don't reserve per-AG space for an internal log · 5cd213b0
      Darrick J. Wong 提交于
      It turns out that the log can consume nearly all the space in an AG, and
      when this happens this it's possible that there will be less free space
      in the AG than the reservation would try to hide.  On a debug kernel
      this can trigger an ASSERT in xfs/250:
      
      XFS: Assertion failed: xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved + xfs_perag_resv(pag, XFS_AG_RESV_RMAPBT)->ar_reserved <= pag->pagf_freeblks + pag->pagf_flcount, file: fs/xfs/libxfs/xfs_ag_resv.c, line: 319
      
      The log is permanently allocated, so we know we're never going to have
      to expand the btrees to hold any records associated with the log space.
      We therefore can treat the space as if it doesn't exist.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NEric Sandeen <sandeen@redhat.com>
      5cd213b0
  16. 12 2月, 2019 1 次提交
  17. 13 12月, 2018 1 次提交
  18. 30 7月, 2018 1 次提交
  19. 12 7月, 2018 2 次提交
  20. 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
  21. 05 6月, 2018 1 次提交
  22. 10 4月, 2018 1 次提交
  23. 12 3月, 2018 1 次提交