Re: [dm-devel] [RFC PATCH] multipathd: strict_timing without signals

2018-03-07 Thread Benjamin Marzinski
On Wed, Mar 07, 2018 at 03:17:51PM +0100, Martin Wilck wrote: > The internal usage of SIGALRM by setitimer() function may cause subtle > conflicts with other uses of SIGALRM, either by multipath-tools code itself > (e.g. lock_file()) or libc (e.g. glob()). > > This patch changes the checkerloop

[dm-devel] [PATCH v2 1/5] tests: add unit tests for config file parser

2018-03-07 Thread Martin Wilck
Add test cases for parsing the config file. Some of these tests currently fail. The patches that follow fix them. Signed-off-by: Martin Wilck --- tests/Makefile | 2 +- tests/globals.c | 1 + tests/parser.c | 479

[dm-devel] [PATCH v2 4/5] libmultipath: config parser: fix corner case for double quotes

2018-03-07 Thread Martin Wilck
A corner case of the previous patch are strings starting with a double quote, such as '"prepended to itself is false" prepended to itself is false' or '"" is the empty string', and in particular, the string '"' ("\"" in C notation), which is indistinguishable from the "QUOTE" token in the parsed

[dm-devel] [PATCH v2 5/5] multipath.conf(5): improve syntax documentation

2018-03-07 Thread Martin Wilck
Describe the syntax of attribute / value pairs, comments, and quoted strings, as well as the peculiarities of section beginnings and ends. Also describe the newly added '""' feature. Signed-off-by: Martin Wilck --- multipath/multipath.conf.5 | 17 + 1 file

[dm-devel] [PATCH v2 0/5] Fixes for config file parsing

2018-03-07 Thread Martin Wilck
This series was motivated by the real-world problem that a user couldn't figure out how to write a blacklist entry for a device called '1.8" SSD'. Fixing this for good turned out to be a little tricky, therefore I also added a test suite. Changes since v1: - fixed a problem with parsing the

[dm-devel] [PATCH v2 3/5] libmultipath: config parser: Allow '"' in strings

2018-03-07 Thread Martin Wilck
We have seen model strings lile '2.5" SSD' which can't be parsed by the current config parser. This patch fixes this by allowing '""' to represent a double quote character inside a a string. The above model string could now be entered in the config file like this: blacklist { vendor

[dm-devel] [PATCH RESEND 1/4] libmultipath: get_uid: check VPD pages for SCSI only

2018-03-07 Thread Martin Wilck
The VPD code won't work for non-SCSI devices, anyway. For indentation reasons, I moved the "retrigger_tries" case to a separate function, which is also called only for SCSI devices. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 50

[dm-devel] [PATCH RESEND 3/4] libmultipath: uev_update_path: always warn if WWID changed

2018-03-07 Thread Martin Wilck
Print the warning about changed WWID not only if disable_changed_wwids is set, but always. It's actually more dangerous if that option is not set. Signed-off-by: Martin Wilck --- multipathd/main.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-)

[dm-devel] [PATCH RESEND 0/4] multipath-tools: fixes for path wwid detection and path change uevents

2018-03-07 Thread Martin Wilck
Hi Christophe, this small series fixes some minor glitches I found in the current path discovery code, and attempts to implement the safe part of the functionality discussed in the thread "multipathd: update path's udev in uev_update_path" in January (based on an idea from Wu Chongyun).

[dm-devel] [PATCH RESEND 4/4] libmultipath: uev_update_path: update path properties

2018-03-07 Thread Martin Wilck
Update pp->udev and those path attributes that can be cheaply updated from sysfs, i.e. without IO to the disk. Signed-off-by: Martin Wilck --- multipathd/main.c | 8 1 file changed, 8 insertions(+) diff --git a/multipathd/main.c b/multipathd/main.c index

[dm-devel] [PATCH 8/8] libmultipath: remove FREE_CONST() again

2018-03-07 Thread Martin Wilck
The FREE_CONST macro is of questionable value, as reviewers have pointed out. The users of this macro were mostly functions that called uevent_get_dm_xyz(). But these functions don't need to return const char*, as they allocate the strings they return. So my change of the prototype was wrong. This

[dm-devel] [PATCH 5/8] libmultipath: Fix sgio_get_vpd()

2018-03-07 Thread Martin Wilck
From: Bart Van Assche Pass the VPD page number to sgio_get_vpd() such that the page needed by the caller is queried instead of page 0x83. Fix the statement that computes the length of the page returned by do_inq(). Fix the return code check in the caller of

[dm-devel] [PATCH 2/8] libmultipath: enable feature disable changed wwid by default

2018-03-07 Thread Martin Wilck
From: Chongyun Wu enable feature disable changed wwid by default. Signed-off-by: Chongyun Wu Signed-off-by: Martin Wilck --- libmultipath/defaults.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[dm-devel] [PATCH 7/8] libmultipath: fix wrong output of "multipath -t"

2018-03-07 Thread Martin Wilck
The default values printed by "multipath -t" or "multipathd show config" for "detect_prio", "detect_checker", and "retain_attached_hw_handler" don't match the actual compiled-in defaults. Moreover, several other options would also be displayed wrongly if the defaults were changed. Signed-off-by:

[dm-devel] [PATCH 0/8] multipath-tools: missing patches in 0.7.5

2018-03-07 Thread Martin Wilck
Hi Christophe, I'm reposting the following patches that have been reviewed already. I think they should be merged. (Well, the last one has not officially been reviewed but it makes no functional changes and I'm quite positive Bart would approve). Regards, Martin Bart Van Assche (4):

[dm-devel] [PATCH 3/8] libmultipath, alloc_path_with_pathinfo(): Ensure that pp->wwid is '\0'-terminated

2018-03-07 Thread Martin Wilck
From: Bart Van Assche Discovered by Coverity (CID 173257). Signed-off-by: Bart Van Assche Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[dm-devel] [PATCH 4/8] kpartx: Improve reliability of find_loop_by_file()

2018-03-07 Thread Martin Wilck
From: Bart Van Assche Avoid that the strchr() call in this function examines uninitialized data on the stack. This patch avoids that Coverity reports the following: CID 173252: Error handling issues (CHECKED_RETURN) "read(int, void *, size_t)" returns the

[dm-devel] [PATCH 1/8] multipathd: add lock protection for cli_list_status

2018-03-07 Thread Martin Wilck
From: Chongyun Wu cli_list_status will access vecs->pathvec which should have lock protection, otherwise might get inconsistent data or other problem. Signed-off-by: Chongyun Wu Signed-off-by: Martin Wilck --- multipathd/main.c | 2

[dm-devel] [PATCH 6/8] Introduce the ibmultipath/unaligned.h header file

2018-03-07 Thread Martin Wilck
From: Bart Van Assche This patch avoids that Coverity reports the following for the code in libmultipath/prioritizers/alua_rtpg.c: CID 173256: Integer handling issues (SIGN_EXTENSION) Suspicious implicit sign extension: "buf[0]" with type "unsigned char" (8

[dm-devel] [PATCH 0/4] multipath-tools: important fixes for 0.7.5

2018-03-07 Thread Martin Wilck
Hi Christophe, thanks for catching up. This series fixes immediate problems with 0.7.5. The first one corresponds to my previously posted "[PATCH v3 2/2] multipathd: start marginal path checker thread lazily", and fixes a crash. The others fix the problens reported by Xose. Regards Martin

[dm-devel] [PATCH 1/4] libmultipath: fix crash on shutdown if io_err thread isn't running

2018-03-07 Thread Martin Wilck
If we've never created the io_error checker thread, we shouldn't cancel it. Fixes: 160da9fa4339 "multipathd: start marginal path checker thread lazily" Signed-off-by: Martin Wilck --- libmultipath/io_err_stat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git

[dm-devel] [PATCH 3/4] multipath: fix clang warning in delegate_to_multipathd

2018-03-07 Thread Martin Wilck
Fixes this warning from clang: main.c:628:11: warning: variable 'reply' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] ... main.c:609:32: note: initialize the variable 'reply' to silence this warning Fixes: 506d253b7f89 "multipath: delegate dangerous commands

[dm-devel] [PATCH 2/4] multipathd: fix -Wpointer-to-int-cast warning in uxlsnr

2018-03-07 Thread Martin Wilck
Fixes: "multipathd: release uxsocket and resource when cancel thread" Signed-off-by: Martin Wilck --- multipathd/uxlsnr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c index 0531061912b3..cdafd82943e7 100644 ---

Re: [dm-devel] multipath-tools: broken build system + warnings

2018-03-07 Thread Martin Wilck
On Wed, 2018-03-07 at 23:30 +0100, Xose Vazquez Perez wrote: > On 03/07/2018 10:16 PM, Martin Wilck wrote: > > > On Wed, 2018-03-07 at 17:40 +0100, Xose Vazquez Perez wrote: > > > Hi, > > > > > > It has to type "make" *twice* to build the full > > > source code. > > > > Hm, strange. I need to

Re: [dm-devel] multipath-tools: broken build system + warnings

2018-03-07 Thread Xose Vazquez Perez
On 03/07/2018 10:16 PM, Martin Wilck wrote: > On Wed, 2018-03-07 at 17:40 +0100, Xose Vazquez Perez wrote: >> Hi, >> >> It has to type "make" *twice* to build the full >> source code. > > Hm, strange. I need to double check. It doesn't happen with my tree > AFAICS. These are removed by "make":

Re: [dm-devel] multipath-tools: broken build system + warnings

2018-03-07 Thread Martin Wilck
On Wed, 2018-03-07 at 17:40 +0100, Xose Vazquez Perez wrote: > Hi, > > It has to type "make" *twice* to build the full > source code. Hm, strange. I need to double check. It doesn't happen with my tree AFAICS. > > And new warnings: > > 2 gcc warnings === > make[1]: Entering directory

Re: [dm-devel] [PATCH v2 23/23] multipathd: fix signal blocking logic

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:07AM +0100, Martin Wilck wrote: > multipathd is supposed to block all signals in all threads, except > the uxlsnr thread which handles termination and reconfiguration > signals (SIGUSR1) in its ppoll() call, SIGUSR2 in the waiter thread > and the marginal path checker

Re: [dm-devel] [PATCH v2 22/23] multipathd: update path group prio in check_path

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:06AM +0100, Martin Wilck wrote: > The previous patch "libmultipath: don't update path groups when printing" > removed the call to path_group_prio_update() in the printing code path. > To compensate for that, recalculate path group prio also when it's not > strictly

Re: [dm-devel] [PATCH v2 21/23] libmultipath: foreign/nvme: implement path display

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:05AM +0100, Martin Wilck wrote: > implement display of path information for NVMe foreign paths and maps. > With this patch, I get output like this for Linux NVMe soft targets: > > nvme-submultipathd show topology > sys0:NQN:subsysname

Re: [dm-devel] [PATCH v2 20/23] multipathd: use foreign API

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:04AM +0100, Martin Wilck wrote: > Call into the foreign library code when paths are discovered, uevents > are received, and in the checker loop. Furthermore, use the foreign > code to print information in the "multipathd show paths", "multipathd > show maps", and

Re: [dm-devel] [PATCH v2 18/23] libmultipath: pathinfo: call into foreign library

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:02AM +0100, Martin Wilck wrote: > This actually enables the use of foreign paths. > Reviewed-by: Benjamin Marzinski > Signed-off-by: Martin Wilck > --- > libmultipath/discovery.c | 4 +++- > 1 file changed, 3 insertions(+),

Re: [dm-devel] [PATCH v2 17/23] libmultipath/foreign: nvme foreign library

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:15:01AM +0100, Martin Wilck wrote: > This still contains stubs for path handling and checking, but it's functional > for printing already. > Reviewed-by: Benjamin Marzinski > Signed-off-by: Martin Wilck > --- > Makefile

Re: [dm-devel] [PATCH v2 15/23] libmultipath: API for foreign multipath handling

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:14:59AM +0100, Martin Wilck wrote: > Add an API for "foreign" multipaths. Foreign libraries are loaded > from ${multipath_dir}/libforeign-*.so, as we do for checkers. > > Refer to "foreign.h" for details about the API itself. Like we do for > checkers, high-level

Re: [dm-devel] [PATCH v2 13/23] libmultipath: print: convert API to generic data type

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:14:57AM +0100, Martin Wilck wrote: > Convert higher level API (snprint_multipath_topology() etc) to > using the generic multipath API. This will allow "foreign" > multipath objects that implement the generic API to be printed > exactly like native multipathd objects. >

Re: [dm-devel] [PATCH v2 12/23] libmultipath: "generic multipath" interface

2018-03-07 Thread Benjamin Marzinski
On Tue, Mar 06, 2018 at 12:14:56AM +0100, Martin Wilck wrote: > This patch adds a simplified abstract interface to the multipath data > structures. > The idea is to allow "foreign" data structures to be treated by libmultipath > if they implement the same interface. Currently, the intention is to

Re: [dm-devel] [PATCH 0/6] Fixes for config file parsing

2018-03-07 Thread Martin Wilck
On Tue, 2018-03-06 at 23:56 +0100, Martin Wilck wrote: > This series was motivated by the real-world problem that a user > couldn't > figure out how to write a blacklist entry for a device called '1.8" > SSD'. > Fixing this for good turned out to be a little tricky, therefore I > also > added a

[dm-devel] multipath-tools: broken build system + warnings

2018-03-07 Thread Xose Vazquez Perez
Hi, It has to type "make" *twice* to build the full source code. And new warnings: 2 gcc warnings === make[1]: Entering directory '/home/xose/curre/arrays/multipath-tools/multipathd' cc -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int -Werror=implicit-function-declaration

Re: [dm-devel] [PATCH] multipathd: use nanosleep for sleeping

2018-03-07 Thread Martin Wilck
On Tue, 2018-03-06 at 19:21 -0600, Benjamin Marzinski wrote: > On Tue, Mar 06, 2018 at 09:37:13PM +0100, Martin Wilck wrote: > > > > I'm sure this works, but have you considered achieving the same > > result > > simply by using create_timer with a different signal than SIGALRM? > > Thinking about

Re: [dm-devel] [PATCH] multipath-tools: add info about how to get a release directly from gitweb

2018-03-07 Thread Christophe Varoqui
Thanks, applied. On Wed, Mar 7, 2018 at 2:28 PM, Xose Vazquez Perez wrote: > On 01/12/2018 05:56 PM, Xose Vazquez Perez wrote: > > > gitweb is able to extract and serve a release right away. > > This one is missing. > > > Cc: Christophe Varoqui

[dm-devel] [RFC PATCH] multipathd: strict_timing without signals

2018-03-07 Thread Martin Wilck
The internal usage of SIGALRM by setitimer() function may cause subtle conflicts with other uses of SIGALRM, either by multipath-tools code itself (e.g. lock_file()) or libc (e.g. glob()). This patch changes the checkerloop to use an interval timer and a pthread condition variable. No signals are

[dm-devel] [PATCH v3 1/2] libmultipath: fix race in stop_io_err_stat_thread

2018-03-07 Thread Martin Wilck
It's wrong, and unnecessary, to call pthread_kill() after pthread_cancel(). I have observed cases where the io_err checker thread hung in libpthread after receiving the USR2 signal, in particular when multipathd is run under strace. (If multipathd is killed with SIGINT under strace, and the

[dm-devel] [PATCH v3 2/2] multipathd: start marginal path checker thread lazily

2018-03-07 Thread Martin Wilck
I noticed that the io_error checker thread accounts for most of the activity of multipathd even if the marginal path checking paramters are not set (which is still the default in most installations I assume). Therefore, start the io_error checker thread only if there's at least one map with

[dm-devel] [PATCH v3 0/2] marginal path fixes

2018-03-07 Thread Martin Wilck
Changes wrt v2: - 2/2: Fixed bug that would cause a crash if marginal path checker was off. (if we don't start the thread, we'd better not kill it, either). Martin Wilck (2): libmultipath: fix race in stop_io_err_stat_thread multipathd: start marginal path checker thread lazily

Re: [dm-devel] [PATCH] multipath-tools: add info about how to get a release directly from gitweb

2018-03-07 Thread Xose Vazquez Perez
On 01/12/2018 05:56 PM, Xose Vazquez Perez wrote: > gitweb is able to extract and serve a release right away. This one is missing. > Cc: Christophe Varoqui > Cc: device-mapper development > Signed-off-by: Xose Vazquez Perez

[dm-devel] [PATCH] libmultipath: remove FREE_CONST() again

2018-03-07 Thread Martin Wilck
The FREE_CONST macro is of questionable value, as reviewers have pointed out. The users of this macro were mostly functions that called uevent_get_dm_xyz(). But these functions don't need to return const char*, as they allocate the strings they return. So my change of the prototype was wrong. This

Re: [dm-devel] [PATCH 0/6] Various multipath-tools patches

2018-03-07 Thread Christophe Varoqui
Hi Bart, I've finally merged the queued patches, so you can rebase this patchset over the new head. Thanks. On Tue, Mar 6, 2018 at 4:25 PM, Benjamin Marzinski wrote: > On Thu, Mar 01, 2018 at 11:29:29AM -0800, Bart Van Assche wrote: > > Hello Christophe, > > > > This

Re: [dm-devel] [RFC PATCH 00/16] multipath path classification

2018-03-07 Thread Martin Wilck
Hello Christophe, On Wed, 2018-03-07 at 09:53 +0100, Christophe Varoqui wrote: > Martin, Ben, > > can you update me on the status of this patchset ? > Is it ready for inclusion ? No. I am preparing an updated set that's much improved. Regards Martin -- Dr. Martin Wilck ,

Re: [dm-devel] confusion about multipath_prepare_ioctl

2018-03-07 Thread shhuiw
On 2018年03月06日 13:44, Mike Snitzer wrote: > On Mon, Mar 05 2018 at 10:35pm -0500, > Wang Sheng-Hui wrote: > >> Dear, >> >> Sorry to trouble you. >> >> I noticed some code in dm-*.c like: >> " >> static int multipath_prepare_ioctl(struct dm_target *ti, >> struct

[dm-devel] [PATCH] Add an option to dm-verity to validate hashes at most once

2018-03-07 Thread Patrik Torstensson
Add an option to dm-verity to validate hashes at most once to allow platforms that is CPU/memory contraint to be protected by dm-verity against offline attacks. The option introduces a bitset that is used to check if a block has been validated before or not. A block can be validated more than

Re: [dm-devel] [RFC PATCH 00/16] multipath path classification

2018-03-07 Thread Christophe Varoqui
Martin, Ben, can you update me on the status of this patchset ? Is it ready for inclusion ? Thanks, Christophe On Fri, Jan 19, 2018 at 1:29 AM, Martin Wilck wrote: > This patch series implements the recommendation in my recent posting > "Multipath path classification

Re: [dm-devel] dm-bufio: avoid false-positive Wmaybe-uninitialized warning

2018-03-07 Thread Arnd Bergmann
On Wed, Mar 7, 2018 at 2:29 AM, Mike Snitzer wrote: > On Tue, Mar 06 2018 at 4:33pm -0500, > Arnd Bergmann wrote: > >> On Thu, Feb 22, 2018 at 5:04 PM, Mike Snitzer wrote: >> > On Thu, Feb 22 2018 at 10:56am -0500, >> > Arnd Bergmann