linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: linux-kernel@vger.kernel.org
Subject: disk corruption in 2.5.66-bk5 - 2.5.69
Date: Wed, 14 May 2003 19:58:37 -0700	[thread overview]
Message-ID: <200305150258.h4F2wbR27255@freya.yggdrasil.com> (raw)

	linux-2.5.66-bk5 changed blkdev_put in fs/block_dev.c
to only call sync_blockdev if bdev->bd_openers drops to zero.
For me, this has resulted in disk corruption when lilo runs
under kernels 2.5.66-bk5 through 2.5.69, even if I run
"sync" repeatedly after running lilo.

	I am not sure why I seem to be the first person reporting
this disastrous problem.  I suspect it may have something to do
with the fact that I boot from an initial ramdisk that changes
the root without using pivot_root (instead, process 1 does a chroot
at a time when it is the only process on the system) and the fact
that I user partitions defined by partx rather than kernel-based
partitioning.  Perhaps bdev->bd_openers never drops to zero in this
configuration as a result of some other bug that only occurs in
such a configuration.

	I notice also that that change in 2.5.66-bk5 causes
sync_blockdev to be called with the big kernel lock held, although
I do not think that is the cause of the data corruption.

	With the following kludge, the lilo data corruption 
in 2.5.69 seems to be gone.  I have deliberately not cleaned
up this patch for integration at this point, because I don't
understand the issue enough yet to know the real problem
and the right fix.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Miplitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

--- linux-2.5.69/fs/block_dev.c.orig	2003-05-14 17:43:40.000000000 -0700
+++ linux-2.5.69/fs/block_dev.c	2003-05-14 17:44:29.000000000 -0700
@@ -635,14 +635,24 @@
 int blkdev_put(struct block_device *bdev, int kind)
 {
 	int ret = 0;
 	struct inode *bd_inode = bdev->bd_inode;
 	struct gendisk *disk = bdev->bd_disk;
 
 	down(&bdev->bd_sem);
+
+	/* AJR start */
+	switch (kind) {
+	case BDEV_FILE:
+	case BDEV_FS:
+		sync_blockdev(bd_inode->i_bdev);
+		break;
+	}
+	/* AJR end */
+
 	lock_kernel();
 	if (!--bdev->bd_openers) {
 		switch (kind) {
 		case BDEV_FILE:
 		case BDEV_FS:
 			sync_blockdev(bd_inode->i_bdev);
 			break;

             reply	other threads:[~2003-05-15  2:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-15  2:58 Adam J. Richter [this message]
2003-05-15  7:57 ` disk corruption in 2.5.66-bk5 - 2.5.69 Andrew Morton

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=200305150258.h4F2wbR27255@freya.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@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 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).