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)
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);
}