• Dave Chinner's avatar
    xfs: allow sunit mount option to repair bad primary sb stripe values · 15922f5d
    Dave Chinner authored
    If a filesystem has a busted stripe alignment configuration on disk
    (e.g. because broken RAID firmware told mkfs that swidth was smaller
    than sunit), then the filesystem will refuse to mount due to the
    stripe validation failing. This failure is triggering during distro
    upgrades from old kernels lacking this check to newer kernels with
    this check, and currently the only way to fix it is with offline
    xfs_db surgery.
    
    This runtime validity checking occurs when we read the superblock
    for the first time and causes the mount to fail immediately. This
    prevents the rewrite of stripe unit/width via
    mount options that occurs later in the mount process. Hence there is
    no way to recover this situation without resorting to offline xfs_db
    rewrite of the values.
    
    However, we parse the mount options long before we read the
    superblock, and we know if the mount has been asked to re-write the
    stripe alignment configuration when we are reading the superblock
    and verifying it for the first time. Hence we can conditionally
    ignore stripe verification failures if the mount options specified
    will correct the issue.
    
    We validate that the new stripe unit/width are valid before we
    overwrite the superblock values, so we can ignore the invalid config
    at verification and fail the mount later if the new values are not
    valid. This, at least, gives users the chance of correcting the
    issue after a kernel upgrade without having to resort to xfs-db
    hacks.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
    15922f5d
xfs_sb.h 1.45 KB