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.
87 lines
2.6 KiB
87 lines
2.6 KiB
7 years ago
|
From e3f74af78b774b235123b9d5fa40fead3b003bb2 Mon Sep 17 00:00:00 2001
|
||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||
|
Date: Fri, 20 Jan 2012 15:31:43 -0800
|
||
|
Subject: [PATCH] libparted: use dm_udev_wait (#698121)
|
||
|
|
||
|
This applies Peter Rajnoha's patch to use dm_udev_wait to
|
||
|
synchronize with udev.
|
||
|
|
||
|
This requires libdevmapper v1.02.39 and higher.
|
||
|
|
||
|
Patch is from:
|
||
|
https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html
|
||
|
|
||
|
Resolves: rhbz#698121
|
||
|
---
|
||
|
libparted/arch/linux.c | 16 +++++++++++++++-
|
||
|
1 files changed, 15 insertions(+), 1 deletions(-)
|
||
|
|
||
|
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||
|
index e2c4139..1fcbcad 100644
|
||
|
--- a/libparted/arch/linux.c
|
||
|
+++ b/libparted/arch/linux.c
|
||
|
@@ -1319,6 +1319,10 @@ linux_new (const char* path)
|
||
|
dev->dirty = 0;
|
||
|
dev->boot_dirty = 0;
|
||
|
|
||
|
+#ifdef ENABLE_DEVICE_MAPPER
|
||
|
+ dm_udev_set_sync_support(1);
|
||
|
+#endif
|
||
|
+
|
||
|
if (!_device_probe_type (dev))
|
||
|
goto error_free_arch_specific;
|
||
|
|
||
|
@@ -2676,16 +2680,21 @@ static int
|
||
|
_dm_remove_map_name(char *name)
|
||
|
{
|
||
|
struct dm_task *task = NULL;
|
||
|
- int rc;
|
||
|
+ int rc = 0;
|
||
|
+ uint32_t cookie = 0;
|
||
|
|
||
|
task = dm_task_create(DM_DEVICE_REMOVE);
|
||
|
if (!task)
|
||
|
return 1;
|
||
|
|
||
|
dm_task_set_name (task, name);
|
||
|
+ if (!dm_task_set_cookie(task, &cookie, 0))
|
||
|
+ goto err;
|
||
|
|
||
|
rc = dm_task_run(task);
|
||
|
+ dm_udev_wait(cookie);
|
||
|
dm_task_update_nodes();
|
||
|
+err:
|
||
|
dm_task_destroy(task);
|
||
|
if (!rc)
|
||
|
return 1;
|
||
|
@@ -2796,6 +2805,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
|
||
|
const char* dev_name = NULL;
|
||
|
char* params = NULL;
|
||
|
LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
|
||
|
+ uint32_t cookie = 0;
|
||
|
|
||
|
/* Get map name from devicemapper */
|
||
|
struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
|
||
|
@@ -2832,14 +2842,18 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
|
||
|
dm_task_set_name (task, vol_name);
|
||
|
dm_task_add_target (task, 0, part->geom.length,
|
||
|
"linear", params);
|
||
|
+ if (!dm_task_set_cookie(task, &cookie, 0))
|
||
|
+ goto err;
|
||
|
if (dm_task_run (task)) {
|
||
|
//printf("0 %ld linear %s\n", part->geom.length, params);
|
||
|
+ dm_udev_wait(cookie);
|
||
|
dm_task_update_nodes();
|
||
|
dm_task_destroy(task);
|
||
|
free(params);
|
||
|
free(vol_name);
|
||
|
return 1;
|
||
|
} else {
|
||
|
+ dm_udev_wait(cookie);
|
||
|
_dm_remove_map_name(vol_name);
|
||
|
}
|
||
|
err:
|
||
|
--
|
||
|
1.7.7.6
|
||
|
|