]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore::_collection_rename: fix global replay guard
authorSamuel Just <sam.just@inktank.com>
Tue, 23 Jul 2013 20:51:26 +0000 (13:51 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 25 Jul 2013 17:33:40 +0000 (10:33 -0700)
If the replay is being replayed, we might have already
performed the rename, skip it.  Also, we must set the
collection replay guard only after we have done the
rename.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/os/FileStore.cc

index 17105c11d69b0b7b147fa2287c2e0b0542eef388..4e4847e69170e3cfde0105d593a97b5fd66e8d66 100644 (file)
@@ -4304,9 +4304,6 @@ int FileStore::_collection_rename(const coll_t &cid, const coll_t &ncid,
   get_cdir(cid, old_coll, sizeof(old_coll));
   get_cdir(ncid, new_coll, sizeof(new_coll));
 
-  _set_global_replay_guard(cid, spos);
-  _set_replay_guard(cid, spos);
-
   if (_check_replay_guard(cid, spos) < 0) {
     return 0;
   }
@@ -4315,6 +4312,16 @@ int FileStore::_collection_rename(const coll_t &cid, const coll_t &ncid,
     return _collection_remove_recursive(cid, spos);
   }
 
+  if (!collection_exists(cid)) {
+    if (replaying) {
+      // already happened
+      return 0;
+    } else {
+      return -ENOENT;
+    }
+  }
+  _set_global_replay_guard(cid, spos);
+
   int ret = 0;
   if (::rename(old_coll, new_coll)) {
     if (replaying && !btrfs_stable_commits &&