Skip to content

Commit

Permalink
[PATCH] reiserfs: reiserfs_file_write() will lose error code when a 0…
Browse files Browse the repository at this point in the history
…-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: Jeff 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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jeff Mahoney authored and Linus Torvalds committed Mar 25, 2006
1 parent a44c94a commit 619d5d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/reiserfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 619d5d8

Please sign in to comment.