From ff52fa0ce73766c8154fdce55b5339ab68ab4c11 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Thu, 14 Apr 2016 18:23:26 +0200 Subject: [PATCH] rgw_op: return 503 if forward_req fails Return 503 for requests when we have a failure from forward_request_to_master, we can probably fine tune things a little here in the future by making rest_client and http_client return more correct error messages depending on various failures Fixes: http://tracker.ceph.com/issues/15501 Signed-off-by: Abhishek Lekshmanan --- src/rgw/rgw_op.cc | 3 ++- src/rgw/rgw_rest_client.cc | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index c781eb9ffd48..aea047046515 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1928,8 +1928,9 @@ void RGWCreateBucket::execute() if (!store->is_meta_master()) { JSONParser jp; op_ret = forward_request_to_master(s, NULL, store, in_data, &jp); - if (op_ret < 0) + if (op_ret < 0) { return; + } JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp); JSONDecoder::decode_json("object_ver", objv, &jp); diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 73cc12999de0..9be52d37af30 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -292,8 +292,13 @@ int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, siz } int r = process(new_info.method, new_url.c_str()); - if (r < 0) + if (r < 0){ + if (r == -EINVAL){ + // curl_easy has errored, generally means the service is not available + r = -ERR_SERVICE_UNAVAILABLE; + } return r; + } response.append((char)0); /* NULL terminate response */ -- 2.47.3