Skip to content

Commit

Permalink
xfs: do not check NEEDSREPAIR if ro,norecovery mount.
Browse files Browse the repository at this point in the history
If there is corrutpion on the filesystem andxfs_repair
fails to repair it. The last resort of getting the data
is to use norecovery,ro mount. But if the NEEDSREPAIR is
set the filesystem cannot be mounted. The flag must be
cleared out manually using xfs_db, to get access to what
left over of the corrupted fs.

Signed-off-by: Lukas Herbolt <lukas@herbolt.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
  • Loading branch information
Lukas Herbolt authored and Carlos Maiolino committed Feb 14, 2025
1 parent 6e33017 commit 9e00163
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/xfs/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,8 +1661,12 @@ xfs_fs_fill_super(
#endif
}

/* Filesystem claims it needs repair, so refuse the mount. */
if (xfs_has_needsrepair(mp)) {
/*
* Filesystem claims it needs repair, so refuse the mount unless
* norecovery is also specified, in which case the filesystem can
* be mounted with no risk of further damage.
*/
if (xfs_has_needsrepair(mp) && !xfs_has_norecovery(mp)) {
xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair.");
error = -EFSCORRUPTED;
goto out_free_sb;
Expand Down

0 comments on commit 9e00163

Please sign in to comment.