return false; // root is a leaf
const crush_bucket *b = get_bucket(root);
- if (!b)
+ if (IS_ERR(b))
return false;
for (unsigned j=0; j<b->size; j++) {
if (item < 0 && !unlink_only) {
crush_bucket *t = get_bucket(item);
- if (t && t->size) {
+ if (IS_ERR(t)) {
+ ldout(cct, 1) << "remove_item bucket " << item << " does not exist" << dendl;
+ return -ENOENT;
+ }
+
+ if (t->size) {
ldout(cct, 1) << "remove_item bucket " << item << " has " << t->size
<< " items, not empty" << dendl;
return -ENOTEMPTY;
if (item < 0 && !unlink_only) {
crush_bucket *t = get_bucket(item);
- if (t && t->size) {
+ if (IS_ERR(t)) {
+ ldout(cct, 1) << "remove_item_under bucket " << item
+ << " does not exist" << dendl;
+ return -ENOENT;
+ }
+
+ if (t->size) {
ldout(cct, 1) << "remove_item_under bucket " << item << " has " << t->size
<< " items, not empty" << dendl;
return -ENOTEMPTY;
}
crush_bucket *b = get_bucket(id);
- if (!b) {
+ if (IS_ERR(b)) {
return -ENOENT;
}