From 96067588b4a18671a15465adb3cf21180c881468 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 31 Mar 2011 11:39:35 -0700 Subject: [PATCH] rgw: recover from partial bucket creates Signed-off-by: Sage Weil --- src/rgw/rgw_op.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index a24a6a8b4f877..8a1fa2eaed819 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -314,12 +314,14 @@ void RGWCreateBucket::execute() attrs[RGW_ATTR_ACL] = aclbl; ret = rgw_add_bucket(s->user.user_id, s->bucket_str); - if (ret) + /* continue if EEXIST and create_bucket will fail below. this way we can recover + * from a partial create by retrying it. */ + if (ret && ret != -EEXIST) goto done; ret = rgwstore->create_bucket(s->user.user_id, s->bucket_str, attrs, s->user.auid); - if (ret) + if (ret && ret != -EEXIST) /* if it exists, don't remove it! */ rgw_remove_bucket(s->user.user_id, s->bucket_str); done: -- 2.39.5