lkml.org 
[lkml]   [2001]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: O_DIRECT wierd behavior..
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/

\
 
 \ /
  Last update: 2005-03-22 13:18    [W:0.141 / U:3.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site