+static int cbt_ioc_stop(struct block_device *bdev, struct blk_user_cbt_info 
__user *ucbt_ioc)
+{
+       struct blk_user_cbt_info ci;
        struct request_queue *q;
+       struct cbt_info *cbt;
+
+       if (copy_from_user(&ci, ucbt_ioc, sizeof(ci)))
+               return -EFAULT;
mutex_lock(&cbt_mutex);
        q = bdev_get_queue(bdev);
-       if(!q->cbt) {
-               mutex_unlock(&cbt_mutex);
-               return -EINVAL;
-       }
-       blk_cbt_release(q);
+
+       cbt = blk_cbt_find(q, ci.ci_name);
+       if (!cbt)
+               return -ENOMEM;

EINVAL (as it was before) or ENOENT (no cbt) would suite this error path better.

+
+       blk_cbt_del(cbt);
+
        mutex_unlock(&cbt_mutex);
        return 0;
  }
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to