Message ID | 563F4C83.5030709@dev.mellanox.co.il (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Jens Axboe |
Headers | show |
On Sun, Nov 08, 2015 at 03:22:11PM +0200, Sagi Grimberg wrote: > Actually this is wrong. Whats wrong here is that ctrl->list > is being removed twice (once in nvme_loop_cleanup_module and > then here). Yes, this looks fine. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index a0eac07..cf0f745 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -869,18 +869,11 @@ out: static void __exit nvme_loop_cleanup_module(void) { - struct nvme_loop_ctrl *ctrl; + struct nvme_loop_ctrl *ctrl, *tmp; mutex_lock(&nvme_loop_ctrl_mutex); - while (!list_empty(&nvme_loop_ctrl_list)) { - ctrl = list_entry(nvme_loop_ctrl_list.next, - struct nvme_loop_ctrl, list); - - if (!list_empty(&ctrl->list)) - list_del(&ctrl->list); - + list_for_each_entry_safe(ctrl, tmp, &nvme_loop_ctrl_list, list) __nvme_loop_remove_ctrl(ctrl); - } mutex_unlock(&nvme_loop_ctrl_mutex); device_destroy(nvme_loop_class, MKDEV(0, 0));