• Darrick J. Wong's avatar
    xfs: don't return -EFSCORRUPTED from repair when resources cannot be grabbed · 93b0c58e
    Darrick J. Wong authored
    If we tried to repair something but the repair failed with -EDEADLOCK,
    that means that the repair function couldn't grab some resource it
    needed and wants us to try again.  If we try again (with TRY_HARDER) but
    still can't get all the resources we need, the repair fails and errors
    remain on the filesystem.
    
    Right now, repair returns the -EDEADLOCK to the caller as -EFSCORRUPTED,
    which results in XFS_SCRUB_OFLAG_CORRUPT being passed out to userspace.
    This is not correct because repair has not determined that anything is
    corrupt.  If the repair had been invoked on an object that could be
    optimized but wasn't corrupt (OFLAG_PREEN), the inability to grab
    resources will be reported to userspace as corrupt metadata, and users
    will be unnecessarily alarmed that their suboptimal metadata turned into
    a corruption.
    
    Fix this by returning zero so that the results of the actual scrub will
    be copied back out to userspace.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    93b0c58e
repair.c 28.3 KB