diff options
author | Theodore Ts'o <tytso@mit.edu> | 2023-01-27 12:42:47 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2023-01-27 12:42:47 -0500 |
commit | 8f4f9f0ec5bd53973043bced10e57b471db32632 (patch) | |
tree | 77b0d63c1ef23c9730c2c67a685534e5bc8cc2a1 /misc/tune2fs.c | |
parent | d37a9f1818fa04fc91a497b3541ed205804720af (diff) | |
parent | 9fd9c75204c5c1c021fa9911b787e62e9657802e (diff) | |
download | e2fsprogs-8f4f9f0ec5bd53973043bced10e57b471db32632.tar.gz |
Merge branch 'maint' into next
Diffstat (limited to 'misc/tune2fs.c')
-rw-r--r-- | misc/tune2fs.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 088f87e5..5fe22e6a 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -960,7 +960,7 @@ static void rewrite_inodes(ext2_filsys fs, unsigned int flags) ext2fs_free_mem(&ctx.ea_buf); } -static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags) +static errcode_t rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags) { errcode_t retval; dgrp_t i; @@ -975,7 +975,9 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags) rewrite_inodes(fs, flags); ext2fs_mark_ib_dirty(fs); ext2fs_mark_bb_dirty(fs); - ext2fs_mmp_update2(fs, 1); + retval = ext2fs_mmp_update2(fs, 1); + if (retval) + return retval; fs->flags &= ~EXT2_FLAG_SUPER_ONLY; fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; if (ext2fs_has_feature_metadata_csum(fs->super)) @@ -983,6 +985,7 @@ static void rewrite_metadata_checksums(ext2_filsys fs, unsigned int flags) else fs->super->s_checksum_type = 0; ext2fs_mark_super_dirty(fs); + return 0; } static void enable_uninit_bg(ext2_filsys fs) @@ -3343,7 +3346,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" if (retval) { com_err("tune2fs", retval, "while recovering journal.\n"); - printf(_("Please run e2fsck -fy %s.\n"), argv[1]); + printf(_("Please run e2fsck -fy %s.\n"), device_name); + if (!fs) + exit(1); rc = 1; goto closefs; } @@ -3703,8 +3708,14 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" } } - if (rewrite_checksums) - rewrite_metadata_checksums(fs, rewrite_checksums); + if (rewrite_checksums) { + retval = rewrite_metadata_checksums(fs, rewrite_checksums); + if (retval != 0) { + printf("Failed to rewrite metadata checksums\n"); + rc = 1; + goto closefs; + } + } if (l_flag) list_super(sb); @@ -3745,5 +3756,13 @@ closefs: if (feature_64bit) convert_64bit(fs, feature_64bit); - return (ext2fs_close_free(&fs) ? 1 : rc); + + retval = ext2fs_close_free(&fs); + if (retval) { + com_err("tune2fs", retval, + _("while writing out and closing file system")); + rc = 1; + } + + return rc; } |