Commit 619d5d8a authored by Jeff Mahoney's avatar Jeff Mahoney Committed by 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: default avatarJeff 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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a44c94a7
...@@ -1546,10 +1546,10 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t ...@@ -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)) if (likely(res >= 0) &&
res = (unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode))))
generic_osync_inode(inode, file->f_mapping, res = generic_osync_inode(inode, file->f_mapping,
OSYNC_METADATA | OSYNC_DATA); OSYNC_METADATA | OSYNC_DATA);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
reiserfs_async_progress_wait(inode->i_sb); reiserfs_async_progress_wait(inode->i_sb);
......
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