From 625b25071bb6db4d1c019d5bab0344d82d5ae4c4 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 22 Nov 2010 20:58:06 +1100 Subject: [PATCH] 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 --- Incremental.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); -- 2.47.2