Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 26, 2024
  2. Apr 15, 2024
  3. Feb 22, 2024
    • Darrick J. Wong's avatar
      xfs: report XFS_IS_CORRUPT errors to the health system · 989d5ec3
      Darrick J. Wong authored
      
      Whenever we encounter XFS_IS_CORRUPT failures, we should report that to
      the health monitoring system for later reporting.
      
      I started with this semantic patch and massaged everything until it
      built:
      
      @@
      expression mp, test;
      @@
      
      - if (XFS_IS_CORRUPT(mp, test)) return -EFSCORRUPTED;
      + if (XFS_IS_CORRUPT(mp, test)) { xfs_btree_mark_sick(cur); return -EFSCORRUPTED; }
      
      @@
      expression mp, test;
      identifier label, error;
      @@
      
      - if (XFS_IS_CORRUPT(mp, test)) { error = -EFSCORRUPTED; goto label; }
      + if (XFS_IS_CORRUPT(mp, test)) { xfs_btree_mark_sick(cur); error = -EFSCORRUPTED; goto label; }
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      989d5ec3
  4. Feb 19, 2024
  5. Dec 29, 2023
  6. Dec 15, 2023
    • Darrick J. Wong's avatar
      xfs: set inode sick state flags when we zap either ondisk fork · d9041681
      Darrick J. Wong authored
      
      In a few patches, we'll add some online repair code that tries to
      massage the ondisk inode record just enough to get it to pass the inode
      verifiers so that we can continue with more file repairs.  Part of that
      massaging can include zapping the ondisk forks to clear errors.  After
      that point, the bmap fork repair functions will rebuild the zapped
      forks.
      
      Christoph asked for stronger protections against online repair zapping a
      fork to get the inode to load vs. other threads trying to access the
      partially repaired file.  Do this by adding a special "[DA]FORK_ZAPPED"
      inode health flag whenever repair zaps a fork, and sprinkling checks for
      that flag into the various file operations for things that don't like
      handling an unexpected zero-extents fork.
      
      In practice xfs_scrub will scrub and fix the forks almost immediately
      after zapping them, so the window is very small.  However, if a crash or
      unmount should occur, we can still detect these zapped inode forks by
      looking for a zero-extents fork when data was expected.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      d9041681
  7. Oct 04, 2022
  8. Jul 09, 2022
  9. Jan 11, 2022
    • Darrick J. Wong's avatar
      xfs: take the ILOCK when readdir inspects directory mapping data · 65552b02
      Darrick J. Wong authored
      
      I was poking around in the directory code while diagnosing online fsck
      bugs, and noticed that xfs_readdir doesn't actually take the directory
      ILOCK when it calls xfs_dir2_isblock.  xfs_dir_open most probably loaded
      the data fork mappings and the VFS took i_rwsem (aka IOLOCK_SHARED) so
      we're protected against writer threads, but we really need to follow the
      locking model like we do in other places.
      
      To avoid unnecessarily cycling the ILOCK for fairly small directories,
      change the block/leaf _getdents functions to consume the ILOCK hold that
      the parent readdir function took to decide on a _getdents implementation.
      
      It is ok to cycle the ILOCK in readdir because the VFS takes the IOLOCK
      in the appropriate mode during lookups and writes, and we don't want to
      be holding the ILOCK when we copy directory entries to userspace in case
      there's a page fault.  We really only need it to protect against data
      fork lookups, like we do for other files.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      65552b02
  10. Aug 19, 2021
  11. Apr 15, 2021
  12. Apr 07, 2021
  13. May 19, 2020
  14. Mar 13, 2020
  15. Nov 22, 2019
  16. Nov 13, 2019
  17. Nov 10, 2019
  18. Oct 29, 2019
  19. Jun 28, 2019
  20. Jun 06, 2018
    • Dave Chinner's avatar
      xfs: convert to SPDX license tags · 0b61f8a4
      Dave Chinner authored
      
      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: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      0b61f8a4
  21. Jan 18, 2018
  22. Nov 06, 2017
  23. Oct 26, 2017