]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: drop not-quite-copy constructor for object_info_t
authorSage Weil <sage@newdream.net>
Mon, 6 Dec 2010 22:01:28 +0000 (14:01 -0800)
committerSage Weil <sage@newdream.net>
Mon, 6 Dec 2010 22:01:51 +0000 (14:01 -0800)
Making a copy-like constructor that doesn't actaully copy is confusing
and error prone.  In this case, we initialized a clone's object_info with
the head's snapid, causing problems with what info was encoded and crashing
later in the snap_trimmer.  Here the one caller already called
copy_user_bits(); let's move the lost copy there.

This backs out one of the changes in 0cc8d34e.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index 3878f64cf67017a695b75f440e650cb7d597537a..7723dbe39cca897961c627d204cd2bd1f673a6f3 100644 (file)
@@ -558,12 +558,12 @@ bool ReplicatedPG::snap_trimmer()
       bufferlist bl;
       osd->store->getattr(coll_t(info.pgid), coid, OI_ATTR, bl);
       object_info_t coi(bl);
+      vector<snapid_t>& snaps = coi.snaps;
 
       // get snap set context
       SnapSetContext *ssc = get_snapset_context(coid.oid, false);
       assert(ssc);
       SnapSet& snapset = ssc->snapset;
-      vector<snapid_t>& snaps = coi.snaps;
 
       dout(10) << coid << " snaps " << snaps << " old snapset " << snapset << dendl;
       assert(snapset.seq);
@@ -1703,7 +1703,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
       snaps[i] = snapc.snaps[i];
     
     // prepare clone
-    object_info_t static_snap_oi(oi);
+    object_info_t static_snap_oi(coid, oi.oloc);
     object_info_t *snap_oi;
     if (is_primary()) {
       ctx->clone_obc = new ObjectContext(static_snap_oi, true, NULL);
index f8302e2d2cace16661fe5098b26d2c60ce83a9b6..05dd887fadfd4fead30acfcd54de7faf3884ca0a 100644 (file)
@@ -1308,6 +1308,7 @@ struct object_info_t {
     last_reqid = other.last_reqid;
     truncate_seq = other.truncate_seq;
     truncate_size = other.truncate_size;
+    lost = other.lost;
   }
 
   void encode(bufferlist& bl) const {
@@ -1355,11 +1356,6 @@ struct object_info_t {
     decode(p);
   }
 
-  object_info_t(const object_info_t &rhs)
-    : soid(rhs.soid), oloc(rhs.oloc), size(rhs.size),
-      lost(rhs.lost), truncate_seq(rhs.truncate_seq),
-      truncate_size(rhs.truncate_size) {}
-
   object_info_t(const sobject_t& s, const object_locator_t& o)
     : soid(s), oloc(o), size(0),
       lost(false), truncate_seq(0), truncate_size(0) {}