rgw: forward delete bucket request to master after removal

We can only forward the bucket removal to the master if it was
successfully removed locally.
The master region has no knowledge about whether the
bucket can be removed or not, e.g., there are still objects in the
bucket. If we send it to the master first, then it'll happily remove it
even though it might fail in the end.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
Yehuda Sadeh 2013-07-18 11:16:15 -07:00 committed by Greg Farnum
parent 989a4d93d8
commit 85f3f09b0a

View File

@ -1070,6 +1070,19 @@ void RGWDeleteBucket::execute()
if (!s->bucket_name)
return;
ret = store->delete_bucket(s->bucket, objv_tracker);
if (ret == 0) {
ret = rgw_unlink_bucket(store, s->user.user_id, s->bucket.name, false);
if (ret < 0) {
ldout(s->cct, 0) << "WARNING: failed to unlink bucket: ret=" << ret << dendl;
}
}
if (ret < 0) {
return;
}
if (!store->region.is_master) {
bufferlist in_data;
JSONParser jp;
@ -1085,14 +1098,6 @@ void RGWDeleteBucket::execute()
JSONDecoder::decode_json("object_ver", objv_tracker.read_version, &jp);
}
ret = store->delete_bucket(s->bucket, objv_tracker);
if (ret == 0) {
ret = rgw_unlink_bucket(store, s->user.user_id, s->bucket.name, false);
if (ret < 0) {
ldout(s->cct, 0) << "WARNING: failed to remove bucket: ret=" << ret << dendl;
}
}
}
int RGWPutObj::verify_permission()