From da6b44a6e47399493adae53ad3c36a029f1e2a23 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Tue, 19 Apr 2016 15:20:53 +0200 Subject: [PATCH] rgw_op: pass delete bucket op to master zone first Basically first ask the master to process a delete bucket request before we process it in the zone locally, otherwise we reach a situation where we drop the bucket locally and master will still maintain an index Fixes: http://tracker.ceph.com/issues/15540 Signed-off-by: Abhishek Lekshmanan --- src/rgw/rgw_op.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index d0508213069b7..a2202caf07518 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2113,6 +2113,20 @@ void RGWDeleteBucket::execute() ldout(s->cct, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl; } + if (!store->is_meta_master()) { + bufferlist in_data; + op_ret = forward_request_to_master(s, &ot.read_version, store, in_data, + NULL); + if (op_ret < 0) { + if (op_ret == -ENOENT) { + /* adjust error, we want to return with NoSuchBucket and not + * NoSuchKey */ + op_ret = -ERR_NO_SUCH_BUCKET; + } + return; + } + } + op_ret = store->delete_bucket(s->bucket, ot); if (op_ret == 0) { op_ret = rgw_unlink_bucket(store, s->user->user_id, s->bucket.tenant, @@ -2127,19 +2141,6 @@ void RGWDeleteBucket::execute() return; } - if (!store->is_meta_master()) { - bufferlist in_data; - op_ret = forward_request_to_master(s, &ot.read_version, store, in_data, - NULL); - if (op_ret < 0) { - if (op_ret == -ENOENT) { - /* adjust error, we want to return with NoSuchBucket and not - * NoSuchKey */ - op_ret = -ERR_NO_SUCH_BUCKET; - } - return; - } - } } -- 2.39.5