]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filejournal: reset last_commited_seq if we find journal to be invalid
authorSage Weil <sage@newdream.net>
Wed, 8 Dec 2010 23:53:13 +0000 (15:53 -0800)
committerSage Weil <sage@newdream.net>
Thu, 9 Dec 2010 02:10:49 +0000 (18:10 -0800)
If we read an event that's later than our expected entry, we set read_pos
to -1 and discard the journal.  If that happens we also need to reset
last_committed_seq to avoid a crash like

2010-12-08 17:04:39.246950 7f269d138910 journal commit_finish thru 16904
2010-12-08 17:04:39.246961 7f269d138910 journal committed_thru 16904 < last_committed_seq 37778589
os/FileJournal.cc: In function 'virtual void FileJournal::committed_thru(uint64_t)':
os/FileJournal.cc:854: FAILED assert(seq >= last_committed_seq)
 ceph version 0.24~rc (commit:fe10300317383ec29948d7dbe3cb31b3aa277e3c)
 1: (FileJournal::committed_thru(unsigned long)+0xad) [0x588e7d]
 2: (JournalingObjectStore::commit_finish()+0x8c) [0x57f2ec]
 3: (FileStore::sync_entry()+0xcff) [0x5764cf]
 4: (FileStore::SyncThread::entry()+0xd) [0x506d9d]
 5: (Thread::_entry_func(void*)+0xa) [0x4790ba]
 6: /lib/libpthread.so.0 [0x7f26a2f8373a]
 7: (clone()+0x6d) [0x7f26a1c2569d]

Fixes #631

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

index 3bb38a887ad1694c8fb004e0074574b3715f0798..67342b4305a9e7408e7c1b595f64f5dbd143732f 100644 (file)
@@ -347,8 +347,12 @@ int FileJournal::open(uint64_t next_seq)
       break;
     }
     if (seq > next_seq) {
-      dout(10) << "open entry " << seq << " len " << bl.length() << " > next_seq " << next_seq << dendl;
+      dout(10) << "open entry " << seq << " len " << bl.length() << " > next_seq " << next_seq
+              << ", ignoring journal contents"
+              << dendl;
       read_pos = -1;
+      last_committed_seq = 0;
+      seq = 0;
       return 0;
     }
     if (seq == next_seq) {