[PATCH] nvme: fix multiple ctrl removal scheduling
Sagi Grimberg
sagi at grimberg.me
Thu Jun 1 07:37:41 PDT 2017
> From: Rakesh Pandit <rakesh at tuxera.com>
>
> Commit c5f6ce97c1210 tries to address multiple resets but fails as
> work_busy doesn't involve any synchronization and can fail. This is
> reproducible easily as can be seen by WARNING below which is triggered
> with line:
>
> WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING)
>
> Allowing multiple resets can result in multiple controller removal as
> well if different conditions inside nvme_reset_work fail and which
> might deadlock on device_release_driver.
>
> This patch introduces new state called NVME_CTRL_SCHED_RESET and uses
> it for synchronizing work queue addition (reset_work) as state change
> uses controller spinlock.
Christoph,
Did you catch my proposal to Keith and Rakesh?
I proposed to synchronize with ctrl state NVME_CTRL_RESETTING
before scheduling the reset_work and on removal flow (which is
why the warning exist) simply do a sync cancel of reset_work.
IMO, this is better than adding a new state to the ctrl state machine.
More information about the Linux-nvme
mailing list