From: Sage Weil Date: Thu, 13 Nov 2014 18:59:22 +0000 (-0800) Subject: crush/CrushWrapper: fix detach_bucket X-Git-Tag: v0.80.9~11^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=80ec22014deb8536b9c34e8d57b286052898d05a;p=ceph.git crush/CrushWrapper: fix detach_bucket In commit 9850227d2f0ca2f692a154de2c14a0a08e751f08 we changed the call that changed the weight of all instances of item to one that explicitly changes it in the parent bucket, but parent_id may not be valid at the call site. Move this into the conditional block to fix. Fixes: #10095 Signed-off-by: Sage Weil (cherry picked from commit 6f8b96a9fe4793906c74a571109a457aca7ca220) --- diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 3ae8e2a12477..08cbb2e4d86a 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -775,6 +775,10 @@ private: crush_bucket *parent_bucket = get_bucket(parent_id); if (!IS_ERR(parent_bucket)) { + // zero out the bucket weight + crush_bucket_adjust_item_weight(parent_bucket, item, 0); + adjust_item_weight(cct, parent_bucket->id, parent_bucket->weight); + // remove the bucket from the parent crush_bucket_remove_item(parent_bucket, item); } else if (PTR_ERR(parent_bucket) != -ENOENT) {