Skip to content

Commit

Permalink
ceph: don't clobber write return value when using O_SYNC
Browse files Browse the repository at this point in the history
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Yehuda Sadeh authored and Sage Weil committed Feb 23, 2010
1 parent a1ea787 commit 88d892a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
struct ceph_osd_client *osdc = &ceph_client(inode->i_sb)->osdc;
loff_t endoff = pos + iov->iov_len;
int got = 0;
int ret;
int ret, err;

if (ceph_snap(inode) != CEPH_NOSNAP)
return -EROFS;
Expand Down Expand Up @@ -838,9 +838,12 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,

if ((ret >= 0 || ret == -EIOCBQUEUED) &&
((file->f_flags & O_SYNC) || IS_SYNC(file->f_mapping->host)
|| ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL)))
ret = vfs_fsync_range(file, file->f_path.dentry,
|| ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL))) {
err = vfs_fsync_range(file, file->f_path.dentry,
pos, pos + ret - 1, 1);
if (err < 0)
ret = err;
}
}
if (ret >= 0) {
spin_lock(&inode->i_lock);
Expand Down

0 comments on commit 88d892a

Please sign in to comment.