linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH e2fsprogs] - ignore bind mounts in fsck
@ 2007-09-19 20:20 Eric Sandeen
  2007-09-19 20:42 ` Theodore Tso
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Sandeen @ 2007-09-19 20:20 UTC (permalink / raw)
  To: ext4 development

An entry like this in /etc/fstab:

/foo	/bar	ext3	bind,defaults	1 3

will stop boot, as fsck.ext3 tries to check it and fails:

e2fsck 1.40.2 (12-Jul-2007)
fsck.ext3: Is a directory while trying to open /foo

The superblock could not be read or does not describe a correct ext2
filesystem. ...

Granted, asking for fsck of a bind mount in the fstab is a bit odd, 
but it doesn't seem like it should stop the boot process if you make
this mistake.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: e2fsprogs-1.40.2/misc/fsck.c
===================================================================
--- e2fsprogs-1.40.2.orig/misc/fsck.c
+++ e2fsprogs-1.40.2/misc/fsck.c
@@ -867,6 +867,12 @@ static int ignore(struct fs_info *fs)
 	if (fs->passno == 0)
 		return 1;
 
+	/*
+	 * If this is a bind mount, ignore it.
+	 */
+	if (opt_in_list("bind", fs->opts))
+		return 1;
+
 	interpret_type(fs);
 
 	/*

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-19 20:20 [PATCH e2fsprogs] - ignore bind mounts in fsck Eric Sandeen
@ 2007-09-19 20:42 ` Theodore Tso
  2007-09-20 14:31   ` Eric Sandeen
  0 siblings, 1 reply; 7+ messages in thread
From: Theodore Tso @ 2007-09-19 20:42 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Wed, Sep 19, 2007 at 03:20:14PM -0500, Eric Sandeen wrote:
> An entry like this in /etc/fstab:
> 
> /foo	/bar	ext3	bind,defaults	1 3
> 
> will stop boot, as fsck.ext3 tries to check it and fails:
> 
> e2fsck 1.40.2 (12-Jul-2007)
> fsck.ext3: Is a directory while trying to open /foo
> 
> The superblock could not be read or does not describe a correct ext2
> filesystem. ...
> 
> Granted, asking for fsck of a bind mount in the fstab is a bit odd, 
> but it doesn't seem like it should stop the boot process if you make
> this mistake.

That's fair, but note that the dump number and fsck pass number really
should be zero in the fstab entry.  i.e., it really should be "0 0",
or just plain ommitted.

							- Ted

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-19 20:42 ` Theodore Tso
@ 2007-09-20 14:31   ` Eric Sandeen
  2007-09-20 14:42     ` Theodore Tso
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Sandeen @ 2007-09-20 14:31 UTC (permalink / raw)
  To: Theodore Tso; +Cc: ext4 development

Theodore Tso wrote:
> On Wed, Sep 19, 2007 at 03:20:14PM -0500, Eric Sandeen wrote:
>> An entry like this in /etc/fstab:
>>
>> /foo	/bar	ext3	bind,defaults	1 3
>>
>> will stop boot, as fsck.ext3 tries to check it and fails:
>>
>> e2fsck 1.40.2 (12-Jul-2007)
>> fsck.ext3: Is a directory while trying to open /foo
>>
>> The superblock could not be read or does not describe a correct ext2
>> filesystem. ...
>>
>> Granted, asking for fsck of a bind mount in the fstab is a bit odd, 
>> but it doesn't seem like it should stop the boot process if you make
>> this mistake.
> 
> That's fair, but note that the dump number and fsck pass number really
> should be zero in the fstab entry.  i.e., it really should be "0 0",
> or just plain ommitted.

Agreed.  If you think fsck shouldn't silently cope with this mistake,
and instead punish the user for it (it is what they asked for, after
all), I'm ok with that too.  I'm willing to close my end as NOTABUG if
you don't want to take this patch.  :)

(FWIW, this is RH bug #151533)

-Eric

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-20 14:31   ` Eric Sandeen
@ 2007-09-20 14:42     ` Theodore Tso
  2007-09-20 15:12       ` Eric Sandeen
  0 siblings, 1 reply; 7+ messages in thread
From: Theodore Tso @ 2007-09-20 14:42 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Thu, Sep 20, 2007 at 09:31:56AM -0500, Eric Sandeen wrote:
> Agreed.  If you think fsck shouldn't silently cope with this mistake,
> and instead punish the user for it (it is what they asked for, after
> all), I'm ok with that too.  I'm willing to close my end as NOTABUG if
> you don't want to take this patch.  :)

I'm willing to take the patch, although I am thinking that it might be
appropriate for fsck to print a warning message --- "Bind mount with
non-zero fsck pass, skipping", or some such.

What do you think?

							- Ted

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-20 14:42     ` Theodore Tso
@ 2007-09-20 15:12       ` Eric Sandeen
  2007-09-20 18:59         ` Theodore Tso
  2007-09-20 19:08         ` Theodore Tso
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Sandeen @ 2007-09-20 15:12 UTC (permalink / raw)
  To: Theodore Tso; +Cc: ext4 development

Theodore Tso wrote:
> On Thu, Sep 20, 2007 at 09:31:56AM -0500, Eric Sandeen wrote:
>   
>> Agreed.  If you think fsck shouldn't silently cope with this mistake,
>> and instead punish the user for it (it is what they asked for, after
>> all), I'm ok with that too.  I'm willing to close my end as NOTABUG if
>> you don't want to take this patch.  :)
>>     
>
> I'm willing to take the patch, although I am thinking that it might be
> appropriate for fsck to print a warning message --- "Bind mount with
> non-zero fsck pass, skipping", or some such.
>
> What do you think?
>
> 							- Ted
>   
Yup, was  thinking the same.

----------------

An entry like this in /etc/fstab:

/foo	/bar	ext3	bind,defaults	1 3

will stop boot, as fsck.ext3 tries to check it and fails:

e2fsck 1.40.2 (12-Jul-2007)
fsck.ext3: Is a directory while trying to open /foo

The superblock could not be read or does not describe a correct ext2
filesystem. ...

Granted, asking for fsck of a bind mount in the fstab is a bit odd, 
but it doesn't seem like it should stop the boot process if you make
this mistake.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: e2fsprogs-1.40.2/misc/fsck.c
===================================================================
--- e2fsprogs-1.40.2.orig/misc/fsck.c
+++ e2fsprogs-1.40.2/misc/fsck.c
@@ -867,6 +867,16 @@ static int ignore(struct fs_info *fs)
 	if (fs->passno == 0)
 		return 1;
 
+	/*
+	 * If this is a bind mount, ignore it.
+	 */
+	if (opt_in_list("bind", fs->opts)) {
+		fprintf(stderr,
+			_("Skipping bind mount on %s with nonzero fsck pass\n"),
+			fs->mountpt);
+		return 1;
+	}
+
 	interpret_type(fs);
 
 	/*

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-20 15:12       ` Eric Sandeen
@ 2007-09-20 18:59         ` Theodore Tso
  2007-09-20 19:08         ` Theodore Tso
  1 sibling, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2007-09-20 18:59 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

It might also be worthwhile to file a documentation bug against the
mount and fstab man pages, since it doesn't currently seem to specify
(at least on my Ubuntu system; maybe it's been fixed in newer upstream
packages) that you can specify the bind option in the fstab file.  

/src	/dest	ext3	bind,default

It's not clear to me that this should be the preferred form.  Why not?

/src	/dest  bind  defaults

or


/src	/dest  none  bind,defaults


instead?  In any case, how bind mounts are supposed to be specified in
fstab is not documented, and it really should be.

      	     		     	       - Ted

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

* Re: [PATCH e2fsprogs] - ignore bind mounts in fsck
  2007-09-20 15:12       ` Eric Sandeen
  2007-09-20 18:59         ` Theodore Tso
@ 2007-09-20 19:08         ` Theodore Tso
  1 sibling, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2007-09-20 19:08 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

This is what I actually committed into e2fsprogs git, in the maint
branch.  Note the one-line summary at the beginning of the patch
description, and the Addresses-Red-Hat-Bugzilla line before the
Signed-off-by lines.

						- Ted

commit ed773a263829493e4e4bf612dbec2380cf09349f
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Sep 20 15:06:35 2007 -0400

    fsck: Ignore /etc/fstab entries for bind mounts
    
    If a user specifies a bind mount with a non-zero fsck pass number, for
    example:
    
    /foo    /bar    ext3    bind,defaults   1 3
    
    print a warning and ignore the fstab entry.
    
    Addresses-Red-Hat-Bugzilla: #151533
    
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

diff --git a/misc/fsck.c b/misc/fsck.c
index 1dcac25..108adf6 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -867,6 +867,16 @@ static int ignore(struct fs_info *fs)
 	if (fs->passno == 0)
 		return 1;
 
+	/*
+	 * If this is a bind mount, ignore it.
+	 */
+	if (opt_in_list("bind", fs->opts)) {
+		fprintf(stderr,
+			_("%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass number\n"),
+			fs->mountpt);
+		return 1;
+	}
+
 	interpret_type(fs);
 
 	/*

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 20:20 [PATCH e2fsprogs] - ignore bind mounts in fsck Eric Sandeen
2007-09-19 20:42 ` Theodore Tso
2007-09-20 14:31   ` Eric Sandeen
2007-09-20 14:42     ` Theodore Tso
2007-09-20 15:12       ` Eric Sandeen
2007-09-20 18:59         ` Theodore Tso
2007-09-20 19:08         ` Theodore Tso

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