From: Andrew Morton <akpm@osdl.org>
To: Hifumi Hisashi <hifumi.hisashi@lab.ntt.co.jp>
Cc: sct@redhat.com, adilger@clusterfs.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-aio@kvack.org
Subject: Re: [PATCH] Fix the error handling in direct I/O
Date: Fri, 24 Jun 2005 15:55:04 -0700 [thread overview]
Message-ID: <20050624155504.20b7a51e.akpm@osdl.org> (raw)
In-Reply-To: <6.0.0.20.2.20050622211238.03e6ba30@mailsv2.y.ecl.ntt.co.jp>
Hifumi Hisashi <hifumi.hisashi@lab.ntt.co.jp> wrote:
>
> Hello.
>
> I fixed a bug on error handling in the direct I/O function.
> Currenlty, if a file is opened with the O_DIRECT|O_SYNC flag,
> write() syscall cannot receive the EIO error just after
> I/O error(SCSI cable is disconnected etc.) occur.
>
> Return values of other points that call generic_osync_inode()
> are treated appropriately.
>
> With the following patch, this problem was fixed.
> Please apply this patch.
>
> Thanks,
>
>
> Signed-off-by: Hisashi Hifumi <hifumi.hisashi@lab.ntt.co.jp>
>
> diff -Nru linux-2.6.12/mm/filemap.c linux-2.6.12_fix/mm/filemap.c
> --- linux-2.6.12/mm/filemap.c 2005-06-22 17:21:21.000000000 +0900
> +++ linux-2.6.12_fix/mm/filemap.c 2005-06-22 20:26:34.000000000 +0900
> @@ -1927,8 +1927,12 @@
> * i_sem is held, which protects generic_osync_inode() from
> * livelocking.
> */
> - if (written >= 0 && file->f_flags & O_SYNC)
> - generic_osync_inode(inode, mapping, OSYNC_METADATA);
> + if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) {
> + int err;
> + err = generic_osync_inode(inode, mapping, OSYNC_METADATA);
> + if (err < 0)
> + written = err;
> + }
> if (written == count && !is_sync_kiocb(iocb))
> written = -EIOCBQUEUED;
> return written;
Yes, I suppose so.
I note that generic_file_aio_write_nolock() for O_SYNC or IS_SYNC will end
up calling generic_osync_inode() twice. Once in sync_page_range_nolock()
and once in __generic_file_aio_write_nolock->generic_file_direct_write or
in __generic_file_aio_write_nolock->generic_file_buffered_write
It's all a bit of a mess. I guess we should sit down and work out where we
actually want to do all this syncing and get it done consistently and
completely, all at the same level. A filemap.c call graph would be needed :(
prev parent reply other threads:[~2005-06-24 22:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 12:49 Hifumi Hisashi
2005-06-24 22:55 ` Andrew Morton [this message]
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=20050624155504.20b7a51e.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=adilger@clusterfs.com \
--cc=hifumi.hisashi@lab.ntt.co.jp \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
/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
all inboxes | Powered by JetHome®