From: Eric Sandeen <sandeen@sandeen.net>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] resize2fs: don't require fsck to print min size
Date: Wed, 10 Dec 2014 09:19:56 -0600 [thread overview]
Message-ID: <5488649C.8020809@sandeen.net> (raw)
My previous change ended up requiring that the filesystem
be fsck'd after the last mount, even if we are only querying
the minimum size. This is a bit draconian, and it burned
the Fedora installer, which wants to calculate minimum size
for every filesystem in the box at install time, which in turn
requires a full fsck of every filesystem.
Try this one more time, and separate out the tests to make things
a bit more clear. If we're only printing the min size, don't
require the fsck, as this is a bit less dangerous/critical.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/resize/main.c b/resize/main.c
index 983d8c2..d40a741 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -321,10 +321,31 @@ int main (int argc, char ** argv)
}
fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE;
- if (!(mount_flags & EXT2_MF_MOUNTED)) {
- if (!force && ((fs->super->s_lastcheck < fs->super->s_mtime) ||
- (fs->super->s_state & EXT2_ERROR_FS) ||
- ((fs->super->s_state & EXT2_VALID_FS) == 0))) {
+ /*
+ * Before acting on an unmounted filesystem, make sure it's ok,
+ * unless the user is forcing it.
+ *
+ * We do ERROR and VALID checks even if we're only printing the
+ * minimimum size, because traversal of a badly damaged filesystem
+ * can cause issues as well. We don't require it to be fscked after
+ * the last mount time in this case, though, as this is a bit less
+ * risky.
+ */
+ if (!force && !(mount_flags & EXT2_MF_MOUNTED)) {
+ int checkit = 0;
+
+ if (fs->super->s_state & EXT2_ERROR_FS)
+ checkit = 1;
+
+ if ((fs->super->s_state & EXT2_VALID_FS) == 0)
+ checkit = 1;
+
+ if (fs->super->s_lastcheck < fs->super->s_mtime) {
+ if (!print_min_size)
+ checkit = 1;
+ }
+
+ if (checkit) {
fprintf(stderr,
_("Please run 'e2fsck -f %s' first.\n\n"),
device_name);
next reply other threads:[~2014-12-10 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 15:19 Eric Sandeen [this message]
2014-12-15 0:12 ` [PATCH] resize2fs: don't require fsck to print min size Theodore 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=5488649C.8020809@sandeen.net \
--to=sandeen@sandeen.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.