linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH e2fsprogs] Restore backup superblocks in preen mode
@ 2007-05-08 17:43 Daniel Drake
  2007-05-08 18:14 ` Theodore Tso
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Drake @ 2007-05-08 17:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

The restoration of backup superblocks seems to be reversed in the current
e2fsprogs:

When running without preen mode, e2fsck searches and locates a backup
superblock and fixes the primary superblock without any user intervention.

When running in preen mode, e2fsck prints a message describing how the user
can specify the location of a backup superblock, and exits without doing any
repair.

This patch corrects the issue.

Signed-off-by: Daniel Drake <d.drake@mmm.com>

Index: e2fsprogs-1.39/e2fsck/unix.c
===================================================================
--- e2fsprogs-1.39.orig/e2fsck/unix.c
+++ e2fsprogs-1.39/e2fsck/unix.c
@@ -932,7 +932,7 @@ restart:
 	} else 
 		retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, 
 				      flags, 0, 0, io_ptr, &fs);
-	if (!ctx->superblock && !(ctx->options & E2F_OPT_PREEN) &&
+	if (!ctx->superblock && (ctx->options & E2F_OPT_PREEN) &&
 	    !(ctx->flags & E2F_FLAG_SB_SPECIFIED) &&
 	    ((retval == EXT2_ET_BAD_MAGIC) ||
 	     ((retval == 0) && ext2fs_check_desc(fs)))) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH e2fsprogs] Restore backup superblocks in preen mode
  2007-05-08 17:43 [PATCH e2fsprogs] Restore backup superblocks in preen mode Daniel Drake
@ 2007-05-08 18:14 ` Theodore Tso
  2007-05-08 18:52   ` Daniel Drake
  0 siblings, 1 reply; 3+ messages in thread
From: Theodore Tso @ 2007-05-08 18:14 UTC (permalink / raw)
  To: Daniel Drake; +Cc: linux-ext4

On Tue, May 08, 2007 at 06:43:24PM +0100, Daniel Drake wrote:
> The restoration of backup superblocks seems to be reversed in the current
> e2fsprogs:
> 
> When running without preen mode, e2fsck searches and locates a backup
> superblock and fixes the primary superblock without any user intervention.
> 
> When running in preen mode, e2fsck prints a message describing how the user
> can specify the location of a backup superblock, and exits without doing any
> repair.

That's intentional.  If the priumary superblock is wiped out,
something really bad has happened, and usually the first part of the
filesystem is gone too --- possibly including the first part of the
inode table, which would mean the root inode is gone.  So we do want
the user running e2fsck by hand.

We could argue about whether or not e2fsck should explicitly ask for
permission before using a backup superblock, and possibly printing the
label and validating the size, etc., before using it --- but we
definitely don't want to just blithly use a backup superblock when in
preen mode.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH e2fsprogs] Restore backup superblocks in preen mode
  2007-05-08 18:14 ` Theodore Tso
@ 2007-05-08 18:52   ` Daniel Drake
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Drake @ 2007-05-08 18:52 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-ext4

On Tue, 2007-05-08 at 14:14 -0400, Theodore Tso wrote:
> We could argue about whether or not e2fsck should explicitly ask for
> permission before using a backup superblock, and possibly printing the
> label and validating the size, etc., before using it

In that case, I think it should. At least, that would kill the confusion
where preen mode apparently doesn't want to automate a potentially
dangerous operation, whereas the standard mode works extremely hard to
complete the operation with no user intervention (and doesn't even
require as much info from the user!).

Thanks.
-- 
Daniel Drake
Brontes Technologies, A 3M Company

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-08 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08 17:43 [PATCH e2fsprogs] Restore backup superblocks in preen mode Daniel Drake
2007-05-08 18:14 ` Theodore Tso
2007-05-08 18:52   ` Daniel Drake

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).