lkml.org 
[lkml]   [2011]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 03/16] block: Don't check events while open is in progress
    Date
    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.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Kay Sievers <kay.sievers@vrfy.org>
    ---
    fs/block_dev.c | 4 ++++
    1 files changed, 4 insertions(+), 0 deletions(-)

    diff --git a/fs/block_dev.c b/fs/block_dev.c
    index 7dd2c65..b69cc0b 100644
    --- a/fs/block_dev.c
    +++ b/fs/block_dev.c
    @@ -1087,6 +1087,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
    if (!disk)
    goto out;

    + disk_block_events(disk);
    mutex_lock_nested(&bdev->bd_mutex, for_part);
    if (!bdev->bd_openers) {
    bdev->bd_disk = disk;
    @@ -1112,6 +1113,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
    put_disk(disk);
    bdev->bd_disk = NULL;
    mutex_unlock(&bdev->bd_mutex);
    + disk_unblock_events(disk);
    goto restart;
    }
    if (ret)
    @@ -1165,6 +1167,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
    if (for_part)
    bdev->bd_part_count++;
    mutex_unlock(&bdev->bd_mutex);
    + disk_unblock_events(disk);
    return 0;

    out_clear:
    @@ -1177,6 +1180,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
    bdev->bd_contains = NULL;
    out_unlock_bdev:
    mutex_unlock(&bdev->bd_mutex);
    + disk_unblock_events(disk);
    out:
    if (disk)
    module_put(disk->fops->owner);
    --
    1.7.1


    \
     
     \ /
      Last update: 2011-03-09 10:17    [W:0.033 / U:35.956 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site