[dm-devel] [PATCH 7/9] multipathd: allow devices to switch from RW to RO

Martin Wilck mwilck at suse.com
Thu Apr 13 14:39:45 UTC 2017


On Fri, 2017-04-07 at 01:16 -0500, Benjamin Marzinski wrote:
> Whenever multipathd tries to reload a device, even if it's because a
> path switched from read/write to read-only, it tries to load the
> device
> read/write first, and then falls back to read-only. When device-
> mapper
> sees that multipath is using the same devices in the same state in
> its
> new table, it simply reuses the devices from the old table, instead
> of
> closing and re-opening them. This means that multipath can
> successfully
> reload the multipath device read/write, even if a path device has
> switched to read-only.  To deal with this, multipathd now doesn't try
> to
> reload a device read/write when it sees that a path device has
> switched
> to read-only.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  libmultipath/devmapper.c | 9 +++++----
>  libmultipath/structs.h   | 1 +
>  multipathd/main.c        | 3 +++
>  3 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index f4ff13e..995e580 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1017,7 +1017,10 @@ uev_update_path (struct uevent *uev, struct
> vectors * vecs)
>  			if (mpp->wait_for_udev)
>  				mpp->wait_for_udev = 2;
>  			else {
> +				if (ro == 1)
> +					pp->mpp->force_readonly = 1;
>  				retval = reload_map(vecs, mpp, 0,
> 1);
> +				pp->mpp->force_readonly = 0;

Why don't you leave this set to 1 until all paths have been switched to
rw mode? AFAICS, if any uevent arrives except a switch to ro (assume
several paths are ro and one switches back to rw), multipathd will
reload the map r/w. Or am I overlooking something?

Regards,
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list