Linux Device Mapper development
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [PATCH 4/5] multipathd: fix version check for DM_DEV_ARM_POLL ioctl
Date: Fri, 14 Sep 2018 14:51:02 +0200	[thread overview]
Message-ID: <20180914125103.1154-4-mwilck@suse.com> (raw)
In-Reply-To: <20180914125103.1154-1-mwilck@suse.com>

Make sure the checks in dmevent_poll_supported() and
arm_dm_event_poll() use the same logic. Currently, the
version check check fails in arm_dm_event_poll() if
libdevmapper's DM_VERSION is newer than the kernel's.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipathd/dmevents.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c
index e98a974c..31e64a7e 100644
--- a/multipathd/dmevents.c
+++ b/multipathd/dmevents.c
@@ -50,16 +50,20 @@ struct dmevent_waiter {
 };
 
 static struct dmevent_waiter *waiter;
+/*
+ * DM_VERSION_MINOR hasn't been updated when DM_DEV_ARM_POLL
+ * was added in kernel 4.13. 4.37.0 (4.14) has it, safely.
+ */
+static const unsigned int DM_VERSION_FOR_ARM_POLL[] = {4, 37, 0};
 
 int dmevent_poll_supported(void)
 {
-	unsigned int minv[3] = {4, 37, 0};
 	unsigned int v[3];
 
 	if (dm_drv_version(v))
 		return 0;
 
-	if (VERSION_GE(v, minv))
+	if (VERSION_GE(v, DM_VERSION_FOR_ARM_POLL))
 		return 1;
 	return 0;
 }
@@ -120,9 +124,9 @@ static int arm_dm_event_poll(int fd)
 {
 	struct dm_ioctl dmi;
 	memset(&dmi, 0, sizeof(dmi));
-	dmi.version[0] = DM_VERSION_MAJOR;
-	dmi.version[1] = DM_VERSION_MINOR;
-	dmi.version[2] = DM_VERSION_PATCHLEVEL;
+	dmi.version[0] = DM_VERSION_FOR_ARM_POLL[0];
+	dmi.version[1] = DM_VERSION_FOR_ARM_POLL[1];
+	dmi.version[2] = DM_VERSION_FOR_ARM_POLL[2];
 	/* This flag currently does nothing. It simply exists to
 	 * duplicate the behavior of libdevmapper */
 	dmi.flags = 0x4;
-- 
2.18.0

  parent reply	other threads:[~2018-09-14 12:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 12:50 [PATCH 1/5] libmultipath: nvme: fix path detection for kernel 4.16 Martin Wilck
2018-09-14 12:51 ` [PATCH 2/5] libmultipath: nvme: shorter topology output Martin Wilck
2018-09-21 22:51   ` Benjamin Marzinski
2018-09-14 12:51 ` [PATCH 3/5] libmultipath: pathinfo: skip hidden devices Martin Wilck
2018-09-21 22:52   ` Benjamin Marzinski
2018-09-14 12:51 ` Martin Wilck [this message]
2018-09-21 22:52   ` [PATCH 4/5] multipathd: fix version check for DM_DEV_ARM_POLL ioctl Benjamin Marzinski
2018-09-14 12:51 ` [PATCH 5/5] multipathd: decrease log level of uevent messages Martin Wilck
2018-09-21 23:00   ` Benjamin Marzinski
2018-09-21 22:51 ` [PATCH 1/5] libmultipath: nvme: fix path detection for kernel 4.16 Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180914125103.1154-4-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox