public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <lkml@rtr.ca>
To: Stephen Tweedie <sct@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: ext3fs: umount+sync not enough to guarantee metadata-on-disk
Date: Thu, 07 Jun 2007 09:44:24 -0400	[thread overview]
Message-ID: <46680BB8.50404@rtr.ca> (raw)

Andrew / Stephen / Ted,

I have a MythTV PVR box here, which has had intermittent shutdown issues
over the past while.

The main storage for recordings is a 2-drive RAID0 array,
formatted with ext3fs.  The system runs a 2.6.17 Ubuntu kernel
that I've tailored/rebuild for this specific machine.

My observation is, if I delete a couple of 25+ GByte files,
and then immediately shutdown the system, the disks are still being
written to at the point when the power goes off (halt -f -p).

The overall sequence is something like this:

1. Delete the files in Myth, which uses a "delete slowly" function
to avoid locking up the machine for the 30-60 seconds that this would
otherwise require.  Myth appears to open the file, unlink it, and then
sit in a loop doing small ftruncate's until nothing is left.

2. When I trigger the shutdown whilst this is happening, Myth gets
killed off, and so the unlinked file is automatically closed.
and the kernel (filesystem) code begins finishing the delete operation.

3. The shutdown scripts do their thing quickly, so the delete is
*still* underway when the umount commands are issued.
On this system, I use this sequence:

  ## /var/lib/mythtv is the recording's ext3fs, on /dev/md0 (RAID0):
   mount /var/lib/mythtv -oremount,ro
   sync
   umount /var/lib/mythtv
   sync
   mount / -oremount,ro
   sync
   sleep 1
   hdparm -W0 /dev/sda /dev/sdb
   sync
   sleep 2
   halt -f -p

4. The hard drive light is on solid throughout, including at the point
when the power goes out.

5. On the next reboot, there is a LONG pause (20-30 seconds) at the
point where /var/lib/mythtv is remounted --> indicating unfinished business
from the journal file that needs to be replayed (eg. the file deletion).

So.. how can I guarantee a quiescent filesystem before doing "halt -f -p" ??
This looks pretty dangerous as-is.

Thanks

             reply	other threads:[~2007-06-07 13:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07 13:44 Mark Lord [this message]
2007-06-07 15:41 ` ext3fs: umount+sync not enough to guarantee metadata-on-disk Andrew Morton
2007-06-07 16:01   ` Mark Lord
2007-06-07 17:09     ` Stephen C. Tweedie
2007-06-10 18:27     ` Pavel Machek
2007-06-12 15:15       ` Stephen C. Tweedie
2007-06-14 19:01       ` Phillip Susi
2007-06-07 16:11   ` Chuck Ebbert
2007-06-07 19:45     ` Andrew Morton
2007-06-07 21:38       ` Mark Lord
2007-06-07 22:04         ` Andrew Morton
2007-06-08 14:51           ` Mark Lord
2007-06-09  2:58       ` Mark Lord
2007-06-11 11:14         ` Jan Kara
2007-06-11 22:47           ` Mark Lord
2007-06-12 10:00             ` Jan Kara
2007-06-07 21:43     ` Mark Lord
2007-06-10 18:31       ` Pavel Machek
2007-06-11 11:05       ` Jan Kara
2007-06-11 22:46         ` Mark Lord

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=46680BB8.50404@rtr.ca \
    --to=lkml@rtr.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=tytso@mit.edu \
    /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