nvmet: avoid circular locking warning
Subsystems (2)
v2 cover nvmet: avoid circular locking warning
nvmet-rdma and nvmet-tcp trigger a circular locking warning when tearing down; reason is a call to 'flush_workqueue' when creating a new controller which tries to cover for the fact that old controller instances might be in the process of tearing down.
However, this is pure speculation as we don't know (and don't check) if there really _are_ controllers in shutdown.
And even if there were, that should be short-lived, and would have been resolved by connecting just a tad later.
So this patch returns 'controller busy' if we really find ourselves in this situation, allowing the caller to reconnect later.
Changes to the original version:
- Update the rdma patch to implement 'install_queue()'
- Include suggestions from Jens Axboe
Hannes Reinecke (2):
nvmet-rdma: avoid circular locking dependency on install_queue()
nvmet-tcp: avoid circular locking dependency on install_queue()
drivers/nvme/target/rdma.c | 24 +++++++++++++++++++----- drivers/nvme/target/tcp.c | 13 +++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
PATCH v2 1/2 nvmet-rdma: avoid circular locking dependency on install_queue()
nvmet_rdma_install_queue() is driven from the ->io_work workqueue function, but will call flush_workqueue() which might trigger ->release_work() which in itself calls flush_work on ->io_work.
To avoid that move the check for any pending queue disconnects to the 'install_queue()' callback. This replicates what the tcp code is already doing, and also allows us to return a 'controller busy' connect response until all disconnects are completed.
--- drivers/nvme/target/rdma.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/nvme/target/rdma.c +19 -5
@@ -1582,11 +1582,6 @@ static int nvmet_rdma_queue_connect(struct rdma_cm_id *cm_id, goto put_device; } -if (queue->host_qid ==0 ) { -/* Let inflight controller teardown complete */ -flush_workqueue (nvmet_wq); - } - ret =nvmet_rdma_cm_accept (cm_id, queue, &event->param.conn);if (ret) {/*
@@ -1975,6 +1970,24 @@ static void nvmet_rdma_remove_port(struct nvmet_port *nport)kfree (port); } +static u16 nvmet_rdma_install_queue (struct nvmet_sq *sq) +{ +if (sq->qid ==0 ) { +struct nvmet_rdma_queue *q; + +mutex_lock (&nvmet_rdma_queue_mutex); +list_for_each_entry (q, &nvmet_rdma_queue_list, queue_list) { +if (q->state ==NVMET_RDMA_Q_DISCONNECTING ) { +mutex_unlock (&nvmet_rdma_queue_mutex); +/* Retry for pending controller teardown */ +return NVME_SC_CONNECT_CTRL_BUSY ; + } + } +mutex_unlock (&nvmet_rdma_queue_mutex); + } +return 0 ; +} +static void nvmet_rdma_disc_port_addr (struct nvmet_req *req,struct nvmet_port *nport,char *traddr) {
@@ -2014,6 +2027,7 @@ static const struct nvmet_fabrics_ops nvmet_rdma_ops = { .remove_port = nvmet_rdma_remove_port, .queue_response = nvmet_rdma_queue_response, .delete_ctrl = nvmet_rdma_delete_ctrl, + .install_queue = nvmet_rdma_install_queue, .disc_traddr = nvmet_rdma_disc_port_addr, .get_mdts = nvmet_rdma_get_mdts, .get_max_queue_size = nvmet_rdma_get_max_queue_size,
Signature · 1 line
2.35.3
Christoph Hellwig
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 9 lines · Hannes Reinecke
nvmet_rdma_install_queue()is driven from the ->io_work workqueue function, but will callflush_workqueue()which might trigger ->release_work() which in itself callsflush_workon ->io_work.To avoid that move the check for any pending queue disconnects to the '
install_queue()' callback. This replicates what the tcp code is already doing, and also allows us to return a 'controller busy' connect response until all disconnects are completed.
So what are hosts going to do when they see NVME_SC_CONNECT_CTRL_BUSY?
I see no special casing for it in our host side code.
Re: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Hannes Reinecke
nvmet_rdma_install_queue()is driven from the ->io_work workqueue function, but will callflush_workqueue()which might trigger ->release_work() which in itself callsflush_workon ->io_work.To avoid that move the check for any pending queue disconnects to the '
install_queue()' callback. This replicates what the tcp code is already doing, and also allows us to return a 'controller busy' connect response until all disconnects are completed.
Quoted 3 lines
So what are hosts going to do when they see
NVME_SC_CONNECT_CTRL_BUSY?I see no special casing for it in our host side code.
Retry? The DNR bit is not set, so the default action should be to retry. And the idea is that this condition is a very short-lived one anyway. No?
Cheers,
Hannes
Christoph Hellwig
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 3 lines · Hannes Reinecke
Retry? The DNR bit is not set, so the default action should be to retry. And the idea is that this condition is a very short-lived one anyway. No?
Maybe. Best to explicitly state what is going to happen and how you tested it in the commit log..
Re: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke
Retry? The DNR bit is not set, so the default action should be to retry. And the idea is that this condition is a very short-lived one anyway. No?
Maybe. Best to explicitly state what is going to happen and how you tested it in the commit log..
Hmm. Or we just kill it.
According to 777dc82395de ("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove
the whole thing entirely.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg Managing Directors: I. Totev, A. Myers, A. McDonald, M. B. Moerman (HRB 36809, AG Nürnberg)
Christoph Hellwig
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 4 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.
Well, Sagi added it, so I'll let him chime in on the usefulness.
Sagi Grimberg
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use rdma_listen backlog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.
Same comment for nvmet-tcp.
Sagi Grimberg
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 21 lines · Sagi Grimberg
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use
rdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Re: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 24 lines · Sagi Grimberg
Quoted 21 lines · Sagi Grimberg
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use
rdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.
Quoted 6 lines
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Hmm. The main issue here is the call to 'flush_workqueue()', which triggers the circular lock warning. So a ratelimit would only help us so much; the real issue is to get rid of the flush_workqueue()
thingie.
What I can to is to add this:
drivers/nvme/target/tcp.c +13 -1
@@ -2119,8 +2119,20 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq);if (sq->qid ==0 ) { +struct nvmet_tcp_queue *q; +int pending =0 ; +/* Let inflight controller teardown complete */ -flush_workqueue (nvmet_wq); +mutex_lock (&nvmet_tcp_queue_mutex); +list_for_each_entry (q, &nvmet_tcp_queue_list, queue_list) { +if (q->nvme_sq.ctrl == sq->ctrl && + q->state ==NVMET_TCP_Q_DISCONNECTING ) + pending++; + } +mutex_unlock (&nvmet_tcp_queue_mutex); +/* Retry for pending controller teardown */ +if (pending) +return NVME_SC_CONNECT_CTRL_BUSY ; }
which then would only affect the controller we're connecting to. Hmm?
Cheers,
Hannes
Sagi Grimberg
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 64 lines · Hannes Reinecke
Quoted 24 lines · Sagi Grimberg
Quoted 21 lines · Sagi Grimberg
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use
rdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.Quoted 6 lines
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Hmm. The main issue here is the call to '
flush_workqueue()', which triggers the circular lock warning. So a ratelimit would only help us so much; the real issue is to get rid of theflush_workqueue()
thingie.What I can to is to add this:
drivers/nvme/target/tcp.c +13
-1@@ -2119,8 +2119,20 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq); if (sq->qid == 0) { + struct nvmet_tcp_queue *q; + int pending = 0; + /* Let inflight controller teardown complete */ - flush_workqueue(nvmet_wq); + mutex_lock(&nvmet_tcp_queue_mutex); + list_for_each_entry(q, &nvmet_tcp_queue_list, queue_list) { + if (q->nvme_sq.ctrl == sq->ctrl && + q->state == NVMET_TCP_Q_DISCONNECTING) + pending++; + } + mutex_unlock(&nvmet_tcp_queue_mutex); + /* Retry for pending controller teardown */ + if (pending) + return NVME_SC_CONNECT_CTRL_BUSY; }
Quoted 2 lines
which then would only affect the controller we're connecting to. Hmm?
Still I think we should give a reasonable backlog, no reason to limit this as we may hit this more often than we'd like and the sole purpose here is to avoid memory overrun.
Re: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 68 lines · Sagi Grimberg
Quoted 65 lines · Hannes Reinecke
Quoted 24 lines · Sagi Grimberg
Quoted 21 lines · Sagi Grimberg
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use
rdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.Quoted 6 lines
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Hmm. The main issue here is the call to '
flush_workqueue()', which triggers the circular lock warning. So a ratelimit would only help us so much; the real issue is to get rid of theflush_workqueue()
thingie.What I can to is to add this:
drivers/nvme/target/tcp.c +13
-1@@ -2119,8 +2119,20 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq); if (sq->qid == 0) { + struct nvmet_tcp_queue *q; + int pending = 0; + /* Let inflight controller teardown complete */ - flush_workqueue(nvmet_wq); + mutex_lock(&nvmet_tcp_queue_mutex); + list_for_each_entry(q, &nvmet_tcp_queue_list, queue_list) { + if (q->nvme_sq.ctrl == sq->ctrl && + q->state == NVMET_TCP_Q_DISCONNECTING) + pending++; + } + mutex_unlock(&nvmet_tcp_queue_mutex); + /* Retry for pending controller teardown */ + if (pending) + return NVME_SC_CONNECT_CTRL_BUSY; }
Quoted 6 lines
Quoted 2 lines
which then would only affect the controller we're connecting to. Hmm?
Still I think we should give a reasonable backlog, no reason to limit this as we may hit this more often than we'd like and the sole purpose here is to avoid memory overrun.
So would 'if (pending > tcp_backlog)' (with eg tcp_backlog = 20) fit the bill here?
Cheers,
Hannes
Sagi Grimberg
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 69 lines · Hannes Reinecke
Quoted 68 lines · Sagi Grimberg
Quoted 65 lines · Hannes Reinecke
Quoted 24 lines · Sagi Grimberg
Quoted 21 lines · Sagi Grimberg
Quoted 7 lines
Quoted 5 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing the memory footprint. Wonder if we need to bother, and whether it won't be better to remove the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can simply just sidetrack it as proposed I guess.
But Hannes, this is on the other extreme.. Now every connect that nvmet gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We use
rdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing down to prevent the memory footprint from exploding, and hopefully it is rare enough that the normal host does not see an arbitrary busy rejection.Quoted 6 lines
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Hmm. The main issue here is the call to '
flush_workqueue()', which triggers the circular lock warning. So a ratelimit would only help us so much; the real issue is to get rid of theflush_workqueue()
thingie.What I can to is to add this:
drivers/nvme/target/tcp.c +13
-1@@ -2119,8 +2119,20 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq); if (sq->qid == 0) { + struct nvmet_tcp_queue *q; + int pending = 0; + /* Let inflight controller teardown complete */ - flush_workqueue(nvmet_wq); + mutex_lock(&nvmet_tcp_queue_mutex); + list_for_each_entry(q, &nvmet_tcp_queue_list, queue_list) { + if (q->nvme_sq.ctrl == sq->ctrl && + q->state == NVMET_TCP_Q_DISCONNECTING) + pending++; + } + mutex_unlock(&nvmet_tcp_queue_mutex); + /* Retry for pending controller teardown */ + if (pending) + return NVME_SC_CONNECT_CTRL_BUSY; }
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
which then would only affect the controller we're connecting to. Hmm?
Still I think we should give a reasonable backlog, no reason to limit this as we may hit this more often than we'd like and the sole purpose here is to avoid memory overrun.
So would 'if (pending >
tcp_backlog)' (with egtcp_backlog= 20) fit the bill here?
Yes I think so, we already place a listen backlog, so maybe we can reuse that as NVME_TCP_BACKLOG or something. The same should apply to nvme-rdma.
Re: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 87 lines · Sagi Grimberg
Quoted 84 lines · Hannes Reinecke
Quoted 82 lines · Sagi Grimberg
Quoted 73 lines · Hannes Reinecke
Quoted 30 lines · Sagi Grimberg
Quoted 27 lines · Sagi Grimberg
Quoted 9 lines
Quoted 7 lines
According to
777dc82395de("nvmet-rdma: occasionally flush ongoing controller teardown") this is just for reducing
the memory footprint.
Wonder if we need to bother, and whether it
won't be better to remove
the whole thing entirely.Well, Sagi added it, so I'll let him chime in on the usefulness.
While I don't like having nvmet arbitrarily replying busy and instead have lockdep simply just accept that its not a deadlock here, but we can
simply just sidetrack it as proposed I guess.But Hannes, this is on the other extreme.. Now every connect that nvmet
gets, if there is even a single queue that is disconnecting (global scope), then the host is denied. Lets give it a sane backlog. We userdma_listenbacklog of 128, so maybe stick with this magic number... This way we are busy only if more than 128 queues are tearing
down to prevent the memory footprint from exploding, and hopefully it is
rare enough that the normal host does not see an arbitrary busy rejection.Quoted 6 lines
Quoted 1 line
Same comment for nvmet-tcp.
Hey Hannes, anything happened with this one?
Overall I think that the approach is fine, but I do think that we need a backlog for it.
Hmm. The main issue here is the call to '
flush_workqueue()', which triggers the circular lock warning. So a ratelimit would only help
us so much; the real issue is to get rid of theflush_workqueue()thingie.What I can to is to add this:
drivers/nvme/target/tcp.c +13
-1@@ -2119,8 +2119,20 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq); if (sq->qid == 0) { + struct nvmet_tcp_queue *q; + int pending = 0; + /* Let inflight controller teardown complete */ - flush_workqueue(nvmet_wq); + mutex_lock(&nvmet_tcp_queue_mutex); + list_for_each_entry(q, &nvmet_tcp_queue_list, queue_list) { + if (q->nvme_sq.ctrl == sq->ctrl && + q->state == NVMET_TCP_Q_DISCONNECTING) + pending++; + } + mutex_unlock(&nvmet_tcp_queue_mutex); + /* Retry for pending controller teardown */ + if (pending) + return NVME_SC_CONNECT_CTRL_BUSY; }Quoted 2 lines
which then would only affect the controller we're connecting to. Hmm?
Still I think we should give a reasonable backlog, no reason to limit this as we may hit this more often than we'd like and the sole purpose here is to avoid memory overrun.
Quoted 5 lines
Quoted 2 lines
So would 'if (pending >
tcp_backlog)' (with egtcp_backlog= 20) fit the bill here?Yes I think so, we already place a listen backlog, so maybe we can reuse that as
NVME_TCP_BACKLOGor something. The same should apply to nvme-rdma.
Thanks for the discussion. FYI, I modified the patches by Hannes to reflect the discussion above [1][2]. With these, I confirmed the lockdep WARN disappears, and saw no regression in my blktests runs. Looks good. Will test again when formal patches come out.
[1] https://github.com/kawasaki/linux/commit/dc58819d07b02bd54dbcd5b15d2600a517fcbbff
[2] https://github.com/kawasaki/linux/commit/20fb65d145152562d0e11a9c8065e64405c31b0d
Sagi Grimberg
maintainerRe: [PATCH 1/2] nvmet-rdma: avoid circular locking dependency on install_queue()
Quoted 11 lines
Quoted 3 lines
Yes I think so, we already place a listen backlog, so maybe we can reuse that as
NVME_TCP_BACKLOGor something. The same should apply to nvme-rdma.Thanks for the discussion. FYI, I modified the patches by Hannes to reflect the discussion above [1][2]. With these, I confirmed the lockdep WARN disappears, and saw no regression in my blktests runs. Looks good. Will test again when formal patches come out.
[1] https://github.com/kawasaki/linux/commit/dc58819d07b02bd54dbcd5b15d2600a517fcbbff
[2] https://github.com/kawasaki/linux/commit/20fb65d145152562d0e11a9c8065e64405c31b0d
Can you/Hannes please submit them?
PATCH v2 2/2 nvmet-tcp: avoid circular locking dependency on install_queue()
In reply to Hannes Reineckenvmet_tcp_install_queue() is driven from the ->io_work workqueue function, but will call flush_workqueue() which might trigger ->release_work() which in itself calls flush_work on ->io_work.
To avoid that check for pending queue in disconnecting status, and return 'controller busy' until all disconnects are completed.
--- drivers/nvme/target/tcp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +11 -2
@@ -2121,8 +2121,17 @@ static u16 nvmet_tcp_install_queue(struct nvmet_sq *sq) container_of(sq, struct nvmet_tcp_queue, nvme_sq);if (sq->qid ==0 ) { -/* Let inflight controller teardown complete */ -flush_workqueue (nvmet_wq); +struct nvmet_tcp_queue *q; + +mutex_lock (&nvmet_tcp_queue_mutex); +list_for_each_entry (q, &nvmet_tcp_queue_list, queue_list) { +if (q->state ==NVMET_TCP_Q_DISCONNECTING ) { +/* Retry for pending controller teardown */ +mutex_unlock (&nvmet_tcp_queue_mutex); +return NVME_SC_CONNECT_CTRL_BUSY ; + } + } +mutex_unlock (&nvmet_tcp_queue_mutex); } queue->nr_cmds = sq->size *2 ;
Signature · 1 line
2.35.3