Re: [PATCH] direct IO breaks root filesystem

From: Tachino Nobuhiro (tachino@open.nm.fujitsu.co.jp)
Date: Tue Dec 11 2001 - 19:25:33 EST


Hello,

At Tue, 11 Dec 2001 09:37:37 -0800 (PST),
Linus Torvalds wrote:
>
>
> On Tue, 11 Dec 2001, GOTO Masanori wrote:
> >
> > Accessing with inode size unit (== 4096 byte) is ok, but if I accessed
> > with block size unit, generic_direct_IO() returns error. The reason
> > is that blocksize is designated as inode->i_blkbits, and its value is
> > not disk minimal block size (512), but inode's unit size (4096).
>
> Actually, I now found the _real_ bug that explains both the "inode->i_dev"
> _and_ the block size problem.
>
> We have the wrong inode.
>
> We use the on-disk inode, which is NOT the same as the "mapping" inode for
> actually doing the IO.
>
> This simple (and completely untested) patch should fix it.
>
> This two-liner should also actually make the previous patch completely
> unnecessary, because now "inode->i_dev" should be automatically correct. I
> should have realized that inode->i_dev should always be right, and have
> thought more about the fact that it wasn't.

  Your patch will break Goto's fix because mapping->host does not have
correct i_mode. The patch below is for 2.4.17, I think it works on 2.5.1.

diff -Nur linux-2.4.17-pre7.org/fs/block_dev.c linux-2.4.17-pre7/fs/block_dev.c
--- linux-2.4.17-pre7.org/fs/block_dev.c Mon Dec 10 17:34:52 2001
+++ linux-2.4.17-pre7/fs/block_dev.c Mon Dec 10 17:48:21 2001
@@ -329,6 +329,7 @@
                         inode->i_bdev = new_bdev;
                         inode->i_data.a_ops = &def_blk_aops;
                         inode->i_data.gfp_mask = GFP_USER;
+ inode->i_mode = S_IFBLK;
                         spin_lock(&bdev_lock);
                         bdev = bdfind(dev, head);
                         if (!bdev) {

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



This archive was generated by hypermail 2b29 : Sat Dec 15 2001 - 21:00:22 EST