From 96108c657c5843fc7e3fdfeb35a65f2bead181c3 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Fri, 27 Apr 2012 00:31:55 +0100 Subject: [PATCH] filestore: fix a journal replay issue with collection_add() Signed-off-by: Joao Eduardo Luis --- src/os/FileStore.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 8e32ba9805de5..2664bfb0da0d9 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -4543,6 +4543,14 @@ int FileStore::_collection_add(coll_t c, coll_t oldcid, const hobject_t& o, // open guard on object so we don't any previous operations on the // new name that will modify the source inode. int fd = lfn_open(oldcid, o, 0); + if (fd < 0) { + // the source collection/object does not exist. If we are replaying, we + // should be safe, so just return 0 and move on. + assert(replaying); + dout(10) << "collection_add " << c << "/" << o << " from " + << oldcid << "/" << o << " (dne, continue replay) " << dendl; + return 0; + } assert(fd >= 0); if (dstcmp > 0) { // if dstcmp == 0 the guard already says "in-progress" _set_replay_guard(fd, spos, true); -- 2.39.5