All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rfc 0/2] nvme controller reset and namespace scan work race conditions
@ 2019-07-29 23:31 Sagi Grimberg
  2019-07-29 23:32 ` [PATCH rfc 1/2] nvme: don't remove namespace if revalidate failed because of controller reset Sagi Grimberg
  2019-07-29 23:32 ` [PATCH rfc 2/2] nvme: fix possible use-after-free condition when controller reset is racing namespace scanning Sagi Grimberg
  0 siblings, 2 replies; 42+ messages in thread
From: Sagi Grimberg @ 2019-07-29 23:31 UTC (permalink / raw)


Hey Hannes,

Here is two patches that to my understanding of the issues you describe
in your patchset: "nvme: flush rescan worker before resetting" and your
report of "spurious I/O errors during failover".

Patch #1 avoids removing a namespace if the revalidation I/O failed because
of a racing controller reset (or removal). This should fix any spurious I/O
failures during path failover.

Patch #2 avoids a use-after-free condition in the case where the scan work ends
up actually removing a namespace but is racing with a controller reset (that is
scheduled after the removal) and is accessing the request queue
(nvme_stop_queues) after it was destroyed.

The one trace that you have mentioned in our discussions that is still
not clear to me is:
--
[67088.344034] WARNING: CPU: 4 PID: 25020 at
../lib/percpu-refcount.c:334 percpu_ref_kill_and_confirm+0x7a/0xa0
[...]
[67088.344106] Call Trace:
[67088.344112]  blk_freeze_queue_start+0x2a/0x40
[67088.344114]  blk_freeze_queue+0xe/0x40
[67088.344118]  nvme_update_disk_info+0x36/0x260 [nvme_core]
[67088.344122]  __nvme_revalidate_disk+0xca/0xf0 [nvme_core]
[67088.344125]  nvme_revalidate_disk+0xa6/0x120 [nvme_core]
[67088.344127]  ? blk_mq_get_tag+0xa3/0x220
[67088.344130]  revalidate_disk+0x23/0xc0
[67088.344133]  nvme_validate_ns+0x43/0x830 [nvme_core]
[67088.344137]  ? wake_up_q+0x70/0x70
[67088.344139]  ? blk_mq_free_request+0x12a/0x160
[67088.344142]  ? __nvme_submit_sync_cmd+0x73/0xe0 [nvme_core]
[67088.344145]  nvme_scan_work+0x2b3/0x350 [nvme_core]
[67088.344149]  process_one_work+0x1da/0x400
[67088.344150]  worker_thread+0x2b/0x3f0
[67088.344152]  ? process_one_work+0x400/0x400
--

Which indicates that we are revalidating a namespace that was already
removed. Given that the only namespace removal that is outside of the
scan_work is in nvme_remove_namespaces() which flushes the scan_work
before it actually removes the namespaces. I'm still lost how this can happen.

Can you please apply the following two patches and report if
they address the issues you are seeing? And if not, can you please
report a call trace of the hanged threads?

And, given that your are in a multipath environment, can you apply
these on top of: "nvme: fix controller removal race with scan work"?

Thanks.

Sagi Grimberg (2):
  nvme: don't remove namespace if revalidate failed because of
    controller reset
  nvme: fix possible use-after-free condition when controller reset is
    racing namespace scanning

 drivers/nvme/host/core.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2019-08-01 18:52 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 23:31 [PATCH rfc 0/2] nvme controller reset and namespace scan work race conditions Sagi Grimberg
2019-07-29 23:32 ` [PATCH rfc 1/2] nvme: don't remove namespace if revalidate failed because of controller reset Sagi Grimberg
2019-07-30  0:59   ` Keith Busch
2019-07-30  1:04     ` Sagi Grimberg
2019-07-30  1:04   ` Ming Lei
2019-07-30  1:06     ` Sagi Grimberg
2019-07-30  1:10       ` Ming Lei
2019-07-30  1:19         ` Sagi Grimberg
2019-07-30  1:30           ` Ming Lei
2019-07-30  1:40             ` Sagi Grimberg
2019-07-30  2:09               ` Ming Lei
2019-07-30 17:12                 ` Sagi Grimberg
2019-07-30 17:30                   ` Keith Busch
2019-07-30 18:15                     ` Sagi Grimberg
2019-07-31  7:13                       ` Hannes Reinecke
2019-07-31 18:08                         ` Sagi Grimberg
2019-07-31  7:01                     ` Hannes Reinecke
2019-07-31 14:16                       ` Keith Busch
2019-07-31 18:03                       ` Sagi Grimberg
2019-07-31 19:32                         ` Keith Busch
2019-07-31 20:08                           ` Sagi Grimberg
2019-07-31 20:16                             ` Keith Busch
2019-07-31 20:45                               ` Sagi Grimberg
2019-07-31 20:58                                 ` Keith Busch
2019-07-31 21:14                                   ` Sagi Grimberg
2019-07-31 21:54                                     ` Keith Busch
2019-08-01  1:13                                       ` Sagi Grimberg
2019-08-01 14:33                                         ` Keith Busch
2019-08-01 18:52                                           ` Sagi Grimberg
2019-07-31  6:58                   ` Hannes Reinecke
2019-07-31 18:11                     ` Sagi Grimberg
2019-07-31 20:02                       ` Hannes Reinecke
2019-07-31 20:16                         ` Sagi Grimberg
2019-07-31 12:18   ` Hannes Reinecke
2019-07-31 18:16     ` Sagi Grimberg
2019-07-31 20:04       ` Hannes Reinecke
2019-07-31 20:37         ` Sagi Grimberg
2019-07-29 23:32 ` [PATCH rfc 2/2] nvme: fix possible use-after-free condition when controller reset is racing namespace scanning Sagi Grimberg
2019-07-31 12:23   ` Hannes Reinecke
2019-07-31 18:21     ` Sagi Grimberg
2019-08-01  7:24       ` Hannes Reinecke
2019-08-01 18:46         ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.