On Wed, 2017-10-04 at 09:04 +0200, Christoph Hellwig wrote: > > + /* > > + * Do not attempt to freeze the queue of an already quiesced device > > + * because that could result in a deadlock. > > + */ > > + freeze = sdev->sdev_state == SDEV_RUNNING; > > + if (freeze) > > + blk_mq_freeze_queue(q); > > err = scsi_device_set_state(sdev, SDEV_QUIESCE); > > I don't really like this magic with a freeze inside the lock > and the magic dependency on the previous. But I can't really come up > with a better idea either. The deadlock I referred to in my comment can only occur if any code would change the SCSI device state into SDEV_QUIESCE without freezing the request queue first. I will look into freezing the queue without holding the sdev state mutex. Bart.