Re: [PATCH v5 02/11] block: Block Device Filtering Mechanism

From: Christoph Hellwig
Date: Thu Jul 20 2023 - 02:15:25 EST


On Tue, Jul 18, 2023 at 09:37:33AM +0800, Yu Kuai wrote:
> I haven't review blksnap code yet, but this sounds like a problem.
>
> possible solutions I have in mind:
>
> 1. Store blkfilter for each partition from bdev_disk_changed() before
> delete_partition(), and add blkfilter back after add_partition().
>
> 2. Store blkfilter from gendisk as a xarray, and protect it by
> 'open_mutex' like 'part_tbl', block_device can keep the pointer to
> reference blkfilter so that performance from fast path is ok, and the
> lifetime of blkfiter can be managed separately.

The whole point of bdev_disk_changed is that the partitions might not
be the same ones as before..