Commit 619d5d8a authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds
Browse files

[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
Signed-off-by: default avatarJeff Mahoney <>
Cc: Chris Mason <>
Cc: Jeff Mahoney <>
Cc: Alexander Zarochentsev <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 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,
if (likely(res >= 0) &&
(unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode))))
res = generic_osync_inode(inode, file->f_mapping,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment