]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: fix detach_bucket
authorSage Weil <sage@redhat.com>
Thu, 13 Nov 2014 18:59:22 +0000 (10:59 -0800)
committerSage Weil <sage@redhat.com>
Fri, 13 Feb 2015 16:30:45 +0000 (08:30 -0800)
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 <sage@redhat.com>
(cherry picked from commit 6f8b96a9fe4793906c74a571109a457aca7ca220)

src/crush/CrushWrapper.h

index 3ae8e2a1247793b9af192406342060cb32b1d19e..08cbb2e4d86a1117f3c6aaba77a7e96300cab5e2 100644 (file)
@@ -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) {