lkml.org 
[lkml]   [2020]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 2/3] block: fix locking for struct block_device size updates
    From
    Date
    On 8/23/20 11:10 AM, Christoph Hellwig wrote:
    > Two different callers use two different mutexes for updating the
    > block device size, which obviously doesn't help to actually protect
    > against concurrent updates from the different callers. In addition
    > one of the locks, bd_mutex is rather prone to deadlocks with other
    > parts of the block stack that use it for high level synchronization.
    >
    > Switch to using a new spinlock protecting just the size updates, as
    > that is all we need, and make sure everyone does the update through
    > the proper helper.
    >
    > This fixes a bug reported with the nvme revalidating disks during a
    > hot removal operation, which can currently deadlock on bd_mutex.
    >
    > Reported-by: Xianting Tian <xianting_tian@126.com>
    > Signed-off-by: Christoph Hellwig <hch@lst.de>
    > ---
    > block/partitions/core.c | 4 ++--
    > drivers/block/aoe/aoecmd.c | 4 +---
    > drivers/md/dm.c | 15 ++-------------
    > drivers/s390/block/dasd_ioctl.c | 9 ++-------
    > fs/block_dev.c | 25 ++++++++++++++-----------
    > include/linux/blk_types.h | 1 +
    > 6 files changed, 22 insertions(+), 36 deletions(-)
    > Reviewed-by: Hannes Reinecke <hare@suse.de>

    Cheers,

    Hannes
    --
    Dr. Hannes Reinecke Kernel Storage Architect
    hare@suse.de +49 911 74053 688
    SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
    HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

    \
     
     \ /
      Last update: 2020-08-24 09:37    [W:3.238 / U:24.540 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site