diff options
author | Hannes Reinecke <hare@suse.de> | 2019-05-03 05:43:52 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-05-13 10:00:03 -0400 |
commit | 8730c1ddb69bdeeb10c1f613a4e15e95862b1981 (patch) | |
tree | dd56d3a328624814e8cc15403ba11ee0a03ae9cc | |
parent | 87fd125344d68adf7699ec7396aa9f905ce79a80 (diff) |
nvme-fc: use separate work queue to avoid warning
When tearing down a controller the following warning is issued:
WARNING: CPU: 0 PID: 30681 at ../kernel/workqueue.c:2418 check_flush_dependency
This happens as the err_work workqueue item is scheduled on the
system workqueue (which has WQ_MEM_RECLAIM not set), but is flushed
from a workqueue which has WQ_MEM_RECLAIM set.
Fix this by providing an FC-NVMe specific workqueue.
Fixes: 4cff280a5fcc ("nvme-fc: resolve io failures during connect")
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/nvme/host/fc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 6d8451356eac..c17c887f2148 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -202,7 +202,7 @@ static LIST_HEAD(nvme_fc_lport_list); | |||
202 | static DEFINE_IDA(nvme_fc_local_port_cnt); | 202 | static DEFINE_IDA(nvme_fc_local_port_cnt); |
203 | static DEFINE_IDA(nvme_fc_ctrl_cnt); | 203 | static DEFINE_IDA(nvme_fc_ctrl_cnt); |
204 | 204 | ||
205 | 205 | static struct workqueue_struct *nvme_fc_wq; | |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * These items are short-term. They will eventually be moved into | 208 | * These items are short-term. They will eventually be moved into |
@@ -2054,7 +2054,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) | |||
2054 | */ | 2054 | */ |
2055 | if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) { | 2055 | if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) { |
2056 | active = atomic_xchg(&ctrl->err_work_active, 1); | 2056 | active = atomic_xchg(&ctrl->err_work_active, 1); |
2057 | if (!active && !schedule_work(&ctrl->err_work)) { | 2057 | if (!active && !queue_work(nvme_fc_wq, &ctrl->err_work)) { |
2058 | atomic_set(&ctrl->err_work_active, 0); | 2058 | atomic_set(&ctrl->err_work_active, 0); |
2059 | WARN_ON(1); | 2059 | WARN_ON(1); |
2060 | } | 2060 | } |
@@ -3399,6 +3399,10 @@ static int __init nvme_fc_init_module(void) | |||
3399 | { | 3399 | { |
3400 | int ret; | 3400 | int ret; |
3401 | 3401 | ||
3402 | nvme_fc_wq = alloc_workqueue("nvme_fc_wq", WQ_MEM_RECLAIM, 0); | ||
3403 | if (!nvme_fc_wq) | ||
3404 | return -ENOMEM; | ||
3405 | |||
3402 | /* | 3406 | /* |
3403 | * NOTE: | 3407 | * NOTE: |
3404 | * It is expected that in the future the kernel will combine | 3408 | * It is expected that in the future the kernel will combine |
@@ -3416,7 +3420,7 @@ static int __init nvme_fc_init_module(void) | |||
3416 | ret = class_register(&fc_class); | 3420 | ret = class_register(&fc_class); |
3417 | if (ret) { | 3421 | if (ret) { |
3418 | pr_err("couldn't register class fc\n"); | 3422 | pr_err("couldn't register class fc\n"); |
3419 | return ret; | 3423 | goto out_destroy_wq; |
3420 | } | 3424 | } |
3421 | 3425 | ||
3422 | /* | 3426 | /* |
@@ -3440,6 +3444,9 @@ out_destroy_device: | |||
3440 | device_destroy(&fc_class, MKDEV(0, 0)); | 3444 | device_destroy(&fc_class, MKDEV(0, 0)); |
3441 | out_destroy_class: | 3445 | out_destroy_class: |
3442 | class_unregister(&fc_class); | 3446 | class_unregister(&fc_class); |
3447 | out_destroy_wq: | ||
3448 | destroy_workqueue(nvme_fc_wq); | ||
3449 | |||
3443 | return ret; | 3450 | return ret; |
3444 | } | 3451 | } |
3445 | 3452 | ||
@@ -3456,6 +3463,7 @@ static void __exit nvme_fc_exit_module(void) | |||
3456 | 3463 | ||
3457 | device_destroy(&fc_class, MKDEV(0, 0)); | 3464 | device_destroy(&fc_class, MKDEV(0, 0)); |
3458 | class_unregister(&fc_class); | 3465 | class_unregister(&fc_class); |
3466 | destroy_workqueue(nvme_fc_wq); | ||
3459 | } | 3467 | } |
3460 | 3468 | ||
3461 | module_init(nvme_fc_init_module); | 3469 | module_init(nvme_fc_init_module); |