diff options
author | Hifumi Hisashi <hifumi.hisashi@lab.ntt.co.jp> | 2005-06-25 17:54:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:25 -0400 |
commit | 1e8a81c5a37907bc082025d3468718116dca1eeb (patch) | |
tree | 0b9dae5a22d8caeab40a5e08150bfad27411cc41 | |
parent | b4819b593740a6d11db07b52e0fe35975b29a185 (diff) |
[PATCH] Fix the error handling in direct I/O
Fix a bug on error handling in the direct I/O function.
Currently, if a file is opened with the O_DIRECT|O_SYNC flag, the write()
syscall cannot receive the EIO error after an I/O error (SCSI cable is
disconnected etc.).
Return values of other points that call generic_osync_inode() are treated
appropriately.
Signed-off-by: Hisashi Hifumi <hifumi.hisashi@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 7332194d7afd..b573607b7112 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1851,8 +1851,11 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
1851 | * i_sem is held, which protects generic_osync_inode() from | 1851 | * i_sem is held, which protects generic_osync_inode() from |
1852 | * livelocking. | 1852 | * livelocking. |
1853 | */ | 1853 | */ |
1854 | if (written >= 0 && file->f_flags & O_SYNC) | 1854 | if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
1855 | generic_osync_inode(inode, mapping, OSYNC_METADATA); | 1855 | int err = generic_osync_inode(inode, mapping, OSYNC_METADATA); |
1856 | if (err < 0) | ||
1857 | written = err; | ||
1858 | } | ||
1856 | if (written == count && !is_sync_kiocb(iocb)) | 1859 | if (written == count && !is_sync_kiocb(iocb)) |
1857 | written = -EIOCBQUEUED; | 1860 | written = -EIOCBQUEUED; |
1858 | return written; | 1861 | return written; |