From: Andrea Arcangeli <andrea@suse.de>
To: GOTO Masanori <gotom@debian.org>
Cc: torvalds@transmeta.com, marcelo@conectiva.com.br,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] direct IO breaks root filesystem
Date: Mon, 10 Dec 2001 15:40:57 +0100 [thread overview]
Message-ID: <20011210154057.J4801@athlon.random> (raw)
In-Reply-To: <w534rmzendn.wl@megaela.fe.dis.titech.ac.jp> <Pine.LNX.4.33.0112092154060.13692-100000@penguin.transmeta.com> <w53d71n1c6g.wl@megaela.fe.dis.titech.ac.jp>
In-Reply-To: <w53d71n1c6g.wl@megaela.fe.dis.titech.ac.jp>; from gotom@debian.org on Mon, Dec 10, 2001 at 09:39:51PM +0900
On Mon, Dec 10, 2001 at 09:39:51PM +0900, GOTO Masanori wrote:
> At Sun, 9 Dec 2001 21:55:57 -0800 (PST),
> Linus Torvalds <torvalds@transmeta.com> wrote:
> > On Mon, 10 Dec 2001, GOTO Masanori wrote:
> > >
> > > The reason is that when kernel accesses /dev/sda with O_DIRECT,
> > > blkdev_direct_IO() is called. But, it calls generic_direct_IO(),
> > > and generic_direct_IO() calls brw_kiovec(..., inode->i_dev, ...).
> >
> > That's a bad bug, yes.
>
> Yes, dangerous bug...
at least it's not security related :)
>
> > However, the bug is really in "generic_direct_IO()", and you should fix it
> > there, instead of avoiding to use it altogether.
> >
> > "generic_direct_IO()" should just get the device from "bh->b_dev (which is
> > filled in correctly by "get_block()".
>
> Oh, that's right, the patch becomes more simple (and works well).
> Is this patch OK?
yes it is.
Thanks and sorry for your troubles. BTW, if you read back my first post
about the blkdev-pagecache you'll notice I got bitten by the same bug
too and I had to reinstall the test-machine from scratch :). 2.4.10
didn't had such bug, but after integrating the direct-io with the blkdev
inode physical address space the bug seen the light again. I should have
fixed the below way since the first place, at that time there were two
functions anyways and so it was less obvious the below was the right fix
(previously I just did a one liner to fix it (s/dev/rdev/)).
> --- linux.vanilla/fs/buffer.c Mon Dec 10 21:13:10 2001
> +++ linux/fs/buffer.c Mon Dec 10 20:59:34 2001
> @@ -2003,12 +2003,12 @@
> {
> int i, nr_blocks, retval;
> unsigned long * blocks = iobuf->blocks;
> + struct buffer_head bh;
>
> + bh.b_dev = inode->i_dev;
> nr_blocks = iobuf->length / blocksize;
> /* build the blocklist */
> for (i = 0; i < nr_blocks; i++, blocknr++) {
> - struct buffer_head bh;
> -
> bh.b_state = 0;
> bh.b_dev = inode->i_dev;
> bh.b_size = blocksize;
> @@ -2034,7 +2034,7 @@
> blocks[i] = bh.b_blocknr;
> }
>
> - retval = brw_kiovec(rw, 1, &iobuf, inode->i_dev, iobuf->blocks, blocksize);
> + retval = brw_kiovec(rw, 1, &iobuf, bh.b_dev, iobuf->blocks, blocksize);
>
> out:
> return retval;
>
>
> -- gotom
Andrea
next prev parent reply other threads:[~2001-12-10 14:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <w53bsh9ybtn.wl@megaela.fe.dis.titech.ac.jp>
2001-12-10 3:59 ` [PATCH] direct IO breaks root filesystem GOTO Masanori
2001-12-10 5:55 ` Linus Torvalds
2001-12-10 12:39 ` GOTO Masanori
2001-12-10 14:40 ` Andrea Arcangeli [this message]
2001-12-10 17:10 ` Linus Torvalds
2001-12-11 9:03 ` GOTO Masanori
2001-12-11 9:13 ` Alexander Viro
2001-12-11 11:30 ` GOTO Masanori
2001-12-11 17:26 ` Linus Torvalds
2001-12-11 17:37 ` Linus Torvalds
2001-12-11 18:03 ` Martin Dalecki
2001-12-12 0:25 ` Tachino Nobuhiro
2001-12-12 0:34 ` Linus Torvalds
2001-12-12 0:51 ` Tachino Nobuhiro
2001-12-12 1:46 ` Linus Torvalds
2001-12-12 2:46 ` Tachino Nobuhiro
2001-12-12 3:25 ` GOTO Masanori
2001-12-12 16:20 ` Marcelo Tosatti
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=20011210154057.J4801@athlon.random \
--to=andrea@suse.de \
--cc=gotom@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=torvalds@transmeta.com \
/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