]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clear newly_removed_snaps on osdmap update if unchanged
authorSage Weil <sage@newdream.net>
Wed, 9 Jun 2010 04:36:56 +0000 (21:36 -0700)
committerSage Weil <sage@newdream.net>
Wed, 9 Jun 2010 04:36:56 +0000 (21:36 -0700)
We only want to apply _newly_ removed snaps once, or else we try to trim
the same snaps multiple times, and crash like so

./include/interval_set.h: In function 'void interval_set<T>::insert(T, T) [with T = snapid_t]':
./include/interval_set.h:202: FAILED assert(0)
 1: (interval_set<snapid_t>::insert(snapid_t, snapid_t)+0x12c) [0x6b1728]
 2: (interval_set<snapid_t>::insert(snapid_t)+0x2f) [0x6b195d]
 3: (ReplicatedPG::snap_trimmer()+0x1c02) [0x66d5d6]
 4: (OSD::SnapTrimWQ::_process(PG*)+0x24) [0x6dc2ac]
 5: (ThreadPool::WorkQueue<PG>::_void_process(void*)+0x28) [0x6fa28a]
 6: (ThreadPool::worker()+0x23a) [0x7f57a4]
 7: (ThreadPool::WorkThread::entry()+0x19) [0x73e9b1]
 8: (Thread::_entry_func(void*)+0x20) [0x6508a4]
 9: /lib/libpthread.so.0 [0x7fa2707dc73a]
 10: (clone()+0x6d) [0x7fa26fa0669d]

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

index 6d64afd1cde13d3ff5ed6ef3a030863a44562102..1e7427692106aab7662635f3dede7f658f228a5b 100644 (file)
@@ -2193,18 +2193,20 @@ void OSD::handle_osd_map(MOSDMap *m)
        dout(10) << " pool " << p->first << " appears to have been deleted" << dendl;
        continue;
       }
+      PGPool *pool = p->second;
       if (pi->get_snap_epoch() == cur+1) {
-       PGPool *pool = p->second;
        pi->build_removed_snaps(pool->newly_removed_snaps);
        pool->newly_removed_snaps.subtract(pool->cached_removed_snaps);
        pool->cached_removed_snaps.union_of(pool->newly_removed_snaps);
-       dout(10) << "   pool " << p->first << " removed_snaps " << pool->cached_removed_snaps
+       dout(10) << " pool " << p->first << " removed_snaps " << pool->cached_removed_snaps
                 << ", newly so are " << pool->newly_removed_snaps << ")"
                 << dendl;
        pool->info = *pi;
        pool->snapc = pi->get_snap_context();
       } else {
-       dout(10) << " pool " << p->first << " unchanged (snap_epoch = " << pi->get_snap_epoch() << ")" << dendl;
+       dout(10) << " pool " << p->first << " removed snaps " << pool->cached_removed_snaps
+                << ", unchanged (snap_epoch = " << pi->get_snap_epoch() << ")" << dendl;
+       pool->newly_removed_snaps.clear();
       }
     }