File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -209,8 +209,36 @@ int RadosBucket::create(const DoutPrefixProvider* dpp,
209209 ldpp_dout (dpp, 0 ) << " WARNING: failed to unlink bucket: ret=" << ret
210210 << dendl;
211211 }
212- } else if (ret == -EEXIST || (ret == 0 && existed) ) {
212+ } else if (ret == -EEXIST) {
213213 ret = -ERR_BUCKET_EXISTS;
214+ } else if (ret == 0 ) {
215+ /* this is to handle the following race condition:
216+ * a concurrent DELETE bucket request deletes the bucket entry point and
217+ * unlinks it (if the bucket pre-exists) before it's linked in this
218+ * bucket creation request. */
219+
220+ if (existed) {
221+ ret = -ERR_BUCKET_EXISTS;
222+ }
223+
224+ RGWBucketEntryPoint ep;
225+ RGWObjVersionTracker objv_tracker;
226+ int r = store->ctl ()->bucket ->read_bucket_entrypoint_info (info.bucket ,
227+ &ep,
228+ y,
229+ dpp,
230+ RGWBucketCtl::Bucket::GetParams ()
231+ .set_objv_tracker (&objv_tracker));
232+ if (r == -ENOENT) {
233+ ret = 0 ;
234+
235+ ldpp_dout (dpp, 5 ) << " WARNING: the bucket entry point has been deleted by a concurrent DELETE bucket request."
236+ << " Unlinking the bucket." << dendl;
237+ r = unlink (dpp, params.owner , y);
238+ if (r < 0 ) {
239+ ldpp_dout (dpp, 0 ) << " WARNING: failed to unlink bucket: ret=" << r << dendl;
240+ }
241+ }
214242 }
215243
216244 return ret;
You can’t perform that action at this time.
0 commit comments