]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make sure correct locator is used
authorYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 5 Mar 2012 20:37:05 +0000 (12:37 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Mon, 5 Mar 2012 23:00:39 +0000 (15:00 -0800)
Or more correct: locator is not used where not needed.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/rgw/rgw_common.h
src/rgw/rgw_op.cc

index 0d9f9ab86673b716842132d4ccf53390711c8d62..328685dcd4d9c04a79a974aab5613bf47766f938 100644 (file)
@@ -714,6 +714,7 @@ public:
     bucket = b;
     set_ns(n);
     set_obj(o);
+    reset_key();
   }
   int set_ns(const char *n) {
     if (!n)
@@ -734,6 +735,11 @@ public:
     key = k;
   }
 
+  void reset_key() {
+    orig_key.clear();
+    key.clear();
+  }
+
   void set_obj(string& o) {
     orig_obj = o;
     if (ns.empty()) {
index ed4e9d04b5b72406a98c88df83e06b0719a08f07..b15cec80cbc66eba3614dfabfbb0a15e66a1dde4 100644 (file)
@@ -213,9 +213,10 @@ static int read_policy(struct req_state *s, RGWBucketInfo& bucket_info, RGWAcces
   if (!oid.empty() && !upload_id.empty()) {
     RGWMPObj mp(oid, upload_id);
     oid = mp.get_meta();
-    obj.set_ns(mp_ns);
+    obj.init_ns(bucket, oid, mp_ns);
+  } else {
+    obj.init(bucket, oid);
   }
-  obj.init(bucket, oid);
   int ret = get_policy_from_attr(s->obj_ctx, policy, obj);
   if (ret == -ENOENT && object.size()) {
     /* object does not exist checking the bucket's ACL to make sure
@@ -779,13 +780,11 @@ int RGWPutObjProcessor_Atomic::prepare(struct req_state *s)
   string oid = s->object_str;
   head_obj.init(s->bucket, s->object_str);
 
-  obj.set_ns(shadow_ns);
-
   char buf[33];
   gen_rand_alphanumeric(buf, sizeof(buf) - 1);
   oid.append("_");
   oid.append(buf);
-  obj.init(s->bucket, oid);
+  obj.init_ns(s->bucket, oid, shadow_ns);
 
   return 0;
 }