You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-linux-kernel/patches.suse/dm-emulate-blkrrpart-ioctl

52 lines
1.3 KiB

From: Hannes Reinecke <hare@suse.de>
Subject: Emulate BLKRRPART on device-mapper
Patch-mainline: not yet
Partitions on device-mapper devices are managed by kpartx (if at
all). So if we were just to send out a 'change' event if someone
called BLKRRPART on these devices, kpartx will be triggered via udev
and can manage the partitions accordingly.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/md/dm.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -421,19 +421,25 @@ static int dm_blk_ioctl(struct block_dev
if (!map || !dm_table_get_size(map))
goto out;
- /* We only support devices that have a single target */
- if (dm_table_get_num_targets(map) != 1)
- goto out;
-
- tgt = dm_table_get_target(map, 0);
-
if (dm_suspended_md(md)) {
r = -EAGAIN;
goto out;
}
- if (tgt->type->ioctl)
- r = tgt->type->ioctl(tgt, cmd, arg);
+ if (cmd == BLKRRPART) {
+ /* Emulate Re-read partitions table */
+ kobject_uevent(&disk_to_dev(md->disk)->kobj, KOBJ_CHANGE);
+ r = 0;
+ } else {
+ /* We only support devices that have a single target */
+ if (dm_table_get_num_targets(map) != 1)
+ goto out;
+
+ tgt = dm_table_get_target(map, 0);
+
+ if (tgt->type->ioctl)
+ r = tgt->type->ioctl(tgt, cmd, arg);
+ }
out:
dm_table_put(map);