dm-multipath: multipathd blacklisting
Benjamin Marzinski
maintainermultipathd doesn't correctly blacklist devices by wwid, because the blacklist check happens before the device information is known. This patch fixes that.
-Ben
multipathd/cli_handlers.c +4 -2
@@ -274,16 +274,18 @@ cli_add_path (void * v, char ** reply, i {struct vectors * vecs = (struct vectors *)data;char * param =get_keyparam (v,PATH ); +int r;condlog (2 ,"%s: add path (operator)" , param); -if (blacklist (conf->blist_devnode, param)) { +if (blacklist (conf->blist_devnode, param) || + (r =ev_add_path (param, vecs)) ==2 ) { *reply =strdup ("blacklisted" ); *len =strlen (*reply) +1 ;condlog (2 ,"%s: path blacklisted" , param);return 0 ; } -return ev_add_path (param, vecs); +return r; }int
multipathd/main.c +24 -5
@@ -622,9 +622,16 @@ static int uev_add_path (char * devname, struct vectors * vecs) {condlog (2 ,"%s: add path (uevent)" , devname); -return ev_add_path (devname, vecs); +return (ev_add_path (devname, vecs) !=1 )?0 :1 ; } + +/* +* returns: +* 0: added +* 1: error +* 2: blacklisted +*/ int ev_add_path (char * devname,struct vectors * vecs) {
@@ -661,7 +668,13 @@ ev_add_path (char * devname, struct vectcondlog (0 ,"%s: failed to get path uid" , devname);return 1 ;/* leave path added to pathvec */ } - +if (blacklist_path (conf, pp)){ +int i =find_slot (vecs->pathvec, (void *)pp); +if (i !=-1 ) +vector_del_slot (vecs->pathvec, i); +free_path (pp); +return 2 ; + } mpp = pp->mpp =find_mp_by_wwid (vecs->mpvec, pp->wwid); rescan:if (mpp) {
@@ -1299,9 +1312,15 @@ configure (struct vectors * vecs, int st*/ path_discovery (vecs->pathvec, conf,DI_ALL ); -vector_foreach_slot (vecs->pathvec, pp, i) - pp->checkint = conf->checkint; - + vector_foreach_slot (vecs->pathvec, pp, i){ +if (blacklist_path (conf, pp)){ +vector_del_slot (vecs->pathvec, i); +free_path (pp); + i--; + } +else + pp->checkint = conf->checkint; + }if (map_discovery (vecs))return 1 ;
Christophe Varoqui
AppliedQuoted 3 lines · Benjamin Marzinski
multipathd doesn't correctly blacklist devices by wwid, because the blacklist check happens before the device information is known. This patch fixes that.
Applied, thanks.