On Mon, Apr 14, 2025 at 01:44:47PM -0600, Uday Shankar wrote: > On Mon, Apr 14, 2025 at 07:25:42PM +0800, Ming Lei wrote: > > In ublk_stop_dev(), if ublk device state becomes UBLK_S_DEV_DEAD, we > > will return immediately. This way is correct, but not enough, because > > ublk device may transition to other state, such UBLK_S_DEV_QUIECED, > > when it may have been stopped already. Then kernel panic is triggered. > > How can this happen? If a device is stopped, it is in the > UBLK_S_DEV_DEAD state. Won't that make us fall out of this check in > ublk_nosrv_work, so we wont transition to UBLK_S_DEV_QUIESCED or other > nosrv states? > > mutex_lock(&ub->mutex); > if (ub->dev_info.state != UBLK_S_DEV_LIVE) > goto unlock; You are right. I just verified that all tests can pass after reverting this patch. Thanks, Ming