Re: block: del_gendisk() vs blk_queue_enter() race condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 03, 2024 at 05:56:10PM +0900, Sergey Senozhatsky wrote:
> blk_queue_enter() sleeps forever, under ->open_mutex, there is no
> way for it to be woken up and to detect blk_queue_dying().  del_gendisk()
> sleeps forever because it attempts to grab ->open_mutex before it calls
> __blk_mark_disk_dead(), which would mark the queue QUEUE_FLAG_DYING and
> wake up ->mq_freeze_wq (which is blk_queue_enter() in this case).
> 
> I wonder how to fix it.  My current "patch" is to set QUEUE_FLAG_DYING
> and "kick" ->mq_freeze_wq early on in del_gendisk(), before it attempts
> to grab ->open_mutex for the first time.

We split blk_queue_enter further to distinguish between file system
requests and passthrough ones.

The file system request should be using bio_queue_enter, which only
checks GD_DEAD, instead of QUEUE_FLAG_DYING.  Passthrough requests like
the cdrom door lock are using blk_queue_enter that checks QUEUE_FLAG_DYING
which only gets set in blk_mq_destroy_queue.

So AFAICS your trace should not happen with the current kernel, but
probably could happen with older stable version unless I'm missing
something.  What kernel version did you see this on?





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux