Linux Device Mapper development
 help / color / mirror / Atom feed
From: "Benjamin Marzinski" <bmarzins@redhat.com>
To: Martin Wilck <mwilck@suse.com>
Cc: dm-devel@redhat.com
Subject: Re: [PATCH 09/31] libmultipath: support MPATH_UDEV_NO_PATHS_FLAG on map creation
Date: Wed, 13 Sep 2017 15:33:03 -0500	[thread overview]
Message-ID: <20170913203303.GK3145@octiron.msp.redhat.com> (raw)
In-Reply-To: <20170902223900.7339-10-mwilck@suse.com>

On Sun, Sep 03, 2017 at 12:38:38AM +0200, Martin Wilck wrote:
> Some vendor kernels (e.g. SUSE) have supported loading multipath
> maps without valid paths for a long time. Without that feature,
> problems can occur in failover scenarios when multipathd tries
> to (re)load maps after device failure/removal, because multipathd's
> attempts to reload the configuration may fail unnecessarily.
> The discussion in the kernel community is ongoing
> (see e.g. https://patchwork.kernel.org/patch/4579551/).

I don't object to the patch itself, but I'm pretty sure that this
solution to multipath's reloading issues is not currently under
consideration upstream.  It got Naked, and I wrote and alternative
method, which got accepted

https://www.redhat.com/archives/dm-devel/2014-September/msg00094.html

Do you still need this patch? The solution that's currently upstream
doesn't allow you to load new devices with failed paths, but it avoids
the issues that caused the SUSE patch to get Nak'ed. The multipath
user-space code already won't allow you to create a multipath device if
it can't open the path device, so I don't see why you need the ability
for the kernel to allow creation of devices with only failed paths. I
admit, there is a small window where multipath could open the path
device, and then the path device could fail before the load is sent to
the kernel.  In this case, with your patch, you could still create the
device (I believe).  But the much more likely case, where the path has
failed before multipath tries to open it, is still there. I don't see
the benefit of adding code to fix the corner case, while the common case
still doesn't work. Is there some other case where your patch is helpful
that I'm missing?

At any rate. Even if that kernel patch doesn't go upstream, I have no
objection to changing the code so the udev rules are robust enough to
handle this situation.

ACK

-Ben

> 
> One corner case of this is creation of a map with only failed
> paths. Such maps can be created if the kernel patch mentioned above
> is applied. The current udev rules for dm-multipath can't detect
> this situation. This patch fixes that by setting
> DM_SUBSYSTEM_UDEV_FLAG2, which is already used for the "map reload"
> case with no valid paths. Thus no additional udev rules are required
> to detect this situation.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  libmultipath/devmapper.c | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> index e701e806..7a3390a7 100644
> --- a/libmultipath/devmapper.c
> +++ b/libmultipath/devmapper.c
> @@ -300,12 +300,14 @@ dm_device_remove (const char *name, int needsync, int deferred_remove) {
>  
>  static int
>  dm_addmap (int task, const char *target, struct multipath *mpp,
> -	   char * params, int ro, int skip_kpartx) {
> +	   char * params, int ro, uint16_t udev_flags) {
>  	int r = 0;
>  	struct dm_task *dmt;
>  	char *prefixed_uuid = NULL;
>  	uint32_t cookie = 0;
> -	uint16_t udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
> +
> +	/* Need to add this here to allow 0 to be passed in udev_flags */
> +	udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
>  
>  	if (!(dmt = libmp_dm_task_create (task)))
>  		return 0;
> @@ -371,15 +373,27 @@ addout:
>  	return r;
>  }
>  
> +static uint16_t build_udev_flags(const struct multipath *mpp, int reload)
> +{
> +	/* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */
> +	return	(mpp->skip_kpartx == SKIP_KPARTX_ON ?
> +		 MPATH_UDEV_NO_KPARTX_FLAG : 0) |
> +		(mpp->nr_active == 0 ?
> +		 MPATH_UDEV_NO_PATHS_FLAG : 0) |
> +		(reload && !mpp->force_udev_reload ?
> +		 MPATH_UDEV_RELOAD_FLAG : 0);
> +}
> +
>  int dm_addmap_create (struct multipath *mpp, char * params)
>  {
>  	int ro;
> +	uint16_t udev_flags = build_udev_flags(mpp, 0);
>  
>  	for (ro = 0; ro <= 1; ro++) {
>  		int err;
>  
>  		if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, ro,
> -			      mpp->skip_kpartx))
> +			      udev_flags))
>  			return 1;
>  		/*
>  		 * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
> @@ -405,11 +419,7 @@ int dm_addmap_create (struct multipath *mpp, char * params)
>  int dm_addmap_reload(struct multipath *mpp, char *params, int flush)
>  {
>  	int r = 0;
> -	uint16_t udev_flags = ((mpp->force_udev_reload)?
> -			       0 : MPATH_UDEV_RELOAD_FLAG) |
> -			      ((mpp->skip_kpartx == SKIP_KPARTX_ON)?
> -			       MPATH_UDEV_NO_KPARTX_FLAG : 0) |
> -			      ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG);
> +	uint16_t udev_flags = build_udev_flags(mpp, 1);
>  
>  	/*
>  	 * DM_DEVICE_RELOAD cannot wait on a cookie, as
> @@ -419,12 +429,12 @@ int dm_addmap_reload(struct multipath *mpp, char *params, int flush)
>  	 */
>  	if (!mpp->force_readonly)
>  		r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params,
> -			      ADDMAP_RW, SKIP_KPARTX_OFF);
> +			      ADDMAP_RW, 0);
>  	if (!r) {
>  		if (!mpp->force_readonly && errno != EROFS)
>  			return 0;
>  		r = dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp,
> -			      params, ADDMAP_RO, SKIP_KPARTX_OFF);
> +			      params, ADDMAP_RO, 0);
>  	}
>  	if (r)
>  		r = dm_simplecmd(DM_DEVICE_RESUME, mpp->alias, !flush,
> -- 
> 2.14.0

  reply	other threads:[~2017-09-13 20:33 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-02 22:38 [PATCH 00/31] multipath/kpartx udev rules cleanup, and fixes Martin Wilck
2017-09-02 22:38 ` [PATCH 01/31] libmultipath: fix partition_delimiter config option Martin Wilck
2017-09-02 22:38 ` [PATCH 02/31] kpartx: helper functions for name and uuid generation Martin Wilck
2017-09-02 22:38 ` [PATCH 03/31] kpartx: search partitions by UUID, and rename Martin Wilck
2017-09-02 22:38 ` [PATCH 04/31] test-kpartx: add tests for renaming functionality Martin Wilck
2017-09-02 22:38 ` [PATCH 05/31] kpartx: fix a corner case when renaming partitions Martin Wilck
2017-09-02 22:38 ` [PATCH 06/31] kpartx: fix part deletion without partition table Martin Wilck
2017-09-02 22:38 ` [PATCH 07/31] test-kpartx: test deletion with empty part table Martin Wilck
2017-09-02 22:38 ` [PATCH 08/31] kpartx: only recognize dasd part table on DASD Martin Wilck
2017-09-02 22:38 ` [PATCH 09/31] libmultipath: support MPATH_UDEV_NO_PATHS_FLAG on map creation Martin Wilck
2017-09-13 20:33   ` Benjamin Marzinski [this message]
2017-09-14 11:53     ` Martin Wilck
2017-09-02 22:38 ` [PATCH 10/31] libmultipath: add get_udev_device Martin Wilck
2017-09-02 22:38 ` [PATCH 11/31] libmultipath: get_refwwid: use get_udev_device Martin Wilck
2017-09-02 22:38 ` [PATCH 12/31] libmultipath: use const char* in some dm helpers Martin Wilck
2017-09-02 22:38 ` [PATCH 13/31] libmultipath: add DI_NOIO flag for pathinfo Martin Wilck
2017-09-02 22:38 ` [PATCH 14/31] libmultipath: add dm_get_multipath Martin Wilck
2017-09-02 22:38 ` [PATCH 15/31] multipath: implement "check usable paths" (-C/-U) Martin Wilck
2017-09-13 20:53   ` Benjamin Marzinski
2017-09-14 11:47     ` Martin Wilck
2017-09-15 21:06       ` Benjamin Marzinski
2017-09-02 22:38 ` [PATCH 16/31] 11-dm-mpath.rules: multipath -U for READY check Martin Wilck
2017-09-02 22:38 ` [PATCH 17/31] 11-dm-mpath.rules: import more ID_FS_xxx vars from db Martin Wilck
2017-09-02 22:38 ` [PATCH 18/31] 11-dm-mpath.rules: no need to test before IMPORT Martin Wilck
2017-09-02 22:38 ` [PATCH 19/31] 11-dm-mpath.rules: handle new maps with READY==0 Martin Wilck
2017-09-02 22:38 ` [PATCH 20/31] 11-dm-mpath.rules: don't set READY->ACTIVATION Martin Wilck
2017-09-13 21:19   ` Benjamin Marzinski
2017-09-13 21:33     ` Martin Wilck
2017-09-14 12:48     ` Martin Wilck
2017-09-15 20:33       ` Benjamin Marzinski
2017-09-02 22:38 ` [PATCH 21/31] 11-dm-mpath.rules: Remember DM_ACTIVATION Martin Wilck
2017-09-13 21:19   ` Benjamin Marzinski
2017-09-14 13:06     ` Martin Wilck
2017-09-15 20:40       ` Benjamin Marzinski
2017-09-18 19:54         ` Martin Wilck
2017-09-02 22:38 ` [PATCH 22/31] multipath.rules: set ID_FS_TYPE to "mpath_member" Martin Wilck
2017-09-02 22:38 ` [PATCH 23/31] kpartx.rules: don't rely on DM_DEPS and DM_TABLE_STATE Martin Wilck
2017-09-02 22:38 ` [PATCH 24/31] kpartx.rules: respect DM_UDEV_LOW_PRIORITY_FLAG Martin Wilck
2017-09-02 22:38 ` [PATCH 25/31] kpartx.rules: improved logic for by-uuid and by-label links Martin Wilck
2017-09-02 22:38 ` [PATCH 26/31] kpartx.rules: create by-partuuid and by-partlabel symlinks Martin Wilck
2017-09-02 22:38 ` [PATCH 27/31] kpartx.rules: generate type-name links only for multipath devices Martin Wilck
2017-09-02 22:38 ` [PATCH 28/31] kpartx.rules: fix logic for adding partitions Martin Wilck
2017-09-02 22:38 ` [PATCH 29/31] multipath/kpartx rules: avoid superfluous scanning Martin Wilck
2017-09-02 22:38 ` [PATCH 30/31] kpartx/del-part-nodes.rules: new udev file Martin Wilck
2017-09-13 21:23   ` Benjamin Marzinski
2017-09-02 22:39 ` [PATCH 31/31] kpartx.rules: move symlink code to other files Martin Wilck
2017-09-13 21:26   ` Benjamin Marzinski
2017-09-13 21:28 ` [PATCH 00/31] multipath/kpartx udev rules cleanup, and fixes Benjamin Marzinski
2017-09-14 11:56   ` Martin Wilck
2017-09-14 20:00   ` [PATCH v2 30/31] kpartx/del-part-nodes.rules: new udev file Martin Wilck
2017-09-14 20:00     ` [PATCH v2 31/31] kpartx.rules: move symlink code to other files Martin Wilck

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=20170913203303.GK3145@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.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