Skip to content

Commit 7d7d51c

Browse files
Alex ElderSage Weil
authored andcommitted
ceph: let osd client clean up for interrupted request
In ceph_sync_write(), if a safe callback is supplied with a request, and an error is returned by ceph_osdc_wait_request(), a block of code is executed to remove the request from the unsafe writes list and drop references to capabilities acquired just prior to a call to ceph_osdc_wait_request(). The only function used for this callback is sync_write_commit(), and it does *exactly* what that block of error handling code does. Now in ceph_osdc_wait_request(), if an error occurs (due to an interupt during a wait_for_completion_interruptible() call), complete_request() gets called, and that calls the request's safe_callback method if it's defined. So this means that this cleanup activity gets called twice in this case, which is erroneous (and in fact leads to a crash). Fix this by just letting the osd client handle the cleanup in the event of an interrupt. This resolves one problem mentioned in: http://tracker.ceph.com/issues/4706 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Yan, Zheng <zheng.z.yan@intel.com>
1 parent 0b93267 commit 7d7d51c

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

‎fs/ceph/file.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
595595
}
596596

597597
ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
598-
if (ret < 0 && req->r_safe_callback) {
599-
spin_lock(&ci->i_unsafe_lock);
600-
list_del_init(&req->r_unsafe_item);
601-
spin_unlock(&ci->i_unsafe_lock);
602-
ceph_put_cap_refs(ci, CEPH_CAP_FILE_WR);
603-
}
604598
}
605599

606600
if (file->f_flags & O_DIRECT)

0 commit comments

Comments
 (0)