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>
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);
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();