From: Andrew Morton <akpm@zip.com.au>
To: GOTO Masanori <gotom@debian.org>
Cc: Suresh Gopalakrishnan <gsuresh@cs.rutgers.edu>,
linux-kernel@vger.kernel.org, Andrea Arcangeli <andrea@suse.de>
Subject: Re: O_DIRECT wierd behavior..
Date: Sun, 16 Dec 2001 00:46:29 -0800 [thread overview]
Message-ID: <3C1C5F65.A060B285@zip.com.au> (raw)
In-Reply-To: <3C1C382A.946EA61B@zip.com.au>, <Pine.GSO.4.02A.10112151947010.14453-100000@aramis.rutgers.edu> <3C1C382A.946EA61B@zip.com.au> <wtwwuzn4m02.wl@fe.dis.titech.ac.jp>
GOTO Masanori wrote:
>
> At Sat, 15 Dec 2001 21:59:06 -0800,
> Andrew Morton wrote:
> ...
> > --- 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...
Actually, I preferred your approach :)
Also, note how if ->commit_write() or ->prepare_write() return an
error, and we have already written some data, the function returns
the number of bytes written and no indication that there was an error.
According to the write(2) manpage, that's wrong.
Probably it is sufficient to make `written' a signed quantity
and to do:
out_status:
- err = written ? written : status;
+ err = status ? status : written;
I think that fixes the five or six bugs we've found so far in
this function. err.. make that six or seven. What is it trying
do if ->prepare_write() returns a non-zero, positive value?
It needs a big spring-clean. I'm afraid I don't have time to
do that for several days.
-
next prev parent reply other threads:[~2001-12-16 8:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-16 0:47 O_DIRECT wierd behavior Suresh Gopalakrishnan
2001-12-16 5:59 ` Andrew Morton
2001-12-16 8:17 ` GOTO Masanori
2001-12-16 8:46 ` Andrew Morton [this message]
2001-12-16 9:20 ` Suresh Gopalakrishnan
2001-12-16 13:57 ` Terje Eggestad
2001-12-16 17:43 ` Suresh Gopalakrishnan
2001-12-17 9:04 ` Terje Eggestad
2001-12-17 17:18 ` Andrea Arcangeli
2001-12-17 18:07 ` Hugh Dickins
2001-12-17 18:13 ` Andrea Arcangeli
2001-12-17 18:57 ` Andrew Morton
2001-12-17 19:26 ` Linus Torvalds
2001-12-17 19:53 ` Joel Becker
2001-12-17 19:59 ` Linus Torvalds
2001-12-17 20:20 ` Joel Becker
2001-12-17 20:38 ` Andre Hedrick
2001-12-26 14:54 ` Riley Williams
2001-12-16 6:29 ` GOTO Masanori
2002-01-20 4:16 ` multithreaded RPC handling Suresh Gopalakrishnan
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=3C1C5F65.A060B285@zip.com.au \
--to=akpm@zip.com.au \
--cc=andrea@suse.de \
--cc=gotom@debian.org \
--cc=gsuresh@cs.rutgers.edu \
--cc=linux-kernel@vger.kernel.org \
/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