[dm-devel] [PATCH 2/2] block: fix locking for struct block_device size updates

xianting_tian at 126.com
Fri Aug 21 10:02:32 UTC 2020


thanks Hellwig for your kindly reply and your fix and add report by me :)


On 08/21/2020 17:26, Hannes Reinecke wrote:
On 8/21/20 10:56 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 fixeѕ a bug reported with the nvme revalidating disks during a
> hot removal operation.
>
> Reported-by: Xianting Tian <xianting_tian at 126.com>
> Signed-off-by: Christoph Hellwig <hch at 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                  | 18 +++++++++---------
>  include/linux/blk_types.h       |  1 +
>  6 files changed, 17 insertions(+), 34 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes
--
Dr. Hannes Reinecke                     Kernel Storage Architect
hare at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20200821/f1fb02d2/attachment.htm>


More information about the dm-devel mailing list