[dm-devel] [PATCH v10 2/2] init: add support to directly boot to a mapped device

2018-11-02 Thread Helen Koike
From: Will Drewry Add a dm= kernel parameter. It allows device-mapper targets to be configured at boot time for use early in the boot process (as the root device or otherwise). Signed-off-by: Will Drewry Signed-off-by: Kees Cook [rework to use dm_ioctl calls] Signed-off-by: Enric Balletbo i

[dm-devel] [PATCH v10 0/2] dm: boot a mapped device without an initramfs

2018-11-02 Thread Helen Koike
As mentioned in the discussion from the previous version of this patch, Android and Chrome OS do not use initramfs mostly due to boot time and size liability. A practical example as mentioned by Kees is that Chrome OS has a limited amount of storage available for the boot image as it is covered by

[dm-devel] [PATCH v10 1/2] dm ioctl: add a device mapper ioctl function.

2018-11-02 Thread Helen Koike
From: Enric Balletbo i Serra Add a dm_ioctl_cmd to issue the equivalent of a DM ioctl call in kernel. Signed-off-by: Enric Balletbo i Serra --- Changes since v9: - https://www.redhat.com/archives/linux-lvm/2018-September/msg00016.html - Reorganize variables --- drivers/md/dm-ioctl.c

Re: [dm-devel] [PATCH v3 13/22] libmultipath: clariion checker: leave unsupported paths alone

2018-11-02 Thread Benjamin Marzinski
On Tue, Oct 30, 2018 at 10:06:44PM +0100, Martin Wilck wrote: > A checker shouldn't set the path state to PATH_DOWN if it fails > to obtain information about the path in the first place. Add logic > to the checker to distinguish a failed path from an unsupported path. > Reviewed-by: Benjamin

Re: [dm-devel] dm crypt: use unsigned long long instead of sector_t to store iv_offset

2018-11-02 Thread Milan Broz
On 01/11/2018 21:06, Mike Snitzer wrote: > On Thu, Nov 01 2018 at 4:53am -0400, > AliOS system security wrote: > >> The iv_offset in the mapping table of crypt target is a 64bit number >> when iv mode is plain64 or plain64be. It will be assigned to iv_offset of >> struct crypt_config, cc_sector

[dm-devel] [PATCH] dm crypt: use unsigned long long instead of sector_t to store iv_offset

2018-11-02 Thread AliOS system security
The iv_offset in the mapping table of crypt target is a 64bit number when iv mode is plain64 or plain64be. It will be assigned to iv_offset of struct crypt_config, cc_sector of struct convert_context and iv_sector of struct dm_crypt_request. These structures members are defined as a sector_t. But

Re: [dm-devel] dm crypt: use unsigned long long instead of sector_t to store iv_offset

2018-11-02 Thread AliOS system security
On 2018/11/2 4:06, Mike Snitzer wrote: On Thu, Nov 01 2018 at 4:53am -0400, AliOS system security wrote: The iv_offset in the mapping table of crypt target is a 64bit number when iv mode is plain64 or plain64be. It will be assigned to iv_offset of struct crypt_config, cc_sector of struct

[dm-devel] [PATCH v5 14/21] libmultipath: hp_sw checker: leave unsupported paths alone

2018-11-02 Thread Martin Wilck
A checker shouldn't set the path state to PATH_DOWN if it fails to obtain information about the path in the first place. Add logic to the checker to distinguish a failed path from an unsupported path. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/hp_sw.c

[dm-devel] [PATCH v5 16/21] libmultipath: tur checker: leave unsupported paths alone

2018-11-02 Thread Martin Wilck
A checker shouldn't set the path state to PATH_DOWN if it fails to obtain information about the path in the first place. Add logic to the checker to distinguish a failed path from an unsupported path. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/tur.c |

[dm-devel] [PATCH v5 21/21] libmultipath/checkers: cleanup class/instance model

2018-11-02 Thread Martin Wilck
The checkers code implicitly uses a sort-of OOP class/instance model, but very clumsily. Separate the checker "class" and "instance" cleanly, and do a few further cleanups (constifications etc) on the way. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers.c

[dm-devel] [PATCH v5 06/21] libmultipath/checkers: emc_clariion: use message id

2018-11-02 Thread Martin Wilck
emc_clariion is the only path checker that was using a non-constant message ("read error" case). This isn't possible with the msgid approach any more. Use condlog() for the dynamic log message and simply report "read error" as checker message. Reviewed-by: Benjamin Marzinski Signed-off-by:

[dm-devel] [PATCH v5 15/21] libmultipath: rdac checker: leave unsupported paths alone

2018-11-02 Thread Martin Wilck
A checker shouldn't set the path state to PATH_DOWN if it fails to obtain information about the path in the first place. Add logic to the checker to distinguish a failed path from an unsupported path. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/rdac.c

[dm-devel] [PATCH v5 04/21] libmultipath/checkers: cciss_tur: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/cciss_tur.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libmultipath/checkers/cciss_tur.c b/libmultipath/checkers/cciss_tur.c index 1cab2015..ea843742 100644 ---

[dm-devel] [PATCH v5 18/21] multipathd: check_path: improve logging for "unusable path" case

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 2f922db7..c57aa392 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1897,7 +1897,8 @@

[dm-devel] [PATCH v5 19/21] libmultipath: coalesce_paths: improve logging of orphaned paths

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/configure.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 09c3dcf2..ed3e30f5 100644 --- a/libmultipath/configure.c +++

[dm-devel] [PATCH v3 2/7] multipathd: remove init_path_check_interval()

2018-11-02 Thread Martin Wilck
After "libmultipath: set pp->checkint in store_pathinfo()", pp-checkint should always be properly initialized, so this code is not needed any more. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/main.c | 14 -- 1 file changed, 14 deletions(-) diff --git

[dm-devel] [PATCH v5 20/21] libmultipath: sync_map_state: log failing paths

2018-11-02 Thread Martin Wilck
Emit a log message when force-failing exisiting paths. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index

[dm-devel] [PATCH v3 5/7] multipathd: set DAEMON_CONFIGURE from uxlsnr thread

2018-11-02 Thread Martin Wilck
Commit ee01e841 had the intention to make multipathd quit if the client socket couldn't be set up, because the unix socket listener is vital for signal handling in multipathd. But during startup, this condition might be lost if the main thread doesn't wait for the unix listener to initialize.

[dm-devel] [PATCH v3 0/7] multipathd: make uxlsnr errors really fatal

2018-11-02 Thread Martin Wilck
Hi Christophe, this series, based on top of the recently submitted "various multipath-tools patches (v2)" and "checkers overhaul (v3)" series, fixes a problem that I recently observed: despite ee01e841 "multipathd: handle errors in uxlsnr as fatal", multipathd sometimes doesn't quit when the

[dm-devel] [PATCH v3 3/7] multipathd: print error message if checkint is not initialized

2018-11-02 Thread Martin Wilck
This is just a safety measure in case I overlooked something wrt the checkint initialization. It could be reverted once we know the error message isn't triggered. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/defaults.h | 1 + libmultipath/dict.c | 14

[dm-devel] [PATCH v3 7/7] multipathd: only grab conf once for filter_path()

2018-11-02 Thread Martin Wilck
This saves a possibly large number of cleanup push/pop calls and slightly improves readability. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/main.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c

[dm-devel] [PATCH v3 6/7] multipathd: make DAEMON_SHUTDOWN a terminal state

2018-11-02 Thread Martin Wilck
It can happen that, before the main thread reacts on DAEMON_SHUTDOWN and starts cancelling threads, another thread resets the state to something else. Fix that. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/cli_handlers.c | 9 +++-- multipathd/main.c |

[dm-devel] [PATCH v5 00/21] libmultipath: checkers overhaul

2018-11-02 Thread Martin Wilck
Hi Christophe, This is v5 of my "checkers overhaul" series. Changed wrt v4 are 03/22, 11/22, and 21/22. I re-post the whole series to avoid confusion. This series starts with a few minor fixes and then attempts an overhaul of the checker code. First, there's a block of patches to get rid of the

[dm-devel] [PATCH v5 11/21] multipathd: improve checker message logging

2018-11-02 Thread Martin Wilck
Don't rely on any variables being defined in LOG_MSG. If message log level is low, don't bother to fetch the message. Signed-off-by: Martin Wilck --- multipathd/main.c | 35 --- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/multipathd/main.c

[dm-devel] [PATCH v5 10/21] libmultipath/checkers: tur: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/tur.c | 54 - 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index a6c88eb2..22734be2 100644 ---

[dm-devel] [PATCH v5 09/21] libmultipath/checkers: readsector0: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/readsector0.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libmultipath/checkers/readsector0.c b/libmultipath/checkers/readsector0.c index 1c2a868e..cf79e067 100644 ---

[dm-devel] [PATCH v5 12/21] libmultipath/checkers: support unsupported paths

2018-11-02 Thread Martin Wilck
We should be able to distinguish the case where a checker determines a path to be positively down from the case where the checker fails to obtain necessary information, e.g. because of a configuration problem (wrong checker). Use PATH_WILD for the latter case, as it's hardly used now. Provide a

[dm-devel] [PATCH v3 4/7] multipathd: open client socket early

2018-11-02 Thread Martin Wilck
Open the unix socket in multipathd code and pass the fd to uxsock_listen(). This will enable us to make the main thread wait for successful socket initialization in a follow-up patch. Signed-off-by: Martin Wilck --- multipathd/main.c | 27 ++- multipathd/uxlsnr.c | 14

[dm-devel] [PATCH v5 02/21] libmultipath: fix memory leaks from scandir() use

2018-11-02 Thread Martin Wilck
scandir() users must not only free the resulting dirent* array, but also every member. Add a cleanup function, and fix the existing users of scandir() in libmultipath. Add a small helper macro for casting function pointers to the type pthread_cleanup_push() expects. Reviewed-by: Benjamin

[dm-devel] [PATCH v5 01/21] libmultipath: fix use of uninitialized memory in write()

2018-11-02 Thread Martin Wilck
valgrind complained about this. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 873035e5..3550c3a7 100644 ---

[dm-devel] [PATCH v5 03/21] libmultipath/checkers: replace message by msgid

2018-11-02 Thread Martin Wilck
Replace the character array "message" in struct checker with a "message ID" field. The generic checker code defines a couple of standard message IDs and corresponding messages. Checker-specific message IDs start at CHECKER_FIRST_MSG. Checkers that implement specific message IDs must provide a

[dm-devel] [PATCH v5 08/21] libmultipath/checkers: rdac: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/rdac.c | 64 +--- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/libmultipath/checkers/rdac.c b/libmultipath/checkers/rdac.c index 5104e4e5..266f8e10 100644 ---

[dm-devel] [PATCH v5 05/21] libmultipath/checkers: directio: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/directio.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c index a80848d4..c4a0712e 100644

[dm-devel] [PATCH v5 17/21] libmultipath: pathinfo: don't blank wwid if checker fails

2018-11-02 Thread Martin Wilck
Blanking a WWID is a dangerous operation. E.g. configure() would consider the path in question as invalid and orphan it if the WWID is blank. Don't do this checker failures which may be transient or indicate a badly configured or otherwise malfunctioning checker. Moreover, we try to determine WWID

[dm-devel] [PATCH v5 07/21] libmultipath/checkers: hp_sw: use message id

2018-11-02 Thread Martin Wilck
Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/hp_sw.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libmultipath/checkers/hp_sw.c b/libmultipath/checkers/hp_sw.c index 0ad34a6b..d7f1018c 100644 ---

[dm-devel] [PATCH v3 1/7] libmultipath: set pp->checkint in store_pathinfo()

2018-11-02 Thread Martin Wilck
store_pathinfo is called with valid conf pointer anyway, so checkint is available. pp->checkint is now valid for every path after path_discovery(). This fixes a bad conf access in cli_add_path(). Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 1 +

Re: [dm-devel] [PATCH] multipathd: display the host WWNN fields When the iSCSI path information is displayed using the multipath command, the host WWNN in the path information is not fully displayed,

2018-11-02 Thread Martin Wilck
Hello Sunao, On Sat, 2018-10-27 at 12:40 +0800, s90006763 wrote: > This patch solves this problem and gets the complete display of host > WWNN related fields,as follows:multipathd show paths format "%N %n" > Host WWNN Target WWPN > Iqn.xx-x.com.redhat:86329

Re: [dm-devel] [PATCH v3 4/7] multipathd: open client socket early

2018-11-02 Thread Benjamin Marzinski
On Fri, Nov 02, 2018 at 01:23:59PM +0100, Martin Wilck wrote: > Open the unix socket in multipathd code and pass the fd to > uxsock_listen(). This will enable us to make the main thread > wait for successful socket initialization in a follow-up patch. > Reviewed-by: Benjamin Marzinski >

Re: [dm-devel] [PATCH v5 03/21] libmultipath/checkers: replace message by msgid

2018-11-02 Thread Benjamin Marzinski
On Fri, Nov 02, 2018 at 01:21:07PM +0100, Martin Wilck wrote: > Replace the character array "message" in struct checker with > a "message ID" field. > > The generic checker code defines a couple of standard message IDs > and corresponding messages. Checker-specific message IDs start > at

Re: [dm-devel] dm crypt: use unsigned long long instead of sector_t to store iv_offset

2018-11-02 Thread Mike Snitzer
On Fri, Nov 02 2018 at 12:31am -0400, AliOS system security wrote: > On 2018/11/2 4:06, Mike Snitzer wrote: > >On Thu, Nov 01 2018 at 4:53am -0400, > >AliOS system security wrote: > > > >>The iv_offset in the mapping table of crypt target is a 64bit number > >>when iv mode is plain64 or

Re: [dm-devel] [PATCH v3 22/22] libmultipath: make checker_message thread safe

2018-11-02 Thread Martin Wilck
On Thu, 2018-11-01 at 14:53 -0500, Benjamin Marzinski wrote: > On Tue, Oct 30, 2018 at 10:06:53PM +0100, Martin Wilck wrote: > > Get rid of the static char buffer in checker_message() > > introduced in the previous "replace message by msgid" patch. > > What you have is fine, but why not