[dm-devel] [PATCH] multipathd: revert mpp size update if map update fails

michaelc at cs.wisc.edu michaelc at cs.wisc.edu
Fri Oct 25 00:50:55 UTC 2013


From: Mike Christie <michaelc at 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 at 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




More information about the dm-devel mailing list