Permalink
Commits on Sep 30, 2017
  1. xfs_scrub: integrate services with systemd

    djwong committed Sep 27, 2017
    Create a systemd service unit so that we can run the online scrubber
    under systemd with (somewhat) appropriate containment.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  2. xfs_scrub: create a script to scrub all xfs filesystems

    djwong committed Sep 27, 2017
    Create an xfs_scrub_all command to find all XFS filesystems
    and run an online scrub against them all.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  3. xfs_scrub: progress indicator

    djwong committed Sep 27, 2017
    Implement a progress indicator.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  4. xfs_scrub: warn about normalized Unicode name collisions

    djwong committed Sep 27, 2017
    Iterate all directory and xattr names to look for name collisions
    amongst Unicode normalized names.  This is generally a sign of buggy
    programs or malicious duplicate files.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  5. xfs_scrub: fstrim the free areas if there are no errors on the filesy…

    djwong committed Sep 27, 2017
    …stem
    
    If the filesystem scan comes out clean or fixes all the problems, call
    fstrim to clean out the free areas (if it's an ssd/thinp/whatever).
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Commits on Sep 28, 2017
  1. xfs_scrub: schedule and manage repairs to the filesystem

    djwong committed Sep 27, 2017
    Teach xfs_scrub to remember scrub requests that failed (or indicated
    that optimization is a possibility) as repair requests that can be
    deferred until later.  Add a new repair phase that deals with the
    repair requests.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  2. xfs_scrub: wire up repair ioctl

    djwong committed Sep 27, 2017
    Create the mechanism we need to actually call the kernel's online repair
    functionality.  The interface will consume a repair description; the
    descriptor management will follow in the next patch.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  3. xfs_scrub: check summary counters

    djwong committed Sep 27, 2017
    Make sure the filesystem summary counters are somewhat close to what
    we can find by scanning the filesystem.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  4. xfs_scrub: optionally use SCSI READ VERIFY commands to scrub data blo…

    djwong committed Sep 27, 2017
    …cks on disk
    
    If we sense that we're talking to a raw SCSI disk, use the SCSI READ
    VERIFY command to ask the disk to verify a disk internally.  This can
    sharply reduce the runtime of the data block verification phase on
    devices whose internal bandwidth exceeds their link bandwidth.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  5. xfs_scrub: scrub file data blocks

    djwong committed Sep 27, 2017
    Read all data blocks from the disk, hoping to catch IO errors.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  6. xfs_scrub: create iterator wrappers for block and fs space map ioctls

    djwong committed Sep 27, 2017
    Create a couple of functions to iterate a file's block map or the
    filesystem's space map.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  7. xfs_scrub: create infrastructure to read verify data blocks

    djwong committed Sep 27, 2017
    Manage the scheduling, issuance, and reporting of data block
    verification reads.  This enables us to combine adjacent (or nearly
    adjacent) read requests, and to take advantage of high-IOPS devices by
    issuing IO from multiple threads.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  8. xfs_scrub: create a bitmap data structure

    djwong committed Sep 27, 2017
    Create an efficient tree-based bitmap data structure.  We will use this
    during the data block scan to record the LBAs of IO errors so that we
    can report broken files to userspace.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  9. xfs_scrub: thread-safe stats counter

    djwong committed Sep 27, 2017
    Create a threaded stats counter that we'll use to track scan progress.
    This includes things like how much of the disk blocks we've scanned,
    or later how much progress we've made in each phase.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  10. xfs_scrub: check directory connectivity

    djwong committed Sep 27, 2017
    Opening directories by file handle will cause the kernel to perform
    parent lookups all the way to the root directory.  Take advantage of
    this to ensure that directories actually connect to the root.  Some
    day we'll have parent pointers and can make this more comprehensive.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  11. xfs_scrub: scan inodes

    djwong committed Sep 27, 2017
    Scan all the inodes in the system for problems.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  12. xfs_scrub: scan filesystem and AG metadata

    djwong committed Sep 27, 2017
    Scrub the filesystem and per-AG metadata.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  13. xfs_scrub: find XFS filesystem geometry

    djwong committed Sep 27, 2017
    Discover the geometry of the XFS filesystem that we've been told to
    scan, and set up some common functions that will be used by the
    scrub phases.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  14. xfs_scrub: bind to a mount point and a block device

    djwong committed Sep 27, 2017
    Create an abstraction to handle all of our low level disk operations,
    then use it to bind to a fs mount point and block device.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  15. xfs_scrub: dispatch the various phases of the scrub program

    djwong committed Sep 27, 2017
    Create the dispatching routines that we'll use to call out to each
    separate phase of the program.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  16. xfs_scrub: set up command line argument parsing

    djwong committed Sep 27, 2017
    Parse command line options in order to set up the context in which we
    will scrub the filesystem.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  17. xfs_scrub: common error handling

    djwong committed Sep 27, 2017
    Standardize how we record and report errors.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  18. xfs_scrub: create online filesystem scrub program

    djwong committed Sep 27, 2017
    Create the foundations of a filesystem scrubbing tool that asks the
    kernel to inspect all metadata in the filesystem and (ultimately) to
    repair anything that's broken.  Also create the man page for the
    utility.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  19. man: describe the metadata scrubbing ioctl

    djwong committed Sep 27, 2017
    Document the XFS-specific metadata scrub/repair ioctl's behavior,
    arguments, and side effects.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  20. xfs_io: provide an interface to the scrub ioctls

    djwong committed Sep 27, 2017
    Create a new xfs_io command to call the new XFS metadata scrub ioctl.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  21. xfs_repair: rebuild bmbt from rmapbt data

    djwong committed Sep 27, 2017
    Use rmap records to rebuild corrupt inode forks instead of zapping
    the whole inode.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  22. xfs_repair: push inode buf and dinode pointers all the way to inode f…

    djwong committed Sep 27, 2017
    …ork processing
    
    Currently, the process_dinode* family of functions assume that they have
    the buffer backing the inodes locked, and therefore the dinode pointer
    won't ever change.  However, the bmbt rebuilding code in the next patch
    will violate that assumption, so we must pass pointers to the inobp and
    the dinode pointer (that is to say, double pointers) all the way through
    to process_inode_{data,attr}_fork so that we can regrab the buffer after
    the rebuilding step finishes.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  23. xfs: add BMAPI_NORMAP flag to perform block remapping without updatin…

    djwong committed Sep 27, 2017
    …g rmpabt
    
    Add a new flag, XFS_BMAPI_NORMAP, which will perform file block
    remapping without updating the rmapbt.  This will be used by the repair
    code to reconstruct bmbts from the rmapbt, in which case we don't want
    the rmapbt update.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  24. xfs: add repair helpers for the reference count btree

    djwong committed Sep 27, 2017
    Add a couple of functions to the refcount btree and generic btree code
    that will be used to repair the refcountbt.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  25. xfs: add repair helpers for the reverse mapping btree

    djwong committed Sep 27, 2017
    Add a couple of functions to the reverse mapping btree that will be used
    to repair the rmapbt.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  26. xfs: expose various functions to repair code

    djwong committed Sep 27, 2017
    Expose various helpers that the repair code will want to use.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  27. xfs: add helpers to calculate btree size

    djwong committed Sep 27, 2017
    Add a bunch of helper functions that calculate the sizes of various
    btrees.  These will be used to repair btrees and btree headers.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  28. xfs: scrub should cross-reference the realtime bitmap

    djwong committed Sep 27, 2017
    While we're scrubbing various btrees, cross-reference the records
    with the other metadata.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  29. xfs: add scrub cross-referencing helpers for the refcount btrees

    djwong committed Sep 27, 2017
    Add a couple of functions to the refcount btrees that will be used
    to cross-reference metadata against the refcountbt.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  30. xfs: add scrub cross-referencing helpers for the rmap btrees

    djwong committed Sep 27, 2017
    Add a couple of functions to the rmap btrees that will be used
    to cross-reference metadata against the rmapbt.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>