summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WHATS_NEW_DM1
-rw-r--r--libdm/dm-tools/dmsetup.c14
2 files changed, 10 insertions, 5 deletions
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 1067312d3..71eee439f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.189 -
=====================================
+ Improve 'dmsetup create' without given table line with new kernels.
Version 1.02.187 - 10th November 2022
=====================================
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index 42eeead68..ea03d66c8 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -274,6 +274,7 @@ static char _disp_units = 's';
const char *_program_id = DM_STATS_PROGRAM_ID; /* program_id used for reports. */
static uint64_t _statstype = 0; /* stats objects to report */
static int _concise_output_produced = 0; /* Was any concise output already printed? */
+static int _added_target = 0; /* Count added target (no target -> no event) */
struct command;
static const struct command *_selection_cmd = NULL; /* Command to run against each device select with -S */
@@ -357,6 +358,8 @@ static int _parse_line(struct dm_task *dmt, char *buffer, const char *file,
if (!dm_task_add_target(dmt, start, size, ttype, ptr))
return_0;
+ _added_target++;
+
return 1;
}
@@ -1175,9 +1178,6 @@ static int _create_one_device(const char *name, const char *file)
_read_ahead_flags))
goto_out;
- if (_switches[NOTABLE_ARG])
- dm_udev_set_sync_support(0);
-
if (_switches[NOUDEVRULES_ARG])
udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
@@ -1194,8 +1194,12 @@ static int _create_one_device(const char *name, const char *file)
if (_udev_only)
udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
- if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
- !_task_run(dmt))
+ if (_switches[NOTABLE_ARG] || !_added_target)
+ cookie = 0; // ADD event -> no udev event handling
+ else if (!dm_task_set_cookie(dmt, &cookie, udev_flags))
+ goto_out;
+
+ if (!_task_run(dmt))
goto_out;
r = 1;