handle_reply() calls complete_request() only if the first OSD reply
has ONDISK flag.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
s32 r_reply_op_result[CEPH_OSD_MAX_OP];
int r_got_reply;
int r_linger;
s32 r_reply_op_result[CEPH_OSD_MAX_OP];
int r_got_reply;
int r_linger;
struct ceph_osd_client *r_osdc;
struct kref r_kref;
struct ceph_osd_client *r_osdc;
struct kref r_kref;
for (i = 0; i < numops; i++)
req->r_reply_op_result[i] = ceph_decode_32(&p);
for (i = 0; i < numops; i++)
req->r_reply_op_result[i] = ceph_decode_32(&p);
+ already_completed = req->r_got_reply;
+
if (!req->r_got_reply) {
req->r_result = result;
if (!req->r_got_reply) {
req->r_result = result;
((flags & CEPH_OSD_FLAG_WRITE) == 0))
__unregister_request(osdc, req);
((flags & CEPH_OSD_FLAG_WRITE) == 0))
__unregister_request(osdc, req);
- already_completed = req->r_completed;
- req->r_completed = 1;
mutex_unlock(&osdc->request_mutex);
mutex_unlock(&osdc->request_mutex);
- if (already_completed)
- goto done;
- if (req->r_callback)
- req->r_callback(req, msg);
- else
- complete_all(&req->r_completion);
+ if (!already_completed) {
+ if (req->r_callback)
+ req->r_callback(req, msg);
+ else
+ complete_all(&req->r_completion);
+ }
if (flags & CEPH_OSD_FLAG_ONDISK)
complete_request(req);
if (flags & CEPH_OSD_FLAG_ONDISK)
complete_request(req);
__register_request(osdc, req);
req->r_sent = 0;
req->r_got_reply = 0;
__register_request(osdc, req);
req->r_sent = 0;
req->r_got_reply = 0;
rc = __map_request(osdc, req, 0);
if (rc < 0) {
if (nofail) {
rc = __map_request(osdc, req, 0);
if (rc < 0) {
if (nofail) {