diff options
-rw-r--r-- | src/rgw/rgw_bucket.cc | 21 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 21 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 6 |
3 files changed, 32 insertions, 16 deletions
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index d4cfdc88e64..8de5a3d101f 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -93,8 +93,10 @@ int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t new_bucket.creation_time = creation_time; ::encode(new_bucket, bl); + map<string, bufferlist> attrs; + if (update_entrypoint) { - ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL); + ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL, &attrs); if (ret < 0 && ret != -ENOENT) { ldout(store->ctx(), 0) << "ERROR: store->get_bucket_entrypoint_info() returned " << ret << dendl; } else if (ret >= 0 && ep.linked && ep.owner != user_id) { @@ -119,7 +121,7 @@ int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t ep.linked = true; ep.owner = user_id; - ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0); + ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0, &attrs); if (ret < 0) goto done_err; @@ -153,7 +155,8 @@ int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name RGWBucketEntryPoint ep; RGWObjVersionTracker ot; - ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL); + map<string, bufferlist> attrs; + ret = store->get_bucket_entrypoint_info(NULL, bucket_name, ep, &ot, NULL, &attrs); if (ret == -ENOENT) return 0; if (ret < 0) @@ -168,7 +171,7 @@ int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name } ep.linked = false; - ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0); + ret = store->put_bucket_entrypoint_info(bucket_name, ep, false, ot, 0, &attrs); if (ret < 0) return ret; @@ -1381,8 +1384,9 @@ public: RGWBucketEntryPoint be; time_t mtime; + map<string, bufferlist> attrs; - int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &ot, &mtime); + int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &ot, &mtime, &attrs); if (ret < 0) return ret; @@ -1398,16 +1402,17 @@ public: decode_json_obj(be, obj); time_t orig_mtime; + map<string, bufferlist> attrs; RGWObjVersionTracker old_ot; - int ret = store->get_bucket_entrypoint_info(NULL, entry, old_be, &old_ot, &orig_mtime); + int ret = store->get_bucket_entrypoint_info(NULL, entry, old_be, &old_ot, &orig_mtime, &attrs); if (ret < 0 && ret != -ENOENT) return ret; objv_tracker.read_version = old_ot.read_version; /* maintain the obj version we just read */ - ret = store->put_bucket_entrypoint_info(entry, be, false, objv_tracker, mtime); + ret = store->put_bucket_entrypoint_info(entry, be, false, objv_tracker, mtime, &attrs); if (ret < 0) return ret; @@ -1429,7 +1434,7 @@ public: int remove(RGWRados *store, string& entry, RGWObjVersionTracker& objv_tracker) { RGWBucketEntryPoint be; - int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &objv_tracker, NULL); + int ret = store->get_bucket_entrypoint_info(NULL, entry, be, &objv_tracker, NULL, NULL); if (ret < 0) return ret; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 31400dc8402..0c7b22a42d3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4583,11 +4583,12 @@ int RGWRados::get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo int RGWRados::get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, - time_t *pmtime) + time_t *pmtime, + map<string, bufferlist> *pattrs) { bufferlist bl; - int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, NULL); + int ret = rgw_get_system_obj(this, ctx, zone.domain_root, bucket_name, bl, objv_tracker, pmtime, pattrs); if (ret < 0) { return ret; } @@ -4610,7 +4611,7 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf RGWBucketEntryPoint entry_point; time_t ep_mtime; RGWObjVersionTracker ot; - int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime); + int ret = get_bucket_entrypoint_info(ctx, bucket_name, entry_point, &ot, &ep_mtime, pattrs); if (ret < 0) { info.bucket.name = bucket_name; /* only init this field */ return ret; @@ -4623,6 +4624,13 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf return 0; } + /* data is in the bucket instance object, we need to get attributes from there, clear everything + * that we got + */ + if (pattrs) { + pattrs->clear(); + } + ldout(cct, 20) << "rgw_get_bucket_info: bucket instance: " << entry_point.bucket << dendl; if (pattrs) @@ -4643,11 +4651,12 @@ int RGWRados::get_bucket_info(void *ctx, string& bucket_name, RGWBucketInfo& inf } int RGWRados::put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, - bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime) + bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime, + map<string, bufferlist> *pattrs) { bufferlist epbl; ::encode(entry_point, epbl); - return rgw_bucket_store_info(this, bucket_name, epbl, exclusive, NULL, &objv_tracker, mtime); + return rgw_bucket_store_info(this, bucket_name, epbl, exclusive, pattrs, &objv_tracker, mtime); } int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, @@ -4692,7 +4701,7 @@ int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, time_t *pep_objv = ot.write_version; } } - ret = put_bucket_entrypoint_info(info.bucket.name, entry_point, exclusive, ot, mtime); + ret = put_bucket_entrypoint_info(info.bucket.name, entry_point, exclusive, ot, mtime, NULL); if (ret < 0) return ret; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 6422c182adc..c9924e0dc56 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1286,9 +1286,11 @@ public: void get_bucket_instance_entry(rgw_bucket& bucket, string& entry); void get_bucket_meta_oid(rgw_bucket& bucket, string& oid); - int put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime); + int put_bucket_entrypoint_info(const string& bucket_name, RGWBucketEntryPoint& entry_point, bool exclusive, RGWObjVersionTracker& objv_tracker, time_t mtime, + map<string, bufferlist> *pattrs); int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, time_t mtime, map<string, bufferlist> *pattrs); - int get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime); + int get_bucket_entrypoint_info(void *ctx, const string& bucket_name, RGWBucketEntryPoint& entry_point, RGWObjVersionTracker *objv_tracker, time_t *pmtime, + map<string, bufferlist> *pattrs); int get_bucket_instance_info(void *ctx, const string& meta_key, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs); int get_bucket_instance_info(void *ctx, rgw_bucket& bucket, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs); int get_bucket_instance_from_oid(void *ctx, string& oid, RGWBucketInfo& info, time_t *pmtime, map<string, bufferlist> *pattrs); |