diff mbox

multipathd: revert mpp size update if map update fails

Message ID 1382662255-7861-1-git-send-email-michaelc@cs.wisc.edu (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Mike Christie Oct. 25, 2013, 12:50 a.m. UTC
From: Mike Christie <michaelc@cs.wisc.edu>

If updating the dm device in the kernel fails we cannot leave
the mpp size updated, because if we correct the problem and
try to resize later multipathd prevents resizing the device
of the size has not changed.

I hit this when all paths to a dm-multipath device where not
yet updated but multipathd resize was run.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 multipathd/cli_handlers.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Christophe Varoqui Oct. 25, 2013, 5:44 a.m. UTC | #1
Oh yes. Applied.
Thanks.


On Fri, Oct 25, 2013 at 2:50 AM, <michaelc@cs.wisc.edu> wrote:

> From: Mike Christie <michaelc@cs.wisc.edu>
>
> If updating the dm device in the kernel fails we cannot leave
> the mpp size updated, because if we correct the problem and
> try to resize later multipathd prevents resizing the device
> of the size has not changed.
>
> I hit this when all paths to a dm-multipath device where not
> yet updated but multipathd resize was run.
>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> ---
>  multipathd/cli_handlers.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
> index 4b860bb..58a5643 100644
> --- a/multipathd/cli_handlers.c
> +++ b/multipathd/cli_handlers.c
> @@ -567,6 +567,7 @@ int resize_map(struct multipath *mpp, unsigned long
> long size,
>                struct vectors * vecs)
>  {
>         char params[PARAMS_SIZE] = {0};
> +       unsigned long long orig_size = mpp->size;
>
>         mpp->size = size;
>         update_mpp_paths(mpp, vecs->pathvec);
> @@ -575,6 +576,7 @@ int resize_map(struct multipath *mpp, unsigned long
> long size,
>         if (domap(mpp, params) <= 0) {
>                 condlog(0, "%s: failed to resize map : %s", mpp->alias,
>                         strerror(errno));
> +               mpp->size = orig_size;
>                 return 1;
>         }
>         return 0;
> --
> 1.7.1
>
>
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 4b860bb..58a5643 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -567,6 +567,7 @@  int resize_map(struct multipath *mpp, unsigned long long size,
 	       struct vectors * vecs)
 {
 	char params[PARAMS_SIZE] = {0};
+	unsigned long long orig_size = mpp->size;
 
 	mpp->size = size;
 	update_mpp_paths(mpp, vecs->pathvec);
@@ -575,6 +576,7 @@  int resize_map(struct multipath *mpp, unsigned long long size,
 	if (domap(mpp, params) <= 0) {
 		condlog(0, "%s: failed to resize map : %s", mpp->alias,
 			strerror(errno));
+		mpp->size = orig_size;
 		return 1;
 	}
 	return 0;