]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: read_user_buckets() fix redone
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 20 Jan 2012 20:54:14 +0000 (12:54 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 20 Jan 2012 20:56:36 +0000 (12:56 -0800)
The problem with the original fix is that it wasn't atomic. Going back
to the original inefficient (though atomic) method. We should limit
the number of buckets per user anyway, and shouldn't get into a point
where this code is actually execised.

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

index 340cd32c4aec7ddb5dd6304d544eeb6287d1b768..25428ada18c75bc1999698bc98939fe096bf4fd7 100644 (file)
@@ -223,8 +223,7 @@ int rgw_read_user_buckets(string user_id, RGWUserBuckets& buckets, bool need_sta
     rgw_obj obj(ui_uid_bucket, buckets_obj_id);
 
     do {
-      bufferlist more;
-      ret = rgwstore->read(NULL, obj, ofs, len, more);
+      ret = rgwstore->read(NULL, obj, ofs, len, bl);
       if (ret == -ENOENT) {
         /* try to read the old format */
         ret = rgw_read_buckets_from_attr(user_id, buckets);
@@ -239,14 +238,11 @@ int rgw_read_user_buckets(string user_id, RGWUserBuckets& buckets, bool need_sta
       if (ret < 0)
         return ret;
 
-      size_t read_len = more.length();
-
-      bl.claim_append(more);
-
-      if (read_len != len)
+      if (bl.length() != len)
         break;
 
-      ofs += len;
+      bl.clear();
+      len *= 2;
     } while (1);
 
     bufferlist::iterator p = bl.begin();