summaryrefslogtreecommitdiff
path: root/libdm/ioctl
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2017-08-04 14:45:20 +0100
committerAlasdair G Kergon <agk@redhat.com>2017-08-04 14:45:20 +0100
commite6afe9e7820da5d5086dbcf82532bb9d0daafb00 (patch)
tree4d7e5aaf1a578fa3970f9119e2e9835347cd8384 /libdm/ioctl
parent5dd53943c9bee9d55cde9c8fee27a2e3ea031327 (diff)
downloadlvm2-e6afe9e7820da5d5086dbcf82532bb9d0daafb00.tar.gz
ioctl: Allow minor without major.
There's no need to insist on a major number being supplied when the code's going to override it if it's wrong anyway.
Diffstat (limited to 'libdm/ioctl')
-rw-r--r--libdm/ioctl/libdm-iface.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index c47e08467..e32af80ef 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1172,11 +1172,6 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
dmi->data_start = sizeof(struct dm_ioctl);
if (dmt->minor >= 0) {
- if (dmt->major <= 0) {
- log_error("Missing major number for persistent device.");
- goto bad;
- }
-
if (!_dm_multiple_major_support && dmt->allow_default_major_fallback &&
dmt->major != (int) _dm_device_major) {
log_verbose("Overriding major number of %d "
@@ -1185,6 +1180,11 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
dmt->major = _dm_device_major;
}
+ if (dmt->major <= 0) {
+ log_error("Missing major number for persistent device.");
+ goto bad;
+ }
+
dmi->flags |= DM_PERSISTENT_DEV_FLAG;
dmi->dev = MKDEV((dev_t)dmt->major, (dev_t)dmt->minor);
}