[dm-devel] [PATCH] RCU protection for variable conf in add_map_with_path()

ding.yemin at zte.com.cn ding.yemin at zte.com.cn
Tue Oct 25 08:41:52 UTC 2016


From: "ding.yemin" <ding.yemin at zte.com.cn>

Take the variable "conf" under RCU protection in add_map_with_path()。

Signed-off-by: ding.yemin <ding.yemin at zte.com.cn>
---
 libmultipath/structs_vec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index a0c8869..b8ae87c 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -489,12 +489,14 @@ add_map_with_path (struct vectors * vecs,
 	conf = get_multipath_config();
 	mpp->mpe = find_mpe(conf->mptable, pp->wwid);
 	mpp->hwe = pp->hwe;
-	put_multipath_config(conf);
 
 	strcpy(mpp->wwid, pp->wwid);
 	find_existing_alias(mpp, vecs);
-	if (select_alias(conf, mpp))
+	if (select_alias(conf, mpp)) {
+		put_multipath_config(conf);
 		goto out;
+	}
+	put_multipath_config(conf);
 	mpp->size = pp->size;
 
 	if (adopt_paths(vecs->pathvec, mpp))
-- 
2.8.1.windows.1





More information about the dm-devel mailing list