Skip to content

Commit 9e00163

Browse files
lherboltcmaiolino
authored andcommitted
xfs: do not check NEEDSREPAIR if ro,norecovery mount.
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>
1 parent 6e33017 commit 9e00163

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/xfs/xfs_super.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,8 +1661,12 @@ xfs_fs_fill_super(
16611661
#endif
16621662
}
16631663

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

0 commit comments

Comments
 (0)