From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] e2fsck: return more status if fsck aborts
Date: Tue, 01 Nov 2011 12:32:28 -0500 [thread overview]
Message-ID: <4EB02D2C.3090809@redhat.com> (raw)
If we abort fsck (due to ENOMEM for example) we exit
with only the FSCK_ERROR flag. It seems useful
to do the same sorts of checks as we do on normal
exit, and return whether the filesystem was modified,
whether there are still uncorrected errors, etc, even
in the abort case.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/e2fsck/util.c b/e2fsck/util.c
index fb9a87a..d761ae5 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -45,18 +45,37 @@ extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
void fatal_error(e2fsck_t ctx, const char *msg)
{
+ ext2_filsys fs = ctx->fs;
+ int exit_value = FSCK_ERROR;
+
if (msg)
fprintf (stderr, "e2fsck: %s\n", msg);
- if (ctx->fs && ctx->fs->io) {
+ if (!fs)
+ goto out;
+ if (fs->io) {
if (ctx->fs->io->magic == EXT2_ET_MAGIC_IO_CHANNEL)
io_channel_flush(ctx->fs->io);
else
fprintf(stderr, "e2fsck: io manager magic bad!\n");
}
+ if (ext2fs_test_changed(fs)) {
+ exit_value |= FSCK_NONDESTRUCT;
+ printf(_("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"),
+ ctx->device_name);
+ if (ctx->mount_flags & EXT2_MF_ISROOT)
+ exit_value |= FSCK_REBOOT;
+ }
+ if (!ext2fs_test_valid(fs)) {
+ printf(_("\n%s: ********** WARNING: Filesystem still has "
+ "errors **********\n\n"), ctx->device_name);
+ exit_value |= FSCK_UNCORRECTED;
+ exit_value &= ~FSCK_NONDESTRUCT;
+ }
+out:
ctx->flags |= E2F_FLAG_ABORT;
if (ctx->flags & E2F_FLAG_SETJMP_OK)
longjmp(ctx->abort_loc, 1);
- exit(FSCK_ERROR);
+ exit(exit_value);
}
void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
next reply other threads:[~2011-11-01 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 17:32 Eric Sandeen [this message]
2011-11-20 20:56 ` [PATCH] e2fsck: return more status if fsck aborts Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EB02D2C.3090809@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).