]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
incr/spare: recheck allowed action for each metadata.
authorNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
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>
Incremental.c

index de7fa6f02f97abbd72fc3fc3816515db75fd5bfb..3e361d0ab60b02566c069b3a9de4a10c0da1df40 100644 (file)
@@ -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);