]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileStore: check replay guard on src for collection rename
authorSage Weil <sage@inktank.com>
Tue, 19 Feb 2013 01:39:46 +0000 (17:39 -0800)
committerSage Weil <sage@inktank.com>
Tue, 19 Feb 2013 18:41:09 +0000 (10:41 -0800)
This avoids a problematic sequence like:

     - rename A/ -> B/
     - remove B/1...100
     - destroy B/
     - create A/
     - write A/101...
     <crash>
     - replay A/ -> B/
     - remove B/1...100  (fails but tolerated)
     - destroy B/        (fails with ENOTEMPTY)

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

index c91d47c6d0d4af727260ef6fed8db36e048e5187..c53bd79b2edef9624ef263a218164aa1facc9aa5 100644 (file)
@@ -4169,6 +4169,10 @@ 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));
 
+  if (_check_replay_guard(cid, spos) < 0) {
+    return 0;
+  }
+
   if (_check_replay_guard(ncid, spos) < 0) {
     return _collection_remove_recursive(cid, spos);
   }