Re: [dm-devel] [PATCH 2/6] crypto: algapi - use common mechanism for inheriting flags

2020-07-09 Thread Herbert Xu
On Thu, Jul 09, 2020 at 11:24:03PM -0700, Eric Biggers wrote: > > I decided to make crypto_check_attr_type() return the mask instead, and do so > via a pointer argument instead of the return value (so that we don't overload > an > errno return value and prevent flag 0x8000 from working). > Ple

Re: [dm-devel] [PATCH 2/6] crypto: algapi - use common mechanism for inheriting flags

2020-07-09 Thread Eric Biggers
On Thu, Jul 09, 2020 at 03:31:26PM +1000, Herbert Xu wrote: > Eric Biggers wrote: > > > > @@ -875,14 +873,21 @@ static void cbcmac_exit_tfm(struct crypto_tfm *tfm) > > > > static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb) > > { > > + struct crypto_attr_type *algt; >

[dm-devel] [PATCH v2 7/7] dm-crypt: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-09 Thread Eric Biggers
From: Mikulas Patocka Don't use crypto drivers that have the flag CRYPTO_ALG_ALLOCATES_MEMORY set. These drivers allocate memory and thus they are unsuitable for block I/O processing. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 17 +++-- 1 file changed, 11 insertions

[dm-devel] [PATCH v2 5/7] crypto: algapi - introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-09 Thread Eric Biggers
From: Eric Biggers Introduce a new algorithm flag CRYPTO_ALG_ALLOCATES_MEMORY. If this flag is set, then the driver allocates memory in its request routine. Such drivers are not suitable for disk encryption because GFP_ATOMIC allocation can fail anytime (causing random I/O errors) and GFP_KERNEL

[dm-devel] [PATCH v2 3/7] crypto: algapi - use common mechanism for inheriting flags

2020-07-09 Thread Eric Biggers
From: Eric Biggers The flag CRYPTO_ALG_ASYNC is "inherited" in the sense that when a template is instantiated, the template will have CRYPTO_ALG_ASYNC set if any of the algorithms it uses has CRYPTO_ALG_ASYNC set. We'd like to add a second flag (CRYPTO_ALG_ALLOCATES_MEMORY) that gets "inherited"

[dm-devel] [PATCH v2 2/7] crypto: seqiv - remove seqiv_create()

2020-07-09 Thread Eric Biggers
From: Eric Biggers seqiv_create() is pointless because it just checks that the template is being instantiated as an AEAD, then calls seqiv_aead_create(). But seqiv_aead_create() does the exact same check, via aead_geniv_alloc(). Just remove seqiv_create() and use seqiv_aead_create() directly.

[dm-devel] [PATCH v2 6/7] crypto: drivers - set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-09 Thread Eric Biggers
From: Mikulas Patocka Set the flag CRYPTO_ALG_ALLOCATES_MEMORY in the crypto drivers that allocate memory. drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c: sun8i_ce_cipher drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c: sun8i_ss_cipher drivers/crypto/amlogic/amlogic-gxl-core.c: meson_cipher

[dm-devel] [PATCH v2 1/7] crypto: geniv - remove unneeded arguments from aead_geniv_alloc()

2020-07-09 Thread Eric Biggers
From: Eric Biggers The type and mask arguments to aead_geniv_alloc() are always 0, so remove them. Signed-off-by: Eric Biggers --- crypto/echainiv.c | 2 +- crypto/geniv.c | 7 --- crypto/seqiv.c | 2 +- include/crypto/internal/geniv.h | 2 +-

[dm-devel] [PATCH v2 0/7] crypto: add CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-09 Thread Eric Biggers
This series introduces a flag that algorithms can set to indicate that they allocate memory during processing of typical inputs, and thus shouldn't be used in cases like dm-crypt where memory allocation failures aren't acceptable. Compared to Mikulas's patches, I've made the following improvements

[dm-devel] [PATCH v2 4/7] crypto: algapi - add NEED_FALLBACK to INHERITED_FLAGS

2020-07-09 Thread Eric Biggers
From: Eric Biggers CRYPTO_ALG_NEED_FALLBACK is handled inconsistently. When it's requested to be clear, some templates propagate that request to child algorithms, while others don't. It's apparently desired for NEED_FALLBACK to be propagated, to avoid deadlocks where a module tries to load itse

Re: [dm-devel] [git pull] device mapper fixes for 5.8-rc5

2020-07-09 Thread pr-tracker-bot
The pull request you sent on Thu, 9 Jul 2020 15:43:30 -0400: > git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git > tags/for-5.8/dm-fixes-2 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/2a89b99f580371b86ae9bafd6cbeccd3bfab524a Thank you! -- D

[dm-devel] [git pull] device mapper fixes for 5.8-rc5

2020-07-09 Thread Mike Snitzer
Hi Linus, The following changes since commit dcb7fd82c75ee2d6e6f9d8cc71c52519ed52e258: Linux 5.8-rc4 (2020-07-05 16:20:22 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git tags/for-5.8/dm-fixes-2 for you to fetch change

Re: [dm-devel] remove dead bdi congestion leftovers

2020-07-09 Thread Christoph Hellwig
On Thu, Jul 09, 2020 at 07:58:58AM -0600, Jens Axboe wrote: > On 7/8/20 11:32 PM, Christoph Hellwig wrote: > > On Wed, Jul 08, 2020 at 05:14:29PM -0600, Jens Axboe wrote: > >> On 7/1/20 3:06 AM, Christoph Hellwig wrote: > >>> Hi Jens, > >>> > >>> we have a lot of bdi congestion related code that is

Re: [dm-devel] remove dead bdi congestion leftovers

2020-07-09 Thread Jens Axboe
On 7/8/20 11:32 PM, Christoph Hellwig wrote: > On Wed, Jul 08, 2020 at 05:14:29PM -0600, Jens Axboe wrote: >> On 7/1/20 3:06 AM, Christoph Hellwig wrote: >>> Hi Jens, >>> >>> we have a lot of bdi congestion related code that is left around without >>> any use. This series removes it in preparation

Re: [dm-devel] [PATCH]libmultipath/dmparser: add missing path with good status when sync state with dm kernel

2020-07-09 Thread Martin Wilck
Hi Chongyun, On Wed, 2020-07-08 at 01:47 +, Chongyun Wu wrote: > Hello Martin, > Thanks for your reply. > Waiting for your patches I'd like to test it. And also, I'd like to > tell more detail about this issue. Please check out the series I just posted. Part V is what matters for your use c

[dm-devel] [PATCH 78/80] libmultipath: move reload_map() to multipathd

2020-07-09 Thread mwilck
From: Martin Wilck reload_map() is only used by multipathd. We don't have less exported symbols though, because select_action() now needs to be exported. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 40 +--- libmultipath/configure.h | 2 +- mu

[dm-devel] [PATCH 79/80] multipathd: rename update_path_groups() -> reload_and_sync_map()

2020-07-09 Thread mwilck
From: Martin Wilck This function doesn't just update the path groups. It completely rebuilds the multipath, reloads the kernel map, and syncs path states. That should be reflected in the function name, which should use the term "map", like all other functions that modify kernel state. Todo: ther

[dm-devel] [PATCH 76/80] libmultipath: select_action(): force udev reload for uninitialized maps

2020-07-09 Thread mwilck
From: Martin Wilck If we are in the reconfigure() code path, and we encounter maps to be reloaded, we usually set the DM_SUBSYSTEM_UDEV_FLAG0 flag to tell udev not to repeat device detection steps above the multipath layer. However, if the map was previously uninitialized, we have to force udev t

[dm-devel] [PATCH 77/80] libmultipath: log dm_task_run() errors

2020-07-09 Thread mwilck
From: Martin Wilck Log the ioctl error messages from libdm. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 22 --- libmultipath/devmapper.c | 61 libmultipath/devmapper.h | 4 +++ multipathd/dmevents.c| 4 ++- multipathd/wa

[dm-devel] [PATCH 80/80] libmultipath: select_action(): don't drop map if alias clashes

2020-07-09 Thread mwilck
From: Martin Wilck If for a given map, if we find that the requested alias is already used by a map with different WWID, while the map's own WWID is not used yet, give up the alias and use the WWID instead. This is safer than trying to destroy the existing map, which is likely to fail. This allo

[dm-devel] [PATCH 00/80] multipath-tools series part VI: incomplete udev initialization

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part VI of a larger patch series for multipath-tools I've been preparing. It's based on the previously submitted part V. The full series will also be available here: https://github.com/mwilck/multipath-tools/tree/ups/submit-2007 There are tags

[dm-devel] [PATCH 75/80] multipathd: uev_trigger(): handle incomplete ADD events

2020-07-09 Thread mwilck
From: Martin Wilck Udev may be killed after handling the ADD event for a multipath map, but before handling the subsequent CHANGE event that populates the udev data base with the device properties (e.g. during initrd processing). If this happens, the ADD uevent sent during coldplug will only prov

[dm-devel] [PATCH 55/74] libmultipath: add uninitialize_path()

2020-07-09 Thread mwilck
From: Martin Wilck This helper clears all fields of struct path (except pp->udev) that must be re-ininitialized if the path ever is to be used again. Signed-off-by: Martin Wilck --- libmultipath/structs.c | 19 +-- libmultipath/structs.h | 1 + libmultipath/structs_vec

[dm-devel] [PATCH 66/74] libmultipath: update_pathvec_from_dm: handle pp->mpp mismatch

2020-07-09 Thread mwilck
From: Martin Wilck Treat this like a WWID mismatch. Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 5dd37d5..8651

[dm-devel] [PATCH 67/74] libmultipath: disassemble_map(): always search paths by dev_t

2020-07-09 Thread mwilck
From: Martin Wilck There's no point in searching for the devname first. dev_t is the primary device property for both device mapper and udev. Signed-off-by: Martin Wilck --- libmultipath/dmparser.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libmultipath/dmparse

[dm-devel] [PATCH 56/74] multipath-tools: introduce INIT_REMOVED state

2020-07-09 Thread mwilck
From: Martin Wilck Introduce a new state for pp->initialized, INIT_REMOVED. This state means that the path is about to be removed, either by a remove uevent or by the operator. It will normally be a very short-lived state, because the path will be deleted from pathvec quickly after setting this s

[dm-devel] [PATCH 71/74] multipath: use update_pathvec_from_dm()

2020-07-09 Thread mwilck
From: Martin Wilck The multipath-specific function update_paths() can now be replaced with a call to update_pathvec_from_dm(). Signed-off-by: Martin Wilck --- multipath/main.c | 67 +++- 1 file changed, 3 insertions(+), 64 deletions(-) diff --git a/

[dm-devel] [PATCH 60/74] libmultipath: orphan_paths(): delete paths in INIT_REMOVED state

2020-07-09 Thread mwilck
From: Martin Wilck A path in INIT_REMOVED state is only waiting for its last association with a multipath map to be dropped. When orphan_paths() encounters such a path, rather than orphaning it, free it. Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 8 +++- 1 file changed, 7

[dm-devel] [PATCH 61/74] libmultipath: adopt_paths(): skip removed paths

2020-07-09 Thread mwilck
From: Martin Wilck If we don't do this, pathinfo() will fail on these paths, causing adopt_paths() to fail. Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 7c68592..1e

[dm-devel] [PATCH 74/74] libmultipath: dmparser: constify function arguments

2020-07-09 Thread mwilck
From: Martin Wilck With the previous change that avoids additions to pathvec, the pathvec argument to disassemble_map() is const now. Also use const for the string arguments where possible. Signed-off-by: Martin Wilck --- libmultipath/dmparser.c | 11 ++- libmultipath/dmparser.h | 4 +

[dm-devel] [PATCH 64/74] multipathd: check_path(): set retrigger_delay if necessary

2020-07-09 Thread mwilck
From: Martin Wilck In a follow up patch, we will set INIT_MISSING_UDEV and set tick=1 (minimal) at the same time. In this case, which is new, check_path() must reset the delay when it first triggers an uevent. Signed-off-by: Martin Wilck --- multipathd/main.c | 4 1 file changed, 4 insert

[dm-devel] [PATCH 73/74] libmultipath: decrease loglevel in store_path()

2020-07-09 Thread mwilck
From: Martin Wilck "Empty device name" in store_path() can happen regularly and shouldn't be logged at -v2. Signed-off-by: Martin Wilck --- libmultipath/structs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 056a205..

[dm-devel] [PATCH 62/74] multipathd: ev_remove_path(): use INIT_REMOVED

2020-07-09 Thread mwilck
From: Martin Wilck Set paths belonging to a map to INIT_REMOVED state before attempting to reload or flush the map. If the map association is successfully removed, the path will be actually deleted, either via flush_map() -> orphan_paths(), or in the update_multipath_strings()->sync_paths() code

[dm-devel] [PATCH 57/74] libmultipath: update_mpp_paths(): handle INIT_REMOVED

2020-07-09 Thread mwilck
From: Martin Wilck Since the ancient commit b96dead ("[multipathd] remove the retry login in uev_remove_path()"), update_mpp_paths() was used to check whether devices found in disassembled maps were still in the pathvec, and to skip them while re-assembling the new params string on reload. The re

[dm-devel] [PATCH 70/74] libmultipath: disassemble_map(): do not change pathvec and WWIDs

2020-07-09 Thread mwilck
From: Martin Wilck After introducing update_pathvec_from_dm() in a predecessor patch, the "layer violations" in disassemble_map() can now be removed. I hope this clarifies program logic a little bit. Callers need to call update_pathvec_from_dm() after disassemble_map(). Signed-off-by: Martin Wi

[dm-devel] [PATCH 69/74] libmultipath: disassemble_map(): get rid of "is_daemon" argument

2020-07-09 Thread mwilck
From: Martin Wilck The reason for the is_daemon parameter in disassemble_map() lies deep in multipath-tools' past, in b96dead ("[multipathd] remove the retry login in uev_remove_path()"): By not adding paths from disassembled maps to the pathvec, we avoided to re-add removed paths on future map r

[dm-devel] [PATCH 68/74] libmultipath: disassemble_map(): require non-NULL pathvec

2020-07-09 Thread mwilck
From: Martin Wilck We would fail in store_path() at the latest if pathvec was NULL. And all callers set pathvec anyway. Signed-off-by: Martin Wilck --- libmultipath/dmparser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/dmparser.c b/libmultipath/dmpars

[dm-devel] [PATCH 00/74] multipath-tools series part V: removed path handling

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part V of a larger patch series for multipath-tools I've been preparing. It's based on the previously submitted part IV. The full series will also be available here: https://github.com/mwilck/multipath-tools/tree/ups/submit-2007 There are tags

[dm-devel] [PATCH 72/74] libmpathpersist: use update_pathvec_from_dm()

2020-07-09 Thread mwilck
From: Martin Wilck The libmpathpersist-specific function updatepaths() can be replaced with the generic function. Signed-off-by: Martin Wilck --- libmpathpersist/mpath_persist.c | 54 + 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/libmpathpersis

[dm-devel] [PATCH 54/74] libmultipath: protect use of pp->udev

2020-07-09 Thread mwilck
From: Martin Wilck We could never be 100% certain that pp->udev was always set. With the upcoming change, we can be even less certain. Always check pp->udev before using it. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 11 +-- libmultipath/prioritizers/alua_r

[dm-devel] [PATCH 58/74] libmultipath: verify_paths(): don't delete paths from pathvec

2020-07-09 Thread mwilck
From: Martin Wilck If we encounter a non-existing device verify_paths(), just set it to INIT_REMOVED state. Actual path deletion is postponed until we don't see that path in the kernel map any more. This allows us to get rid of the "pathvec" argument to this function. Signed-off-by: Martin Wilc

[dm-devel] [PATCH 65/74] libmultipath: add update_pathvec_from_dm()

2020-07-09 Thread mwilck
From: Martin Wilck It can happen in particular during boot or startup that we encounter paths as map members which haven't been discovered or fully initialized yet, and are thus not in the pathvec. These paths need special treatment in various ways. Currently this is dealt with in disassemble_map

[dm-devel] [PATCH 59/74] libmultipath: sync_paths(): handle INIT_REMOVED

2020-07-09 Thread mwilck
From: Martin Wilck sync_paths() is the function which is called after getting kernel state with disassemble_map(). This is the place where we should check if paths that can eventually be deleted. Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 33 +

[dm-devel] [PATCH 63/74] multipathd: deal with INIT_REMOVED during path addition

2020-07-09 Thread mwilck
From: Martin Wilck With the introduction of INIT_REMOVED, we have to deal with the situation when a path is re-added in this state. This enables us to detect the situation where a path is added while still part of a map after a failed removal, which we couldn't before. Dealing with this correctly

[dm-devel] [PATCH 44/54] libmultipath: adopt_paths(): don't bail out on single path failure

2020-07-09 Thread mwilck
From: Martin Wilck If pathinfo fails for one path to be adopted, we currently fail the entire function. This may cause ev_add_path() for a valid path to fail because some other path is broken. Fix it by just skipping paths that don't look healthy. Signed-off-by: Martin Wilck --- libmultipath/s

[dm-devel] [PATCH 51/54] libmultipath: get_refwwid(): use switch statement

2020-07-09 Thread mwilck
From: Martin Wilck This code calls for a switch. Some additional compaction is possible by observing that the code for DEV_DEVNODE, DEV_DEVT, and DEV_UEVENT is almost the same, and factoring it out into a "common" section. Doing this with a goto inside the switch statement is a bit unusual, but s

[dm-devel] [PATCH 48/54] libmultipath: get_refwwid(): call get_multipath_config() only once

2020-07-09 Thread mwilck
From: Martin Wilck rather than 7 times in a single function. In get_refwwid(), the code that is not run under the RCU read lock is negligible, so we might as well keep the lock. The "invalid" variable becomes obsolete by this change. Signed-off-by: Martin Wilck --- libmultipath/configure.c |

[dm-devel] [PATCH 47/54] libmultipath: get_refwwid(): use find_path_by_devt()

2020-07-09 Thread mwilck
From: Martin Wilck If get_refwwid is called with a dev_t argument, there's no point in converting it into a devname first. If the device doesn't exist, get_udev_device() will fail. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 10 -- 1 file changed, 4 insertions(+), 6 del

[dm-devel] [PATCH 49/54] libmultipath: get_refwwid(): get rid of "check" label

2020-07-09 Thread mwilck
From: Martin Wilck This was necessary with with the interspersed pthread_cleanup_push()/pop() statements, now we can write the code more cleanly. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) di

[dm-devel] [PATCH 00/54] multipath-tools series part IV: identify paths by dev_t

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part IV of a larger patch series for multipath-tools I've been preparing. It's based on the previously submitted part III. The full series will also be available here: https://github.com/mwilck/multipath-tools/tree/ups/submit-2007 There are ta

[dm-devel] [PATCH 45/54] libmultipath: path_discover(): use find_path_by_devt()

2020-07-09 Thread mwilck
From: Martin Wilck In path_discover(), it's actually expected that a the path to be discovered is not already in pathvec. So, do search by devt in the first place rather than searching twice. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 32 1 file

[dm-devel] [PATCH 50/54] libmultipath: get_refwwid(): use symbolic return values

2020-07-09 Thread mwilck
From: Martin Wilck The return values of get_refwwid() are the same as those of pathinfo(). So use them. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 35 --- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/libmultipath/configure.c b/

[dm-devel] [PATCH 52/54] libmultipath: constify get_mpe_wwid()

2020-07-09 Thread mwilck
From: Martin Wilck As this returns a pointer to a struct member, the return value should also be a const char*. Signed-off-by: Martin Wilck --- libmultipath/config.c| 2 +- libmultipath/config.h| 2 +- libmultipath/configure.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-)

[dm-devel] [PATCH 53/54] multipath: call strchop() on command line argument

2020-07-09 Thread mwilck
From: Martin Wilck It's useful to sanitize these right away. We can't do this for DEV_DEVMAP, as aliases with trailing whitespace aren't strictly forbidden, but for the other types we can. Signed-off-by: Martin Wilck --- multipath/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mu

[dm-devel] [PATCH 46/54] libmultipath: path_discover(): always set DI_BLACKLIST

2020-07-09 Thread mwilck
From: Martin Wilck Since 65e1845 ("multipath: call store_pathinfo with DI_BLACKLIST"), we use DI_BLACKLIST for new paths. There's no reason why we shouldn't do the same with paths which are (unexpectedly) already in pathvec. As argued for 65e1845, this might save some unnecessary work for paths w

[dm-devel] [PATCH 43/54] libmultipath: adopt_paths(): use find_path_by_devt()

2020-07-09 Thread mwilck
From: Martin Wilck pp->dev_t is the primary identifying property for both dm and udev. Use it here, too. Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index

[dm-devel] [PATCH 54/54] libmultipath: get_refwwid(): skip strchop(), and constify dev parameter

2020-07-09 Thread mwilck
From: Martin Wilck With the previous change, we can safely assume that strchop() has been called already where appropriate (the only caller is multipath's configure()). We can now use const char* for the "dev" parameter. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 6 +++--- libm

[dm-devel] [PATCH 42/42] libmultipath: dm_addmap(): refuse creating map with empty WWID

2020-07-09 Thread mwilck
From: Martin Wilck We already avoid creating maps with empty WWID in coalesce_paths() as well as in ev_add_path(). The only code path where it's difficult to prove (although extremely unlikely) that we can't call dm_addmap(ACT_CREATE) with an empty WWID is update_path_groups()-> reload_map(). To

[dm-devel] [PATCH 41/42] libmultipath: refuse reloading an existing map with different WWID

2020-07-09 Thread mwilck
From: Martin Wilck If a map with given name (alias) already exists with a different WWID, reloading it with a new WWID will be harmful. The existing paths would be replaced by other, unrelated ones. The WWIDs of the new paths would not match the map WWID, and thus sooner or later overwritten by d

[dm-devel] [PATCH 40/42] libmultipath: refuse creating map with duplicate alias

2020-07-09 Thread mwilck
From: Martin Wilck If for some reason (e.g. user configuration error) the same alias is used for different WWIDs, multipathd starts behaving very weirdly. Sooner or later it "fixes" pp->wwid of some paths to match those of the other WWID, and may eventually coalesce paths with different WWIDs int

[dm-devel] [PATCH 00/42] multipath-tools series part III: duplicate alias

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part II of a larger patch series for multpath-tools I've been preparing. It contains fixes for a customer issue where the same alias was set for several maps with different WWIDs in the WWIDs file. It's based on the previously submitted part II.

[dm-devel] [PATCH 16/35] libmultipath: fix gcc -Wstringop-overflow warning

2020-07-09 Thread mwilck
From: Martin Wilck This fixes this gcc error message: error: ‘strncat’ specified bound 1 equals source length [-Werror=stringop-overflow=] Signed-off-by: Martin Wilck --- libmultipath/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/parser.c b/libmul

[dm-devel] [PATCH 36/39] libmultipath: add macro DEV_LOSS_TMO_UNSET

2020-07-09 Thread mwilck
From: Martin Wilck The special value 0 means "unset" for dev_loss. Make this more explicit by using a macro. Signed-off-by: Martin Wilck --- libmultipath/defaults.h | 1 + libmultipath/dict.c | 4 ++-- libmultipath/discovery.c | 12 +++- libmultipath/propsel.c | 2 +- 4 file

[dm-devel] [PATCH 04/35] multipath tools tests: add strchop() test

2020-07-09 Thread mwilck
From: Martin Wilck Signed-off-by: Martin Wilck --- tests/util.c | 63 1 file changed, 63 insertions(+) diff --git a/tests/util.c b/tests/util.c index 48de384..6d12fda 100644 --- a/tests/util.c +++ b/tests/util.c @@ -408,6 +408,68 @@ static i

[dm-devel] [PATCH 26/35] libmultipath: io_err_stat_handle_pathfail(): less error conditions

2020-07-09 Thread mwilck
From: Martin Wilck io_err_stat_pathfail() returns an error if marginal path checking is disabled, and on various other conditions which aren't runtime errors. Fix that. Also, check the validity of parameters when the configuration is read, and not on every call. Signed-off-by: Martin Wilck ---

[dm-devel] [PATCH 30/35] libmultipath: alloc_path(): initialize pp->initialized

2020-07-09 Thread mwilck
From: Martin Wilck INIT_NEW is 0, but being explicit is better here. Signed-off-by: Martin Wilck --- libmultipath/structs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 2dd378c..9407462 100644 --- a/libmultipath/structs.c +++ b/libmu

[dm-devel] [PATCH 25/35] libmultipath: pathinfo(): don't filter emtpy devnode names

2020-07-09 Thread mwilck
From: Martin Wilck In the update_multipath_strings() code path (disassemble_map()), we set an empty devname if we find devices in maps that are not in pathvec and not in sysfs. We shouldn't filter these devices by devnode, because failure in pathinfo() causes e.g. adopt_paths() to bail out, and t

[dm-devel] [PATCH 15/35] libmultipath: fix missing initializer warning from clang 3.9

2020-07-09 Thread mwilck
From: Martin Wilck clang 3.9 needs designators to accept implicit struct initialization. Signed-off-by: Martin Wilck --- libmultipath/checkers/directio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c inde

[dm-devel] [PATCH 01/35] multipath-tools tests/util: separate group for bitmask tests

2020-07-09 Thread mwilck
From: Martin Wilck Separate these more cleanly. Signed-off-by: Martin Wilck --- tests/util.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/tests/util.c b/tests/util.c index 7c486fc..48de384 100644 --- a/tests/util.c +++ b/tests/uti

[dm-devel] [PATCH 00/39] multipath-tools series part II: dev_loss_tmo fixes

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part II of a larger patch series for multpath-tools I've been preparing. It contains some minor fixes for dev_loss_tmo handling, mostly logging. It's based on the previously submitted part I. The full series will also be available here: https://

[dm-devel] [PATCH 09/35] libmultipath: use bitfields in group_by_match()

2020-07-09 Thread mwilck
From: Martin Wilck This makes "bitmap" a proper bitmap, and decreases memory consumption. Unit tests for pgpolicy.c still pass. Signed-off-by: Martin Wilck --- libmultipath/pgpolicies.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libmultipath/pgpolicies.c b

[dm-devel] [PATCH 32/35] libmultipath: log table params in addmap()

2020-07-09 Thread mwilck
From: Martin Wilck We currently log the table parameters with "load table" in domap() in the success case. But it's at least as interesting to get this information when domap() fails. Log in addmap() instead at v2 level. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 2 +- libmulti

[dm-devel] [PATCH 11/35] multipath-tools tests: add unit tests for strlcat

2020-07-09 Thread mwilck
From: Martin Wilck Also, use some constants for both strlcpy and strlcat tests. Signed-off-by: Martin Wilck --- tests/util.c | 222 --- 1 file changed, 210 insertions(+), 12 deletions(-) diff --git a/tests/util.c b/tests/util.c index db7c05f..3c

[dm-devel] [PATCH 27/35] libmultipath: improve libdm logging

2020-07-09 Thread mwilck
From: Martin Wilck Currently no libdm messages are logged at verbosity 3 and lower, not even fatal ones. That seems wrong. Rather, we should map our log levels (2 ~ WARN, 3 ~ NOTICE) to those of libdm (_LOG_WARN = 4, _LOG_NOTICE = 5). Tests show that the results are quite satisfactory for differe

[dm-devel] [PATCH 38/39] libmultipath: print message if setting dev_loss_tmo is unsupported

2020-07-09 Thread mwilck
From: Martin Wilck If dev_loss_tmo can't be set because it's not supported for the protocol at hand, let the user know. Fixme: we could implement this for other protocols such as NVMe. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 31 --- 1 file changed

[dm-devel] [PATCH 39/39] libmultipath: increase log level of limiting dev_loss_tmo

2020-07-09 Thread mwilck
From: Martin Wilck Users who aren't familar with the complex dependencies between dev_loss_tmo, no_path_retry, and fast_io_fail may be confused if their settings aren't applied. Print this log message at the default level. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 2 +- 1 file

[dm-devel] [PATCH 37/39] libmultipath: improve logging for dev_loss_tmo override

2020-07-09 Thread mwilck
From: Martin Wilck Print a more meaningful warning message, and at higher level, if the configured dev_loss_tmo can't be applied because it conflicts with no_path_retry. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-)

[dm-devel] [PATCH 31/35] libmultipath: alloc_path_with_pathinfo(): treat devname overflow as error

2020-07-09 Thread mwilck
From: Martin Wilck This is to be consistent with store_path_with_pathinfo(). It's not strictly necessary; we _could_ proceed in both functions even in the unlikely case that the device name overflows, because we use pp->dev mainly for log messages. However, a device node name that causes an overf

[dm-devel] [PATCH 14/35] libmultipath: rlookup_binding(): remove newline in log message

2020-07-09 Thread mwilck
From: Martin Wilck This clutters the log. The corresponding message in lookup_binding() doesn't have a newline, either. Signed-off-by: Martin Wilck --- libmultipath/alias.c | 2 +- tests/alias.c| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/alias.

[dm-devel] [PATCH 35/35] kpartx: add missing newline

2020-07-09 Thread mwilck
From: Martin Wilck Signed-off-by: Martin Wilck --- kpartx/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c index 86731ea..3efd6df 100644 --- a/kpartx/devmapper.c +++ b/kpartx/devmapper.c @@ -618,7 +618,7 @@ remove_partmap(co

[dm-devel] [PATCH 33/35] multipathd: remove set_multipath_wwid()

2020-07-09 Thread mwilck
From: Martin Wilck This function was only called from one place. Making the dm_get_uuid call explicit there makes the code more obvious. Signed-off-by: Martin Wilck --- multipathd/main.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/mul

[dm-devel] [PATCH 02/35] multipath-tools tests/directio: fix missing initializers

2020-07-09 Thread mwilck
From: Martin Wilck clang-3.9 doesn't like the {0} initializers for complex data structures. Signed-off-by: Martin Wilck --- tests/directio.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/directio.c b/tests/directio.c index 66aaf0e..989

[dm-devel] [PATCH 17/35] libmultipath: remove uevent listener failback

2020-07-09 Thread mwilck
From: Martin Wilck TL;DR: this code is obsolete. The failback code uses the udev 'RUN+="socket:"' technique, which has been deprecated since udev 178 and removed since udev 183, in 2012. The corresponding udev rule in multipath-tools has been removed in ad067ac ("multipath: do not install rules

[dm-devel] [PATCH 13/35] libmultipath: constify blacklist code

2020-07-09 Thread mwilck
From: Martin Wilck Add "const" qualifiers where appropriate. Signed-off-by: Martin Wilck --- libmultipath/blacklist.c | 34 +++--- libmultipath/blacklist.h | 17 +++-- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/libmultipath/blacklis

[dm-devel] [PATCH 23/35] libmultipath: make sysfs_pathinfo() static and use const

2020-07-09 Thread mwilck
From: Martin Wilck ... for the hwtable argument. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 5d4bf7d..c692026 100644 --- a/libmultipath/discov

[dm-devel] [PATCH 18/35] libmultipath: uevent: use static linkage where possible

2020-07-09 Thread mwilck
From: Martin Wilck Most of the symbols in uevent.c can be converted to static linkage. alloc_uevent() and uevent_get_wwid() are called in the unit test and added to the header file. Signed-off-by: Martin Wilck --- libmultipath/uevent.c | 45 --- libmulti

[dm-devel] [PATCH 22/35] libmultipath: get_uid(): improve log message on udev failure

2020-07-09 Thread mwilck
From: Martin Wilck If WWID determination by uid_attribute fails, and no fallback is available, multipath(d) print two error messages: "failed to get udev uid" and "failed to get unknown uid". That's confusing and unnecessary. Print only the udev message. If the fallback is available, this will re

[dm-devel] [PATCH 34/35] kpartx: print an error message if removing a partition fails

2020-07-09 Thread mwilck
From: Martin Wilck Signed-off-by: Martin Wilck --- kpartx/kpartx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index c24ad6d..5f59e15 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -635,6 +635,8 @@ main(int argc, char **argv){

[dm-devel] [PATCH 12/35] libmultipath: strlcpy()/strlcat(): use restrict qualifier

2020-07-09 Thread mwilck
From: Martin Wilck Also remove the redundant local variables. It's not necessary to make "restrict" work, but it makes the intention more clear. Signed-off-by: Martin Wilck --- libmultipath/util.c | 28 libmultipath/util.h | 4 ++-- 2 files changed, 14 insertions(

[dm-devel] [PATCH 06/35] multipath-tools tests: add test for devt2devname

2020-07-09 Thread mwilck
From: Martin Wilck Two tests skipped because they fail, will be fixed with the following patch. Signed-off-by: Martin Wilck --- tests/Makefile | 3 +- tests/devt.c | 194 + 2 files changed, 196 insertions(+), 1 deletion(-) create mode 100644

[dm-devel] [PATCH 20/35] libmultipath: decrease log level of "SCSI target" log message

2020-07-09 Thread mwilck
From: Martin Wilck ... in sysfs_get_tgt_nodename(). Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index aa5942c..1039fc4 100644 --- a/libmultipath/discovery.c +++

[dm-devel] [PATCH 08/35] libmultipath: create bitfield abstraction

2020-07-09 Thread mwilck
From: Martin Wilck In e32d521d ("libmultipath: coalesce_paths: fix size mismatch handling"), we introduced simple bitmap handling functions. We can do better. This patch introduces a bitfield type with overflow detection and a find_first_set() method. Use this in coalesce_paths(), and adapt the

[dm-devel] [PATCH 05/35] libmultipath: improve strchop()

2020-07-09 Thread mwilck
From: Martin Wilck strchop() returns size_t, so have it work with size_t, too. Also, avoid the unnecessary second call to strlen(). Signed-off-by: Martin Wilck --- libmultipath/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/util.c b/libmultipath/u

[dm-devel] [PATCH 24/35] libmultipath: pathinfo(): improve a log message

2020-07-09 Thread mwilck
From: Martin Wilck "node" is too generic to be understood without checking the code. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index c692026..2e559d8 100644 --

[dm-devel] [PATCH 07/35] libmultipath: devt2devname(): simplify using libudev

2020-07-09 Thread mwilck
From: Martin Wilck Replace the hand-written code by a simple libudev call. The two previously skipped tests can now be enabled again. Signed-off-by: Martin Wilck --- libmultipath/util.c | 87 ++--- libmultipath/util.h | 2 +- tests/devt.c| 2 --

[dm-devel] [PATCH 19/35] libmultipath: uevent: inline trivial functions

2020-07-09 Thread mwilck
From: Martin Wilck Export rather the not-quite-as-trivial getter functions, and convert the accessors to inline wrappers. Signed-off-by: Martin Wilck --- libmultipath/uevent.c | 34 ++ libmultipath/uevent.h | 41 +++-- 2 files

[dm-devel] [PATCH 00/35] multipath-tools series part I: minor changes

2020-07-09 Thread mwilck
From: Martin Wilck Hi Christophe, hi Ben, This is part I of a larger patch series for multpath-tools I've been preparing. It contains self-contained fixes and cleanups, and unit test additions. The full series will also be available here: https://github.com/mwilck/multipath-tools/tree/ups/submi

[dm-devel] [PATCH 28/35] libmultipath: snprint_devices(): use udev_enumerate

2020-07-09 Thread mwilck
From: Martin Wilck Rather than hand-coding the device enumeration, use udev as we do elsewhere, too. While at it, improve the overflow detection. Signed-off-by: Martin Wilck --- libmultipath/print.c | 75 libmultipath/print.h | 2 +- 2 files change

[dm-devel] [PATCH 10/35] libmultipath: util: constify function arguments

2020-07-09 Thread mwilck
From: Martin Wilck Use "const" for function arguments where possible. Signed-off-by: Martin Wilck --- libmultipath/dmparser.c | 2 +- libmultipath/util.c | 12 ++-- libmultipath/util.h | 10 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libmultipa

[dm-devel] [PATCH 03/35] tests: __wrap_dlog: use check_expected()

2020-07-09 Thread mwilck
From: Martin Wilck For function parameters, cmocka's check_expected() API should be used rather than will_return() / mock_type(). Signed-off-by: Martin Wilck --- tests/test-log.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test-log.c b/tests/test-log.c index

  1   2   >