• 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
health.h 612 Bytes