[08/10] debugfs: Allow fixing superblock errors in catastrophic mode

Message ID 20180530125118.25274-9-jack@suse.cz
State New
Headers show
Series
  • e2fsprogs: Handle s_inodes_count overflow better
Related show

Commit Message

Jan Kara May 30, 2018, 12:51 p.m.
Open filesystem with EXT2_FLAG_IGNORE_SB_ERRORS flag in catastrophic
mode so that superblock errors can be fixed in debugfs.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 debugfs/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Dilger June 4, 2018, 4:52 a.m. | #1
On May 30, 2018, at 6:51 AM, Jan Kara <jack@suse.cz> wrote:
> 
> Open filesystem with EXT2_FLAG_IGNORE_SB_ERRORS flag in catastrophic
> mode so that superblock errors can be fixed in debugfs.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> debugfs/debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
> index b1842443aa8e..51e3783bfa86 100644
> --- a/debugfs/debugfs.c
> +++ b/debugfs/debugfs.c
> @@ -160,7 +160,7 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
> 	}
> 
> 	if (catastrophic)
> -		open_flags |= EXT2_FLAG_SKIP_MMP;
> +		open_flags |= EXT2_FLAG_SKIP_MMP | EXT2_FLAG_IGNORE_SB_ERRORS;
> 
> 	if (undo_file) {
> 		retval = debugfs_setup_tdb(device, undo_file, &io_ptr);
> --
> 2.13.6
> 


Cheers, Andreas

Patch

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index b1842443aa8e..51e3783bfa86 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -160,7 +160,7 @@  static void open_filesystem(char *device, int open_flags, blk64_t superblock,
 	}
 
 	if (catastrophic)
-		open_flags |= EXT2_FLAG_SKIP_MMP;
+		open_flags |= EXT2_FLAG_SKIP_MMP | EXT2_FLAG_IGNORE_SB_ERRORS;
 
 	if (undo_file) {
 		retval = debugfs_setup_tdb(device, undo_file, &io_ptr);