diff options
author | Sage Weil <sage@inktank.com> | 2012-11-17 01:55:00 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-08 18:17:51 +0100 |
commit | e227c70945f236811433fb2403056f0468530255 (patch) | |
tree | 152eb90aeefa3b5986dc9b0fa91cee7ee4daa31f | |
parent | mon: Elector: init elector before each election (diff) | |
download | ceph-e227c70945f236811433fb2403056f0468530255.tar.xz ceph-e227c70945f236811433fb2403056f0468530255.zip |
crush/CrushWrapper: do not crash if you move an item with no current home
This will let us take an existing orphan and place it somewhere.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/crush/CrushWrapper.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 5f5da0ca02c..f77991cc314 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -556,8 +556,12 @@ private: // get the parent bucket crush_bucket *parent_bucket = get_bucket(parent_id); - // remove the bucket from the parent - crush_bucket_remove_item(parent_bucket, item); + if (!IS_ERR(parent_bucket)) { + // remove the bucket from the parent + crush_bucket_remove_item(parent_bucket, item); + } else if (PTR_ERR(parent_bucket) != -ENOENT) { + return PTR_ERR(parent_bucket); + } // check that we're happy int test_weight = 0; |