Skip to contentSkip to conversation

multipath-tools: compilation fixes

PATCH In review Martin Wilck 2 participants 5 messages Jan 8, 2019 – Jan 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover multipath-tools: compilation fixes

Hi Christophe,

my late NVMe patch series broke compilatioin with older kernel headers. This series fixes that, and adds two other minor build-related fixes.

Regards,
Martin

Martin Wilck (3):
libmultipath: fix compilation with older kernel headers
multipath: fix gcc 4.8 uninitialized variable warning
multipath_tools: remove ENABLE_RADOS

 Makefile.inc                         |  4 +-
 libmultipath/Makefile                | 11 ++---
 libmultipath/foreign/Makefile        |  7 ++-
 libmultipath/nvme/linux/nvme_ioctl.h | 67 ++++++++++++++++++++++++++++
 multipath/main.c                     |  9 +---
 5 files changed, 76 insertions(+), 22 deletions(-)
 create mode 100644 libmultipath/nvme/linux/nvme_ioctl.h
Signature · 1 line
2.19.2
#1 lore raw

PATCH 1/3 libmultipath: fix compilation with older kernel headers

Compilation fails if the kernel headers don't provide "linux/nvme_ioctl.h". Fix that by shipping the kernel header file from nvme-cli.

Fixes 17c71c79e276 "libmultipath: add wrapper library for nvme ioctls"
---
 Makefile.inc                         |  1 +
 libmultipath/Makefile                | 11 ++---
 libmultipath/foreign/Makefile        |  7 ++-
 libmultipath/nvme/linux/nvme_ioctl.h | 67 ++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 12 deletions(-)
 create mode 100644 libmultipath/nvme/linux/nvme_ioctl.h
Makefile.inc +1 -0
index a83f02c7..23154fed 100644
@@ -66,6 +66,7 @@ mpathpersistdir	= $(TOPDIR)/libmpathpersist
 mpathcmddir	= $(TOPDIR)/libmpathcmd
 thirdpartydir	= $(TOPDIR)/third-party
 libdmmpdir	= $(TOPDIR)/libdmmp
+nvmedir		= $(TOPDIR)/libmultipath/nvme
 includedir	= $(prefix)/usr/include
 pkgconfdir	= $(usrlibdir)/pkgconfig
 
libmultipath/Makefile +3 -8
index 78cca5a8..a2be42ea 100644
@@ -7,7 +7,7 @@ SONAME = 0
 DEVLIB = libmultipath.so
 LIBS = $(DEVLIB).$(SONAME)
 
-CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir)
+CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir) -I$(nvmedir)
 
 LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu -laio
 
@@ -43,17 +43,12 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \
 	switchgroup.o uxsock.o print.o alias.o log_pthread.o \
 	log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
 	lock.o file.o wwids.o prioritizers/alua_rtpg.o prkey.o \
-	io_err_stat.o dm-generic.o generic.o foreign.o
-
-ifneq ($(call check_file,/usr/include/linux/nvme_ioctl.h),0)
-	OBJS += nvme-lib.o
-	CFLAGS += -Invme
-endif
+	io_err_stat.o dm-generic.o generic.o foreign.o nvme-lib.o
 
 all: $(LIBS)
 
 nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
-	$(CC) $(CFLAGS) -Wno-unused-function -I. -Invme -c -o $@ $<
+	$(CC) $(CFLAGS) -Wno-unused-function -c -o $@ $<
 
 make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2)
 
libmultipath/foreign/Makefile +3 -4
index 713762cb..fae58a0d 100644
@@ -1,13 +1,12 @@
 #
 # Copyright (C) 2003 Christophe Varoqui, <[email protected]>
 #
+TOPDIR=../..
 include ../../Makefile.inc
 
-CFLAGS += $(LIB_CFLAGS) -I.. -I../nvme
+CFLAGS += $(LIB_CFLAGS) -I.. -I$(nvmedir)
 
-# If you add or remove a checker also update multipath/multipath.conf.5
-LIBS= \
-	libforeign-nvme.so
+LIBS = libforeign-nvme.so
 
 all: $(LIBS)
 
libmultipath/nvme/linux/nvme_ioctl.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.19.2
#2 lore raw

PATCH 2/3 multipath: fix gcc 4.8 uninitialized variable warning

In reply to Martin Wilck

gcc 4.8 complained about "err" not being initialized. Fix, and simplify.

---
 multipath/main.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
multipath/main.c +2 -7
index a25e1b4f..5abb1181 100644
@@ -410,7 +410,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo,
 	struct timespec now, ftimes[2], tdiff;
 	struct stat st;
 	long fd;
-	int r, err, retries = 0;
+	int r, retries = 0;
 
 	clock_gettime(CLOCK_REALTIME, &now);
 
@@ -430,8 +430,6 @@ retry:
 	if (fd != -1) {
 		pthread_cleanup_push(close_fd, (void *)fd);
 		r = fstat(fd, &st);
-		if (r != 0)
-			err = errno;
 		pthread_cleanup_pop(1);
 
 	} else if (tmo > 0) {
@@ -460,15 +458,12 @@ retry:
 				path, strerror(errno));
 		}
 		r = fstat(fd, &st);
-		if (r != 0)
-			err = errno;
 		pthread_cleanup_pop(1);
 	} else
 		return FIND_MULTIPATHS_NEVER;
 
 	if (r != 0) {
-		condlog(1, "%s: error in fstat for %s: %s", __func__,
-			path, strerror(err));
+		condlog(1, "%s: error in fstat for %s: %m", __func__, path);
 		return FIND_MULTIPATHS_ERROR;
 	}
 
Signature · 1 line
2.19.2
#3 lore raw

PATCH 3/3 multipath_tools: remove ENABLE_RADOS

In reply to Martin Wilck

This is pointless since we removed RBD support altogether.

---
 Makefile.inc | 3 ---
 1 file changed, 3 deletions(-)
Makefile.inc +0 -3
index 23154fed..fc728ca9 100644
@@ -9,9 +9,6 @@
 # WITH_LOCAL_LIBDM	= 1
 # WITH_LOCAL_LIBSYSFS	= 1
 #
-# Uncomment to disable RADOS support (e.g. if rados headers are missing).
-# ENABLE_RADOS = 0
-#
 # Uncomment to disable libdmmp support
 # ENABLE_LIBDMMP = 0
 #
Signature · 1 line
2.19.2
#4 lore raw
In reply to Martin Wilck
Quoted 8 lines · Martin Wilck

Hi Christophe,

my late NVMe patch series broke compilatioin with older kernel headers. This series fixes that, and adds two other minor build-related fixes.

Regards,
Martin

ACK for the set

-Ben

Quoted 16 lines

Martin Wilck (3):
libmultipath: fix compilation with older kernel headers
multipath: fix gcc 4.8 uninitialized variable warning
multipath_tools: remove ENABLE_RADOS

 Makefile.inc                         |  4 +-
 libmultipath/Makefile                | 11 ++---
 libmultipath/foreign/Makefile        |  7 ++-
 libmultipath/nvme/linux/nvme_ioctl.h | 67 ++++++++++++++++++++++++++++
 multipath/main.c                     |  9 +---
 5 files changed, 76 insertions(+), 22 deletions(-)
 create mode 100644 libmultipath/nvme/linux/nvme_ioctl.h
Signature · 1 line
2.19.2