summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-07-23 13:51:26 -0700
committerSamuel Just <sam.just@inktank.com>2013-07-25 10:34:48 -0700
commit6a7b9e5f0c1d2344209c69ab9992f94221a16468 (patch)
tree326b04336f1c000ed855dd24147f1411e8bd99e2
parent7d98651775265896c22bacfc4afcfccbb0128470 (diff)
downloadceph-6a7b9e5f0c1d2344209c69ab9992f94221a16468.tar.gz
FileStore::_collection_rename: fix global replay guard
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> (cherry picked from commit 870c474c5348831fcb13797d164f49682918fb30)
-rw-r--r--src/os/FileStore.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index 82185dc9d7c..c764d6bef2a 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -4352,9 +4352,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;
}
@@ -4363,6 +4360,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 &&