Skip to content

Commit

Permalink
ceph: Move the place for EOLDSNAPC handle in ceph_aio_write to easily…
Browse files Browse the repository at this point in the history
… understand

Only for ceph_sync_write, the osd can return EOLDSNAPC.so move the
related codes after the call ceph_sync_write.

Signed-off-by: Jianpeng Ma <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
majianpeng authored and Sage Weil committed Aug 10, 2013
1 parent a158073 commit 0e5dd45
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,15 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
mutex_unlock(&inode->i_mutex);
written = ceph_sync_write(file, iov->iov_base, count,
pos, &iocb->ki_pos);
if (written == -EOLDSNAPC) {
dout("aio_write %p %llx.%llx %llu~%u"
"got EOLDSNAPC, retrying\n",
inode, ceph_vinop(inode),
pos, (unsigned)iov->iov_len);
mutex_lock(&inode->i_mutex);
hold_mutex = true;
goto retry_snap;
}
} else {
written = generic_file_buffered_write(iocb, iov, nr_segs,
pos, &iocb->ki_pos,
Expand Down Expand Up @@ -796,13 +805,6 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
written = err;
}

if (written == -EOLDSNAPC) {
dout("aio_write %p %llx.%llx %llu~%u got EOLDSNAPC, retrying\n",
inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len);
mutex_lock(&inode->i_mutex);
hold_mutex = true;
goto retry_snap;
}
out:
if (hold_mutex)
mutex_unlock(&inode->i_mutex);
Expand Down

0 comments on commit 0e5dd45

Please sign in to comment.