We might use 'crush link' to link same host into
different roots, which as a result can cause different
shadow trees reference same hosts too.
This means we may need to destory the same buckets(hosts, racks, etc.)
multiple times during rebuilding all shadow trees and hence 'remove_root'
shall be idempotent.
Fixes: http://tracker.ceph.com/issues/20845
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
return 0;
crush_bucket *b = get_bucket(item);
- if (IS_ERR(b))
- return -ENOENT;
+ if (IS_ERR(b)) {
+ // should be idempotent
+ // e.g.: we use 'crush link' to link same host into
+ // different roots, which as a result can cause different
+ // shadow trees reference same hosts too. This means
+ // we may need to destory the same buckets(hosts, racks, etc.)
+ // multiple times during rebuilding all shadow trees.
+ return 0;
+ }
for (unsigned n = 0; n < b->size; n++) {
if (b->items[n] >= 0)