diff options
author | Sage Weil <sage@inktank.com> | 2013-02-18 17:39:46 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-03-20 16:43:37 -0700 |
commit | 66dca7730006dffbce12e6b27016ea5469b7691b (patch) | |
tree | 7061ce83407da395599d9cccf7dc94bea726fd9a | |
parent | ea570591b0d9dda102bece0f4cc7d263c3e2a3b0 (diff) | |
download | ceph-66dca7730006dffbce12e6b27016ea5469b7691b.tar.gz |
os/FileStore: check replay guard on src for collection rename
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>
(cherry picked from commit 5fc83c8d9887d2a916af11436ccc94fcbfe59b7a)
-rw-r--r-- | src/os/FileStore.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 44f3b571960..ac4d9b3afc8 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -4159,6 +4159,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); } |