Skip to contentSkip to conversation

multipathd: revert mpp size update if map update fails

PATCH In review [email protected] 2 participants 2 messages Oct 25, 2013 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipathd: revert mpp size update if map update fails

From: Mike Christie <[email protected]>

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.

---
 multipathd/cli_handlers.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
multipathd/cli_handlers.c +2 -0
index 4b860bb..58a5643 100644
@@ -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;
Signature · 1 line
1.7.1
#1 lore raw

Oh yes. Applied.
Thanks.

Quoted 41 lines · On Fri, Oct 25, 2013 at 2:50 AM, <[email protected]> wrote:

From: Mike Christie <[email protected]>

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.

---
 multipathd/cli_handlers.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
multipathd/cli_handlers.c +1 -0
index 4b860bb..58a5643 100644
@@ -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);
multipathd/cli_handlers.c +1 -0
@@ -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