提交 619d5d8a 编写于 作者: J Jeff Mahoney 提交者: Linus Torvalds

[PATCH] reiserfs: reiserfs_file_write() will lose error code when a 0-length write occurs w/ O_SYNC

When an error occurs in reiserfs_file_write before any data is written, and
O_SYNC is set, the return code of generic_osync_write will overwrite the
error code, losing it.

This patch ensures that generic_osync_inode() doesn't run under an error
condition, losing the error.  This duplicates the logic from
generic_file_buffered_write().
Signed-off-by: NJeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <mason@suse.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Alexander Zarochentsev <zam@namesys.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a44c94a7
......@@ -1546,10 +1546,10 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
}
}
if ((file->f_flags & O_SYNC) || IS_SYNC(inode))
res =
generic_osync_inode(inode, file->f_mapping,
OSYNC_METADATA | OSYNC_DATA);
if (likely(res >= 0) &&
(unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode))))
res = generic_osync_inode(inode, file->f_mapping,
OSYNC_METADATA | OSYNC_DATA);
mutex_unlock(&inode->i_mutex);
reiserfs_async_progress_wait(inode->i_sb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册