All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't forget to reload table when both reload and rename is required
@ 2014-06-25  8:57 Vaughan Cao
  2014-07-01 18:46 ` Christophe Varoqui
  0 siblings, 1 reply; 2+ messages in thread
From: Vaughan Cao @ 2014-06-25  8:57 UTC (permalink / raw)
  To: christophe.varoqui; +Cc: dm-devel, vaughan.cao

We encounter the following case:

@ After adding a multipaths section into /etc/multipath.conf to specify 'alias'
@ and other attributes for a particular multipath device and
@ reloading/restarting the multipathd service, only renaming of the multipath
@ device is done, other attribute changes are ignored.
@
@ It is more evident if you directly run 'multipath -r' to reload devmap after
@ adding the 'multipaths' section with alias into /etc/multipath.conf.
@
@ When reload/restart multipathd service or 'multipath -r' again, new settings
@ can be applied right.

It's because that in select_action() when force_reload is set, if we also need
rename the mpp device, reload action won't be taken any more.

I did this patch by introducing a new action ACT_RENAME2 to group these two
action. Test passed. However, it seems to be a rough patch and I am not
certain if this bind is fine refering to dm_reassign. Please comment, Thanks.

Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
---
 libmultipath/configure.c | 11 +++++++++++
 libmultipath/configure.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 3ed6b55..7331f90 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -385,6 +385,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
 				cmpp->alias, mpp->alias);
 			strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
 			mpp->action = ACT_RENAME;
+			if (force_reload)
+				mpp->action = ACT_RENAME2;
 			return;
 		}
 		mpp->action = ACT_CREATE;
@@ -623,6 +625,15 @@ domap (struct multipath * mpp, char * params)
 		r = dm_rename(mpp->alias_old, mpp->alias);
 		break;
 
+	case ACT_RENAME2:
+		r = dm_rename(mpp->alias_old, mpp->alias);
+		if (r) {
+			r = dm_addmap_reload(mpp, params);
+			if (r)
+				r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG);
+		}
+		break;
+
 	default:
 		break;
 	}
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index b3a6bb8..c014b55 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -18,6 +18,7 @@ enum actions {
 	ACT_RENAME,
 	ACT_CREATE,
 	ACT_RESIZE,
+	ACT_RENAME2,
 };
 
 #define FLUSH_ONE 1
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't forget to reload table when both reload and rename is required
  2014-06-25  8:57 [PATCH] Don't forget to reload table when both reload and rename is required Vaughan Cao
@ 2014-07-01 18:46 ` Christophe Varoqui
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Varoqui @ 2014-07-01 18:46 UTC (permalink / raw)
  To: Vaughan Cao; +Cc: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 2835 bytes --]

Applied.
Thanks.


On Wed, Jun 25, 2014 at 10:57 AM, Vaughan Cao <vaughan.cao@oracle.com>
wrote:

> We encounter the following case:
>
> @ After adding a multipaths section into /etc/multipath.conf to specify
> 'alias'
> @ and other attributes for a particular multipath device and
> @ reloading/restarting the multipathd service, only renaming of the
> multipath
> @ device is done, other attribute changes are ignored.
> @
> @ It is more evident if you directly run 'multipath -r' to reload devmap
> after
> @ adding the 'multipaths' section with alias into /etc/multipath.conf.
> @
> @ When reload/restart multipathd service or 'multipath -r' again, new
> settings
> @ can be applied right.
>
> It's because that in select_action() when force_reload is set, if we also
> need
> rename the mpp device, reload action won't be taken any more.
>
> I did this patch by introducing a new action ACT_RENAME2 to group these two
> action. Test passed. However, it seems to be a rough patch and I am not
> certain if this bind is fine refering to dm_reassign. Please comment,
> Thanks.
>
> Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
> ---
>  libmultipath/configure.c | 11 +++++++++++
>  libmultipath/configure.h |  1 +
>  2 files changed, 12 insertions(+)
>
> diff --git a/libmultipath/configure.c b/libmultipath/configure.c
> index 3ed6b55..7331f90 100644
> --- a/libmultipath/configure.c
> +++ b/libmultipath/configure.c
> @@ -385,6 +385,8 @@ select_action (struct multipath * mpp, vector curmp,
> int force_reload)
>                                 cmpp->alias, mpp->alias);
>                         strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
>                         mpp->action = ACT_RENAME;
> +                       if (force_reload)
> +                               mpp->action = ACT_RENAME2;
>                         return;
>                 }
>                 mpp->action = ACT_CREATE;
> @@ -623,6 +625,15 @@ domap (struct multipath * mpp, char * params)
>                 r = dm_rename(mpp->alias_old, mpp->alias);
>                 break;
>
> +       case ACT_RENAME2:
> +               r = dm_rename(mpp->alias_old, mpp->alias);
> +               if (r) {
> +                       r = dm_addmap_reload(mpp, params);
> +                       if (r)
> +                               r = dm_simplecmd_noflush(DM_DEVICE_RESUME,
> mpp->alias, MPATH_UDEV_RELOAD_FLAG);
> +               }
> +               break;
> +
>         default:
>                 break;
>         }
> diff --git a/libmultipath/configure.h b/libmultipath/configure.h
> index b3a6bb8..c014b55 100644
> --- a/libmultipath/configure.h
> +++ b/libmultipath/configure.h
> @@ -18,6 +18,7 @@ enum actions {
>         ACT_RENAME,
>         ACT_CREATE,
>         ACT_RESIZE,
> +       ACT_RENAME2,
>  };
>
>  #define FLUSH_ONE 1
> --
> 1.9.0
>
>

[-- Attachment #1.2: Type: text/html, Size: 3753 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-01 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25  8:57 [PATCH] Don't forget to reload table when both reload and rename is required Vaughan Cao
2014-07-01 18:46 ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.