diff mbox

default max mount count to unused

Message ID 4B5785A5.2010505@redhat.com
State New, archived
Headers show

Commit Message

Eric Sandeen Jan. 20, 2010, 10:37 p.m. UTC
From: Bill Nottingham <notting@redhat.com>

Anaconda has been setting the max mount count on the root fs
to -1 (unused) for ages.

I (Eric) tend to agree that using mount count as a proxy for potential
for corruption seems odd.  And waiting for fsck on a reboot just because
it's number 20 (or so) is painful.  Can we just turn it off by default?

I wouldn't mind killing the periodic check as well, but consider
this a trial balloon.  :)

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


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andreas Dilger Jan. 22, 2010, 12:22 a.m. UTC | #1
On 2010-01-20, at 15:37, Eric Sandeen wrote:
> From: Bill Nottingham <notting@redhat.com>
>
> Anaconda has been setting the max mount count on the root fs
> to -1 (unused) for ages.
>
> I (Eric) tend to agree that using mount count as a proxy for potential
> for corruption seems odd.  And waiting for fsck on a reboot just  
> because
> it's number 20 (or so) is painful.  Can we just turn it off by  
> default?
>
> I wouldn't mind killing the periodic check as well, but consider
> this a trial balloon.  :)

Rather than disabling the mount-count check, it would make a lot of  
sense to rather enable background checking via LVM snapshots, as  
described in:

https://www.redhat.com/archives/ext3-users/2008-February/msg00004.html

I've attached an updated version of this script and its config file.   
I've run a fair amount of testing on the script and it seems to do the  
right thing, and started running it from my /etc/cron.weekly to give  
it some further ongoing testing.

Since virtually all new distros use LVM devices, this makes a lot of  
sense to configure by default, rather than leaving filesystems to bit- 
rot in silence by turning off the periodic checking.  This also avoids  
the "all devices check after 6 months" problem for servers that reboot  
only rarely, because the filesystems get a periodic check and reset  
the check timestamp/interval so they will never need checking at boot  
time unless there is an error.


Alasdair, any chance you can include this script into the LVM package?

Ted, this should really be added to e2fsprogs, and the e2croncheck  
script removed.  The existing e2croncheck script is broken in a number  
of ways (e.g. the force check timestamp 19000101 is invalid, the email  
reporting doesn't work because "$RPT-EMAIL" is never set) and is less  
functional in other ways (it doesn't remove stale snapshots in case of  
an interrupted script, it doesn't check multiple LVs, etc).

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
Theodore Ts'o Jan. 22, 2010, 1:29 a.m. UTC | #2
On Wed, Jan 20, 2010 at 04:37:25PM -0600, Eric Sandeen wrote:
> From: Bill Nottingham <notting@redhat.com>
> 
> Anaconda has been setting the max mount count on the root fs
> to -1 (unused) for ages.
> 
> I (Eric) tend to agree that using mount count as a proxy for potential
> for corruption seems odd.  And waiting for fsck on a reboot just because
> it's number 20 (or so) is painful.  Can we just turn it off by default?
> 
> I wouldn't mind killing the periodic check as well, but consider
> this a trial balloon.  :)

I think it would be better to make this be something tunable via
mke2fs.conf.  And as a profile option, maybe we would want this to be
something where we periodically force a full fsck check and then send
TRIM commands down to the SSD.  Given the size and speed of SSD's,
doing periodic TRIM's every N mounts mike actually be a good thing.
(It's dangerous to do a TRIM without doing a full fsck since if the
block allocation bitmap isn't quite right, the user could lose data.)

      		 	      	    	       - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Jan. 22, 2010, 1:37 a.m. UTC | #3
On Thu, Jan 21, 2010 at 05:22:55PM -0700, Andreas Dilger wrote:
> 
> Alasdair, any chance you can include this script into the LVM package?
> 
> Ted, this should really be added to e2fsprogs, and the e2croncheck
> script removed.  The existing e2croncheck script is broken in a
> number of ways (e.g. the force check timestamp 19000101 is invalid,
> the email reporting doesn't work because "$RPT-EMAIL" is never set)
> and is less functional in other ways (it doesn't remove stale
> snapshots in case of an interrupted script, it doesn't check
> multiple LVs, etc).

Sure, I'd be happy to include this to e2fsprogs.  I'm not sure which
distro package should be installing it, but we can leave that up to
the distro maintainers.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Jan. 22, 2010, 3:37 a.m. UTC | #4
tytso@mit.edu wrote:
> On Wed, Jan 20, 2010 at 04:37:25PM -0600, Eric Sandeen wrote:
>> From: Bill Nottingham <notting@redhat.com>
>>
>> Anaconda has been setting the max mount count on the root fs
>> to -1 (unused) for ages.
>>
>> I (Eric) tend to agree that using mount count as a proxy for potential
>> for corruption seems odd.  And waiting for fsck on a reboot just because
>> it's number 20 (or so) is painful.  Can we just turn it off by default?
>>
>> I wouldn't mind killing the periodic check as well, but consider
>> this a trial balloon.  :)
> 
> I think it would be better to make this be something tunable via
> mke2fs.conf. 

And defaulting it to unused, right ;)

> And as a profile option, maybe we would want this to be
> something where we periodically force a full fsck check and then send
> TRIM commands down to the SSD.  Given the size and speed of SSD's,
> doing periodic TRIM's every N mounts mike actually be a good thing.
> (It's dangerous to do a TRIM without doing a full fsck since if the
> block allocation bitmap isn't quite right, the user could lose data.)

That sounds fine, as do mke2fs.conf hooks, as does a nice shipped script
to do background checking of snapshots.

But I still don't know why "You mounted your fs 20 times" is a good
proxy for "you had better check for corruption now."  Have we so
little faith?  :)

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Jan. 22, 2010, 8:09 a.m. UTC | #5
On 2010-01-21, at 20:37, Eric Sandeen wrote:
> That sounds fine, as do mke2fs.conf hooks, as does a nice shipped  
> script
> to do background checking of snapshots.
>
> But I still don't know why "You mounted your fs 20 times" is a good
> proxy for "you had better check for corruption now."  Have we so
> little faith?  :)


I've thought for quite a while that 20 mounts is too often, but I'm  
reluctant to turn it off completely.  I wouldn't object to increasing  
it to 60 or 80.

At one time there was a patch that checked the state of the filesystem  
at mount time and only incremented only 1/5 of the time (randomly) if  
it was unmounted cleanly (not dirty, or not in recovery), but every  
time if it crashed.  The reasoning was that systems which crashed are  
more likely to have memory corruption or software bugs, and ones that  
shut down cleanly are less likely to have such problems.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ric Wheeler Jan. 22, 2010, 5:02 p.m. UTC | #6
On 01/22/2010 03:09 AM, Andreas Dilger wrote:
> On 2010-01-21, at 20:37, Eric Sandeen wrote:
>> That sounds fine, as do mke2fs.conf hooks, as does a nice shipped script
>> to do background checking of snapshots.
>>
>> But I still don't know why "You mounted your fs 20 times" is a good
>> proxy for "you had better check for corruption now."  Have we so
>> little faith?  :)
>
>
> I've thought for quite a while that 20 mounts is too often, but I'm 
> reluctant to turn it off completely.  I wouldn't object to increasing 
> it to 60 or 80.
>
> At one time there was a patch that checked the state of the filesystem 
> at mount time and only incremented only 1/5 of the time (randomly) if 
> it was unmounted cleanly (not dirty, or not in recovery), but every 
> time if it crashed.  The reasoning was that systems which crashed are 
> more likely to have memory corruption or software bugs, and ones that 
> shut down cleanly are less likely to have such problems.
>

I do like the snapshot idea, but also think that we need something will 
not introduce random (potentially multi-hour or multi-day) fsck runs 
after an otherwise clean reboot.

If we hit this with a combination of:

Reboot time:
     (1) Try to mount the file system
     (1) on mount failure, fsck the failed file system

While up and running, do a periodic check with the snapshot trick.

I think that would balance the fear that we have of creeping corruption 
(or at least severe corruption) against the need to be speedy when 
rebooting....

ric

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Jan. 22, 2010, 5:42 p.m. UTC | #7
tytso@mit.edu wrote:
> On Thu, Jan 21, 2010 at 05:22:55PM -0700, Andreas Dilger wrote:
>> Alasdair, any chance you can include this script into the LVM package?
>>
>> Ted, this should really be added to e2fsprogs, and the e2croncheck
>> script removed.  The existing e2croncheck script is broken in a
>> number of ways (e.g. the force check timestamp 19000101 is invalid,
>> the email reporting doesn't work because "$RPT-EMAIL" is never set)
>> and is less functional in other ways (it doesn't remove stale
>> snapshots in case of an interrupted script, it doesn't check
>> multiple LVs, etc).
> 
> Sure, I'd be happy to include this to e2fsprogs.  I'm not sure which
> distro package should be installing it, but we can leave that up to
> the distro maintainers.
> 
> 					- Ted


Last time around, we all seemed to think it should be in the lvm
tools (though I don't remember exactly why - probably because it's
really not ext*-specific at all)

It got forwarded to the LVM list, agk asked if anyone wanted to
clean it up & take ownership of it, and that was the end.  :(

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Jan. 22, 2010, 6:35 p.m. UTC | #8
On 2010-01-22, at 10:42, Eric Sandeen wrote:
> tytso@mit.edu wrote:
>> On Thu, Jan 21, 2010 at 05:22:55PM -0700, Andreas Dilger wrote:
>>> Alasdair, any chance you can include this script into the LVM  
>>> package?
>>>
>>> Ted, this should really be added to e2fsprogs, and the e2croncheck
>>> script removed.  The existing e2croncheck script is broken in a
>>> number of ways (e.g. the force check timestamp 19000101 is invalid,
>>> the email reporting doesn't work because "$RPT-EMAIL" is never set)
>>> and is less functional in other ways (it doesn't remove stale
>>> snapshots in case of an interrupted script, it doesn't check
>>> multiple LVs, etc).
>>
>> Sure, I'd be happy to include this to e2fsprogs.  I'm not sure which
>> distro package should be installing it, but we can leave that up to
>> the distro maintainers.
>
> Last time around, we all seemed to think it should be in the lvm
> tools (though I don't remember exactly why - probably because it's
> really not ext*-specific at all)

Sure, but since there is only a semi-functional version in e2fsprogs  
we may as well replace it with a working one.

> It got forwarded to the LVM list, agk asked if anyone wanted to
> clean it up & take ownership of it, and that was the end.  :(


I guess I wasn't on that email.  I've gone ahead and fixed up the  
current script to be functional (including testing of failed-fsck  
email, force-fsck on next boot, stale snapshot cleanup, etc) so you  
may as well chalk me up as the maintainer for now.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Jan. 22, 2010, 6:40 p.m. UTC | #9
On 2010-01-22, at 10:02, Ric Wheeler wrote:
>> I've thought for quite a while that 20 mounts is too often, but I'm  
>> reluctant to turn it off completely.  I wouldn't object to  
>> increasing it to 60 or 80.
>>
>> At one time there was a patch that checked the state of the  
>> filesystem at mount time and only incremented only 1/5 of the time  
>> (randomly) if it was unmounted cleanly (not dirty, or not in  
>> recovery), but every time if it crashed.  The reasoning was that  
>> systems which crashed are more likely to have memory corruption or  
>> software bugs, and ones that shut down cleanly are less likely to  
>> have such problems.
>>
>
> I do like the snapshot idea, but also think that we need something  
> will not introduce random (potentially multi-hour or multi-day) fsck  
> runs after an otherwise clean reboot.
>
> If we hit this with a combination of:
>
> Reboot time:
>    (1) Try to mount the file system
>    (1) on mount failure, fsck the failed file system

Well, this is essentially what already happens with e2fsck today,  
though it correctly checks the filesystem for errors _first_, and  
_then_ mounts the filesystem.  Otherwise it isn't possible to fix the  
filesystem after mount, and mounting a filesystem with errors is a  
recipe for further corruption and/or a crash/reboot cycle.

> While up and running, do a periodic check with the snapshot trick.

Yes, this is intended to reset the periodic mount/time counter to  
avoid the non-error boot-time check.  If that is not running correctly  
then the periodic check would still be done as a fail-safe measure.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ric Wheeler Jan. 22, 2010, 6:57 p.m. UTC | #10
On 01/22/2010 01:40 PM, Andreas Dilger wrote:
> On 2010-01-22, at 10:02, Ric Wheeler wrote:
>>> I've thought for quite a while that 20 mounts is too often, but I'm
>>> reluctant to turn it off completely. I wouldn't object to increasing
>>> it to 60 or 80.
>>>
>>> At one time there was a patch that checked the state of the
>>> filesystem at mount time and only incremented only 1/5 of the time
>>> (randomly) if it was unmounted cleanly (not dirty, or not in
>>> recovery), but every time if it crashed. The reasoning was that
>>> systems which crashed are more likely to have memory corruption or
>>> software bugs, and ones that shut down cleanly are less likely to
>>> have such problems.
>>>
>>
>> I do like the snapshot idea, but also think that we need something
>> will not introduce random (potentially multi-hour or multi-day) fsck
>> runs after an otherwise clean reboot.
>>
>> If we hit this with a combination of:
>>
>> Reboot time:
>> (1) Try to mount the file system
>> (1) on mount failure, fsck the failed file system
>
> Well, this is essentially what already happens with e2fsck today, though
> it correctly checks the filesystem for errors _first_, and _then_ mounts
> the filesystem. Otherwise it isn't possible to fix the filesystem after
> mount, and mounting a filesystem with errors is a recipe for further
> corruption and/or a crash/reboot cycle.

I think that we have to move towards an assumption that our journalling code 
actually works - the goal should be that we can *always* mount after a crash or 
clean reboot. That should be the basic test case - pound on a file system, drop 
power to the storage (and or server) and then on reboot, try to remount. 
Verification would be in the QA test case to unmount and fsck to make sure our 
journal was robust.

Note that in a technique that I have used in the past (with reiserfs) at large 
scale in actual deployments of hundreds of thousands of file systems. It does 
work pretty well in practice.

The key here is that any fsck can be a huge delay, pretty much unacceptable in 
production shops, where they might have multiple file systems per box.

>
>> While up and running, do a periodic check with the snapshot trick.
>
> Yes, this is intended to reset the periodic mount/time counter to avoid
> the non-error boot-time check. If that is not running correctly then the
> periodic check would still be done as a fail-safe measure.
>
> Cheers, Andreas
> --
> Andreas Dilger
> Sr. Staff Engineer, Lustre Group
> Sun Microsystems of Canada, Inc.
>

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dilger Jan. 22, 2010, 7:06 p.m. UTC | #11
On 2010-01-22, at 11:57, Ric Wheeler wrote:
> On 01/22/2010 01:40 PM, Andreas Dilger wrote:
>>> Reboot time:
>>> (1) Try to mount the file system
>>> (1) on mount failure, fsck the failed file system
>>
>> Well, this is essentially what already happens with e2fsck today,  
>> though
>> it correctly checks the filesystem for errors _first_, and _then_  
>> mounts
>> the filesystem. Otherwise it isn't possible to fix the filesystem  
>> after
>> mount, and mounting a filesystem with errors is a recipe for further
>> corruption and/or a crash/reboot cycle.
>
> I think that we have to move towards an assumption that our  
> journalling code actually works - the goal should be that we can  
> *always* mount after a crash or clean reboot. That should be the  
> basic test case - pound on a file system, drop power to the storage  
> (and or server) and then on reboot, try to remount. Verification  
> would be in the QA test case to unmount and fsck to make sure our  
> journal was robust.

I think you are missing an important fact here.  While e2fsck _always_  
runs on a filesystem at boot time (or at least this is the recommended  
configuration), this initial e2fsck run is only doing a very minimal  
amount of work (i.e. it is NOT a full "e2fsck -f" run).  It checks  
that the superblock is sane, it recovers the journal, and it looks for  
error flags written to the journal and/or superblock.  If all of those  
tests pass (i.e. less than a second of work) then the e2fsck run  
passes (excluding periodic checking, which IMHO is the only issue  
under discussion here).

> Note that in a technique that I have used in the past (with  
> reiserfs) at large scale in actual deployments of hundreds of  
> thousands of file systems. It does work pretty well in practice.
>
> The key here is that any fsck can be a huge delay, pretty much  
> unacceptable in production shops, where they might have multiple  
> file systems per box.

No, there is no delay if the filesystem does not have any errors.  I  
consider the lack of ANY minimal boot-time sanity checking a serious  
problem with reiserfs and advised Hans many times to have minimal  
sanity checks at boot.

The problem is that if the kernel (or a background snapshot e2fsck)  
detects an error then the only way it can force a full check to  
correct is to do this on the next boot, by storing some information in  
the superblock.  If the filesystem is mounted at boot time without  
even a minimal check for such error flags in the superblock then the  
error may never be corrected, and in fact may cause cascading  
corruption elsewhere in the filesystem (e.g. corrupt bitmaps, bad  
indirect block pointers, etc).

If the filesystem is mounted with "errors=panic" (often done with HA  
configs to allow failover in case of node/cable/HBA errors) then any  
corruption on disk will just result in the node getting stuck in a  
reboot cycle with no automated e2fsck being run.

>>> While up and running, do a periodic check with the snapshot trick.
>>
>> Yes, this is intended to reset the periodic mount/time counter to  
>> avoid
>> the non-error boot-time check. If that is not running correctly  
>> then the
>> periodic check would still be done as a fail-safe measure.
>>
>> Cheers, Andreas
>> --
>> Andreas Dilger
>> Sr. Staff Engineer, Lustre Group
>> Sun Microsystems of Canada, Inc.
>>
>


Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Jan. 22, 2010, 7:59 p.m. UTC | #12
Andreas Dilger wrote:
> On 2010-01-22, at 11:57, Ric Wheeler wrote:
>> On 01/22/2010 01:40 PM, Andreas Dilger wrote:
>>>> Reboot time:
>>>> (1) Try to mount the file system
>>>> (1) on mount failure, fsck the failed file system
>>>
>>> Well, this is essentially what already happens with e2fsck today, though
>>> it correctly checks the filesystem for errors _first_, and _then_ mounts
>>> the filesystem. Otherwise it isn't possible to fix the filesystem after
>>> mount, and mounting a filesystem with errors is a recipe for further
>>> corruption and/or a crash/reboot cycle.
>>
>> I think that we have to move towards an assumption that our
>> journalling code actually works - the goal should be that we can
>> *always* mount after a crash or clean reboot. That should be the basic
>> test case - pound on a file system, drop power to the storage (and or
>> server) and then on reboot, try to remount. Verification would be in
>> the QA test case to unmount and fsck to make sure our journal was robust.
> 
> I think you are missing an important fact here.  While e2fsck _always_
> runs on a filesystem at boot time (or at least this is the recommended
> configuration), this initial e2fsck run is only doing a very minimal
> amount of work (i.e. it is NOT a full "e2fsck -f" run).  It checks that
> the superblock is sane, it recovers the journal, and it looks for error
> flags written to the journal and/or superblock.  If all of those tests
> pass (i.e. less than a second of work) then the e2fsck run passes
> (excluding periodic checking, which IMHO is the only issue under
> discussion here).
> 
>> Note that in a technique that I have used in the past (with reiserfs)
>> at large scale in actual deployments of hundreds of thousands of file
>> systems. It does work pretty well in practice.
>>
>> The key here is that any fsck can be a huge delay, pretty much
>> unacceptable in production shops, where they might have multiple file
>> systems per box.
> 
> No, there is no delay if the filesystem does not have any errors.  I

well, there is a delay if it's the magical Nth time or the magical Nth
hour, right?  Which is what we're trying to avoid.

> consider the lack of ANY minimal boot-time sanity checking a serious
> problem with reiserfs and advised Hans many times to have minimal sanity
> checks at boot.

I have no problem with checking an fs marked with errors...

> The problem is that if the kernel (or a background snapshot e2fsck)
> detects an error then the only way it can force a full check to correct
> is to do this on the next boot, by storing some information in the
> superblock.  If the filesystem is mounted at boot time without even a
> minimal check for such error flags in the superblock then the error may
> never be corrected, and in fact may cause cascading corruption elsewhere
> in the filesystem (e.g. corrupt bitmaps, bad indirect block pointers, etc).

Mmmhm, so if we mark it with the error and a next boot fscks... I can
live with that.

I just want to avoid the "we scheduled a brief window to upgrade the kernel,
and the next time we booted we got a 3-hour fsck that we didn't expect,
and we were afraid to stop it, but oh well it was clean anyway" scenario.

I guess the higher-level discussion to have is

a) what are the errors and the root-causes that the forced periodic
   checks are intended to catch

and

b) what are the pros and cons of periodic checking for those errors,
   vs catching them at runtime and scheduling a fsck as a result.

or maybe it's "how much of a nanny-state do we want to be?" :)

-Eric


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Valerie Aurora Henson Jan. 22, 2010, 8:58 p.m. UTC | #13
On Fri, Jan 22, 2010 at 01:59:26PM -0600, Eric Sandeen wrote:
> Andreas Dilger wrote:
> > On 2010-01-22, at 11:57, Ric Wheeler wrote:
> >> On 01/22/2010 01:40 PM, Andreas Dilger wrote:
> >>>> Reboot time:
> >>>> (1) Try to mount the file system
> >>>> (1) on mount failure, fsck the failed file system
> >>>
> >>> Well, this is essentially what already happens with e2fsck today, though
> >>> it correctly checks the filesystem for errors _first_, and _then_ mounts
> >>> the filesystem. Otherwise it isn't possible to fix the filesystem after
> >>> mount, and mounting a filesystem with errors is a recipe for further
> >>> corruption and/or a crash/reboot cycle.
> >>
> >> I think that we have to move towards an assumption that our
> >> journalling code actually works - the goal should be that we can
> >> *always* mount after a crash or clean reboot. That should be the basic
> >> test case - pound on a file system, drop power to the storage (and or
> >> server) and then on reboot, try to remount. Verification would be in
> >> the QA test case to unmount and fsck to make sure our journal was robust.
> > 
> > I think you are missing an important fact here.  While e2fsck _always_
> > runs on a filesystem at boot time (or at least this is the recommended
> > configuration), this initial e2fsck run is only doing a very minimal
> > amount of work (i.e. it is NOT a full "e2fsck -f" run).  It checks that
> > the superblock is sane, it recovers the journal, and it looks for error
> > flags written to the journal and/or superblock.  If all of those tests
> > pass (i.e. less than a second of work) then the e2fsck run passes
> > (excluding periodic checking, which IMHO is the only issue under
> > discussion here).
> > 
> >> Note that in a technique that I have used in the past (with reiserfs)
> >> at large scale in actual deployments of hundreds of thousands of file
> >> systems. It does work pretty well in practice.
> >>
> >> The key here is that any fsck can be a huge delay, pretty much
> >> unacceptable in production shops, where they might have multiple file
> >> systems per box.
> > 
> > No, there is no delay if the filesystem does not have any errors.  I
> 
> well, there is a delay if it's the magical Nth time or the magical Nth
> hour, right?  Which is what we're trying to avoid.
> 
> > consider the lack of ANY minimal boot-time sanity checking a serious
> > problem with reiserfs and advised Hans many times to have minimal sanity
> > checks at boot.
> 
> I have no problem with checking an fs marked with errors...

Yes, I think we are all in violent agreement on this.

> > The problem is that if the kernel (or a background snapshot e2fsck)
> > detects an error then the only way it can force a full check to correct
> > is to do this on the next boot, by storing some information in the
> > superblock.  If the filesystem is mounted at boot time without even a
> > minimal check for such error flags in the superblock then the error may
> > never be corrected, and in fact may cause cascading corruption elsewhere
> > in the filesystem (e.g. corrupt bitmaps, bad indirect block pointers, etc).
> 
> Mmmhm, so if we mark it with the error and a next boot fscks... I can
> live with that.
> 
> I just want to avoid the "we scheduled a brief window to upgrade the kernel,
> and the next time we booted we got a 3-hour fsck that we didn't expect,
> and we were afraid to stop it, but oh well it was clean anyway" scenario.
> 
> I guess the higher-level discussion to have is
> 
> a) what are the errors and the root-causes that the forced periodic
>    checks are intended to catch
> 
> and
> 
> b) what are the pros and cons of periodic checking for those errors,
>    vs catching them at runtime and scheduling a fsck as a result.
> 
> or maybe it's "how much of a nanny-state do we want to be?" :)

Do any other file systems have this "fsck on N reboots/N days up"
behavior?  Is ext3/ext4 the odd one out?

-VAL
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Jan. 22, 2010, 11:18 p.m. UTC | #14
On Fri, Jan 22, 2010 at 01:57:16PM -0500, Ric Wheeler wrote:
> 
> I think that we have to move towards an assumption that our
> journalling code actually works - the goal should be that we can
> *always* mount after a crash or clean reboot. That should be the
> basic test case - pound on a file system, drop power to the storage
> (and or server) and then on reboot, try to remount. Verification
> would be in the QA test case to unmount and fsck to make sure our
> journal was robust.

The original reason for the periodic fsck was not a fear that the
journalling system worked --- it was a concern that the hardware was
reliable.  (Ted's law of PC class hardware: it's crap. :-) That was
the reason for the periodic fsck in the BSD days, and it's the same
now.

That being said, I agree that 20-40 reboots (it's actually randomized
by mke2fs these days; the setting in libext2fs isn't the whole story)
is a ver y rough metric.  I'd much rather do the checking periodically
via snapshots in cron, at which point the reboot counter becomes moot
(the snapshot check zero's the mount count and sets the last checked
time correctly).

							- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/doc/libext2fs.texinfo b/doc/libext2fs.texinfo
index 19899bc..a0439bf 100644
--- a/doc/libext2fs.texinfo
+++ b/doc/libext2fs.texinfo
@@ -319,7 +319,8 @@  skip the filesystem check if the number of times that the filesystem has
 been mounted is less than @code{s_max_mnt_count} and if the interval
 between the last time a filesystem check was performed and the current
 time is less than @code{s_checkinterval} (see below).  The default value
-of @code{s_max_mnt_count} is 20.
+of @code{s_max_mnt_count} is -1 (which means that this check is not
+done).
 
 @item s_checkinterval
 This field defines the minimal interval between filesystem checks.  See
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 114b001..b98d6e8 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -484,7 +484,7 @@  struct ext2_inode_large {
 /*
  * Maximal mount counts between two filesystem checks
  */
-#define EXT2_DFL_MAX_MNT_COUNT		20	/* Allow 20 mounts */
+#define EXT2_DFL_MAX_MNT_COUNT		-1	/* Don't use mount check */
 #define EXT2_DFL_CHECKINTERVAL		0	/* Don't use interval check */
 
 /*