Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 11 Dec 2001 19:25:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 11 Dec 2001 19:25:48 -0500 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:32427 "EHLO fgwmail7.fujitsu.co.jp") by vger.kernel.org with ESMTP id ; Tue, 11 Dec 2001 19:25:40 -0500 Date: Wed, 12 Dec 2001 09:25:33 +0900 Message-ID: From: Tachino Nobuhiro To: Linus Torvalds Cc: GOTO Masanori , , , Subject: Re: [PATCH] direct IO breaks root filesystem In-Reply-To: In-Reply-To: User-Agent: Wanderlust/2.7.6 (Too Funky) EMIKO/1.14.1 (Choanoflagellata) LIMIT/1.14.7 (Fujiidera) APEL/10.3 Emacs/21.1 (i586-kondara-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by EMIKO 1.14.1 - "Choanoflagellata") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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/