Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 16 Dec 2001 03:17:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 16 Dec 2001 03:17:49 -0500 Received: from megaela.fe.dis.titech.ac.jp ([131.112.171.110]:28423 "HELO megaela.srvf.org") by vger.kernel.org with SMTP id ; Sun, 16 Dec 2001 03:17:41 -0500 Date: Sun, 16 Dec 2001 17:17:33 +0900 Message-ID: From: GOTO Masanori To: Andrew Morton Cc: Suresh Gopalakrishnan , linux-kernel@vger.kernel.org, Andrea Arcangeli , gotom@debian.org Subject: Re: O_DIRECT wierd behavior.. In-Reply-To: <3C1C382A.946EA61B@zip.com.au> In-Reply-To: <3C1C382A.946EA61B@zip.com.au> User-Agent: Wanderlust/2.7.6 (Too Funky) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/20.7 (i386-debian-linux-gnu) MULE/4.1 (AOI) MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Sat, 15 Dec 2001 21:59:06 -0800, Andrew Morton wrote: > Then the kernel screws up the error handling, and ends up > setting the file size to -EINVAL (ie: rather large). > > 1: We're testing `written >= 0', but it is unsigned (!). In two > places. > > This one, IMO is a gcc shortcoming. The compiler is capable of warning > about expressions which always evaluate to true or false in `if' statements, > but turning this on also enables lots of things you don't want it to warn about. > gcc needs to provide finer control of its warning capabilities. I patched > gcc-2.7.2.3 to do this ages back and it was very useful. > > 2: If generic_osync_inode() returns an error, we fail to report it. In > two places. > > Here's a quick fix. It needs a review. > > --- linux-2.4.17-rc1/mm/filemap.c Thu Dec 13 14:07:55 2001 > +++ linux-akpm/mm/filemap.c Sat Dec 15 21:52:06 2001 > @@ -3038,8 +3038,11 @@ unlock: > /* For now, when the user asks for O_SYNC, we'll actually > * provide O_DSYNC. */ > if (status >= 0) { > - if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) > + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) { > status = generic_osync_inode(inode, OSYNC_METADATA|OSYNC_DATA); > + if (status < 0) > + written = 0; /* Return the right thing */ > + } > } Right. If generic_osync_inode returns error, it must be needed. This patch seems ok than my patch... -- gotom - 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/