diff options
author | NeilBrown <neilb@suse.de> | 2010-11-22 10:58:06 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-11-22 10:58:06 +0100 |
commit | 625b25071bb6db4d1c019d5bab0344d82d5ae4c4 (patch) | |
tree | 450e148e56b5dced5467e54a192ade9cfffbd9e5 /Incremental.c | |
parent | Incr/spare: make sure failure to identify metadata if handled gracefully. (diff) | |
download | mdadm-625b25071bb6db4d1c019d5bab0344d82d5ae4c4.tar.xz mdadm-625b25071bb6db4d1c019d5bab0344d82d5ae4c4.zip |
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 <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | Incremental.c | 10 |
1 files changed, 10 insertions, 0 deletions
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); |