• Tejun Heo's avatar
    block: Don't check events while open is in progress · 69e02c59
    Tejun Heo authored
    Not all block drivers clear events immediately after reporting.  Some
    do so in ->revalidate_disk() or other steps during ->open().  There is
    a slim chance event poll may happen between the clearing event check
    from check_disk_change() and the actual clearing of the events which
    would result in spurious events.
    
    Block event checks while block device open is in progress.  There is
    no need to kick explicit event check afterwards as events are always
    checked during open.
    
    -v2: The original patch could have called disk_unblock_events() with
         an already released or %NULL @disk causing oops.  Fixed by making
         sure references are put after disk_unblock_events() is called.
         It also makes the error path of __blkdev_get() a bit simpler.
         This problem was reported by Jens.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Kay Sievers <kay.sievers@vrfy.org>
    69e02c59
block_dev.c 39.5 KB