// Tell the object store that this object is lost.
bufferlist b1;
int r = osd->store->getattr(coll, lost_soid, OI_ATTR, b1);
- auto_ptr < object_info_t > oi;
+
+ object_locator_t oloc;
+ oloc.clear();
+ oloc.pool = info.pgid.pool();
+ object_info_t oi(lost_soid, oloc, true);
+
if (r >= 0) {
// Some version of this lost object exists in our filestore.
- // So, we can fetch its attributes.
- oi.reset(new object_info_t(b1));
- oi->lost = true;
+ // So, we can fetch its attributes and preserve most of them.
+ oi = object_info_t(b1);
}
else {
- // We don't have any version of this object.
- // So we'll have to make up our own attributes
- object_locator_t oloc;
- oi.reset(new object_info_t(lost_soid, oloc, true));
-
- // And create the object in the filestore
+ // The object doesn't exist in the filestore yet. Make sure that
+ // we create it there.
t.touch(coll, lost_soid);
}
- oi->version.version++;
+ oi.lost = true;
+ oi.version = info.last_update;
bufferlist b2;
- oi->encode(b2);
+ oi.encode(b2);
t.setattr(coll, lost_soid, OI_ATTR, b2);
}