Re: [dm-devel] [PATCH 3/3] blk-crypto: move internal only declarations to blk-crypto-internal.h

2022-11-15 Thread Christoph Hellwig
On Mon, Nov 14, 2022 at 05:29:44AM +0100, Christoph Hellwig wrote: > blk_crypto_get_keyslot, blk_crypto_put_keyslot, __blk_crypto_evict_key > and __blk_crypto_cfg_supported are only used internally by the > blk-crypto code, so move the out of blk-crypto-profile.h, which is > included by drivers th

[dm-devel] [PATCH v3 10/10] block: don't allow a disk link holder to itself

2022-11-15 Thread Yu Kuai
From: Yu Kuai After creating a dm device, then user can reload such dm with itself, and dead loop will be triggered because dm keep looking up to itself. Test procedures: 1) dmsetup create test --table "xxx sda", assume dm-0 is created 2) dmsetup suspend test 3) dmsetup reload test --table "xxx

[dm-devel] [PATCH v3 03/10] dm: cleanup open_table_device

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig Move all the logic for allocation the table_device and linking it into the list into the open_table_device. This keeps the code tidy and ensures that the table_devices only exist in fully initialized state. Signed-off-by: Christoph Hellwig Signed-off-by: Yu Kuai --- d

[dm-devel] [PATCH RFC v3 05/10] dm: make sure create and remove dm device won't race with open and close table

2022-11-15 Thread Yu Kuai
From: Yu Kuai open_table_device() and close_table_device() is protected by table_devices_lock, hence use it to protect add_disk() and del_gendisk(). Prepare to track per-add_disk holder relations in dm. Signed-off-by: Yu Kuai --- drivers/md/dm.c | 16 1 file changed, 16 inser

[dm-devel] [PATCH v3 04/10] dm: cleanup close_table_device

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig Take the list unlink and free into close_table_device so that no half torn down table_devices exist. Also remove the check for a NULL bdev as that can't happen - open_table_device never adds a table_device to the list that does not have a valid block_device. Signed-off-b

[dm-devel] [PATCH v3 06/10] dm: track per-add_disk holder relations in DM

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig dm is a bit special in that it opens the underlying devices. Commit 89f871af1b26 ("dm: delay registering the gendisk") tried to accommodate that by allowing to add the holder to the list before add_gendisk and then just add them to sysfs once add_disk is called. But that

[dm-devel] [PATCH v3 07/10] block: remove delayed holder registration

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig Now that dm has been fixed to track of holder registrations before add_disk, the somewhat buggy block layer code can be safely removed. Signed-off-by: Christoph Hellwig Signed-off-by: Yu Kuai --- block/genhd.c | 4 --- block/holder.c | 72

[dm-devel] [PATCH v3 02/10] dm: remove free_table_devices

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig free_table_devices just warns and frees all table_device structures when the target removal did not remove them. This should never happen, but if it did, just freeing the structure without deleting them from the list or cleaning up the resources would not help at all. So

[dm-devel] [PATCH v3 00/10] fix delayed holder tracking

2022-11-15 Thread Yu Kuai
From: Yu Kuai Hi all, this series tries to fix the delayed holder tracking that is only used by dm by moving it into dm, where we can track the lifetimes much better. v2 is from Christoph, here I send v3 with some additional fixes. Changes since v2: - add patch 5 8 and 10 to this series. - re

[dm-devel] [PATCH v3 01/10] block: clear ->slave_dir when dropping the main slave_dir reference

2022-11-15 Thread Yu Kuai
From: Christoph Hellwig Zero out the pointer to ->slave_dir so that the holder code doesn't incorrectly treat the object as alive when add_disk failed or after del_gendisk was called. Fixes: 89f871af1b26 ("dm: delay registering the gendisk") Reported-by: Yu Kuai Signed-off-by: Christoph Hellwig

Re: [dm-devel] [PATCHv2 0/5] fix direct io device mapper errors

2022-11-15 Thread Keith Busch
On Mon, Nov 14, 2022 at 06:31:36AM -0500, Mikulas Patocka wrote: > > > On Fri, 11 Nov 2022, Keith Busch wrote: > > > > There are other DM targets that override logical_block_size in their > > > .io_hints hook (writecache, ebs, zoned). Have you reasoned through why > > > those do _not_ need updat

[dm-devel] [PATCH v3 09/10] block: store the holder kobject in bd_holder_disk

2022-11-15 Thread Yu Kuai
From: Yu Kuai We hold a reference to the holder kobject for each bd_holder_disk, so to make the code a bit more robust, use a reference to it instead of the block_device. As long as no one clears ->bd_holder_dir in before freeing the disk, this isn't strictly required, but it does make the code

[dm-devel] [PATCH v3 08/10] block: fix use after free for bd_holder_dir

2022-11-15 Thread Yu Kuai
From: Yu Kuai Currently, the caller of bd_link_disk_holer() get 'bdev' by blkdev_get_by_dev(), which will look up 'bdev' by inode number 'dev'. Howerver, it's possible that del_gendisk() can be called currently, and 'bd_holder_dir' can be freed before bd_link_disk_holer() access it, thus use afte

Re: [dm-devel] [PATCH 0/3] misc cleanups

2022-11-15 Thread Martin Wilck
On Wed, 2022-11-09 at 15:49 -0600, Benjamin Marzinski wrote: > Here are some cleanups (in response to comments from Martin Wilck) > for > patches I previously posted. > > Benjamin Marzinski (3): >   libmultipath: impove add_feature() variable names >   multipathd: don't initialize the field width

[dm-devel] [PATCH 1/1] dm-integrity: flush journal on suspend

2022-11-15 Thread Mikulas Patocka
This commit flushes the journal on suspend. It is prerequisite for the next commit that enables to activate dm integrity devices in read-only mode. Note that we deliberately didn't flush the journal on suspend, so that the journal replay code would be tested. However, the dm-integrity code is 5

[dm-devel] [PATCH 2/2] dm-integrity: clear the journal on suspend

2022-11-15 Thread Mikulas Patocka
There was a problem that the user burned dm-integrity image on CDROM and could not activate it becaues it had non-empty journal. We fix this problem by flusing the journal (it is done by the previous patch) and clearing the journal (it is done by this patch). When we clear the journal, dm-integr

[dm-devel] [PATCH] dm init: add dm-mod.waitfor to wait for asynchronously probed block devices

2022-11-15 Thread Peter Korsgaard
Just calling wait_for_device_probe() is not enough to ensure that asynchronously probed block devices are available (E.G. mmc, usb, ..), so add a "dm-mod.waitfor=[,..,]" parameter to get dm-init to explicitly wait for specific block devices before initializing the tables with logic similar to the

Re: [dm-devel] [PATCH 1/3] blk-crypto: don't use struct request_queue for public interfaces

2022-11-15 Thread Eric Biggers
On Mon, Nov 14, 2022 at 05:29:42AM +0100, Christoph Hellwig wrote: > Switch all public blk-crypto interfaces to use struct block_device > arguments to specify the device they operate on instead of th > request_queue, which is a block layer implementation detail. > > Signed-off-by: Christoph Hellwi

Re: [dm-devel] [PATCH 2/3] blk-crypto: add a blk_crypto_config_supported_natively helper

2022-11-15 Thread Eric Biggers
On Mon, Nov 14, 2022 at 05:29:43AM +0100, Christoph Hellwig wrote: > Add a blk_crypto_config_supported_natively helper that wraps > __blk_crypto_cfg_supported to retrieve the crypto_profile from the > request queue. With this fscrypt can stop including > blk-crypto-profile.h and rely on the public

Re: [dm-devel] [PATCH 3/3] blk-crypto: move internal only declarations to blk-crypto-internal.h

2022-11-15 Thread Eric Biggers
On Mon, Nov 14, 2022 at 05:29:44AM +0100, Christoph Hellwig wrote: > blk_crypto_get_keyslot, blk_crypto_put_keyslot, __blk_crypto_evict_key > and __blk_crypto_cfg_supported are only used internally by the > blk-crypto code, so move the out of blk-crypto-profile.h, which is > included by drivers th

[dm-devel] [PATCH v2] dm init: add dm-mod.waitfor to wait for asynchronously probed block devices

2022-11-15 Thread Peter Korsgaard
Just calling wait_for_device_probe() is not enough to ensure that asynchronously probed block devices are available (E.G. mmc, usb, ..), so add a "dm-mod.waitfor=[,..,]" parameter to get dm-init to explicitly wait for specific block devices before initializing the tables with logic similar to the

Re: [dm-devel] [PATCH RFC v3 05/10] dm: make sure create and remove dm device won't race with open and close table

2022-11-15 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v3 08/10] block: fix use after free for bd_holder_dir

2022-11-15 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v3 09/10] block: store the holder kobject in bd_holder_disk

2022-11-15 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH v3 10/10] block: don't allow a disk link holder to itself

2022-11-15 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig (I'd even place this first in the series) -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel