* [PATCH v2] tune2fs: warn if the filesystem journal is dirty
@ 2015-11-25 0:07 Andreas Dilger
2015-11-30 17:14 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Dilger @ 2015-11-25 0:07 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4, Jim Garlick, Andreas Dilger
From: Jim Garlick <garlick@llnl.gov>
Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings changes in the superblock to be reverted
when the journal is replayed if it contains an uncommitted copy of
the superblock. Print a warning if this is detected so that the
user isn't surprised if it happens.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Updated message printed to include steps to replay journal.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
misc/tune2fs.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index cd1d17f..aed0a35 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -2406,6 +2406,18 @@ retry_open:
ext_mount_opts);
free(ext_mount_opts);
}
+
+ /* Warn if file system needs recovery and it is opened for writing. */
+ if ((open_flag & EXT2_FLAG_RW) && !(mount_flags & EXT2_MF_MOUNTED) &&
+ (sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+ (sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_RECOVER)) {
+ fprintf(stderr,
+_("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
+ "\te2fsck -E journal_only %s\n\n"
+ "then rerun this command. Otherwise, any changes made may be overwritten\n"
+ "by journal recovery.\n"), device_name);
+ }
+
free(device_name);
remove_error_table(&et_ext2_error_table);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] tune2fs: warn if the filesystem journal is dirty
2015-11-25 0:07 [PATCH v2] tune2fs: warn if the filesystem journal is dirty Andreas Dilger
@ 2015-11-30 17:14 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2015-11-30 17:14 UTC (permalink / raw)
To: Andreas Dilger; +Cc: linux-ext4, Jim Garlick, Andreas Dilger
On Tue, Nov 24, 2015 at 05:07:39PM -0700, Andreas Dilger wrote:
> From: Jim Garlick <garlick@llnl.gov>
>
> Running tune2fs on a filesystem with an unrecovered journal can
> cause the tune2fs settings changes in the superblock to be reverted
> when the journal is replayed if it contains an uncommitted copy of
> the superblock. Print a warning if this is detected so that the
> user isn't surprised if it happens.
>
> Signed-off-by: Jim Garlick <garlick@llnl.gov>
>
> Updated message printed to include steps to replay journal.
>
> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-30 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 0:07 [PATCH v2] tune2fs: warn if the filesystem journal is dirty Andreas Dilger
2015-11-30 17:14 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).