From: NeilBrown Date: Mon, 22 Nov 2010 09:58:06 +0000 (+1100) Subject: incr/spare: recheck allowed action for each metadata. X-Git-Tag: mdadm-3.2~268 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=625b25071bb6db4d1c019d5bab0344d82d5ae4c4;p=thirdparty%2Fmdadm.git incr/spare: recheck allowed action for each metadata. The current act_spare tests only test if it is allowed for some metadata. As we check each array or partitioning type, we need to double-check that sparing is allowed for that array or partitioning type. Signed-off-by: NeilBrown --- diff --git a/Incremental.c b/Incremental.c index de7fa6f0..3e361d0a 100644 --- a/Incremental.c +++ b/Incremental.c @@ -827,6 +827,11 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol, devname, mp->path); goto next; } + /* Need to double check the 'act_spare' permissions applies + * to this metadata. + */ + if (!policy_action_allows(pol, st2->ss->name, act_spare)) + goto next; } else st2 = st; get_dev_size(dfd, NULL, &devsize); @@ -981,6 +986,11 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol, if (domain_test(domlist, pol, st2->ss->name) == 0) /* Incompatible devices for this metadata type */ goto next; + if (!policy_action_allows(pol, st2->ss->name, act_spare)) + /* Some partition types allow sparing, but not + * this one. + */ + goto next; } st2->ss->getinfo_super(st2, &info, NULL);