summaryrefslogtreecommitdiff
path: root/Manage.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2021-05-17 16:39:03 +0200
committerJes Sorensen <jsorensen@fb.com>2021-05-26 07:26:34 -0400
commit1f5d54a06df01ca3032ca2d29159584cab7d7509 (patch)
tree9c08f26bce615f9fedfc4becf9e14394756afe67 /Manage.c
parent8662f92d71f1f88589061272606b8b673d31de05 (diff)
downloadmdadm-1f5d54a06df01ca3032ca2d29159584cab7d7509.tar.gz
Manage: Call validate_geometry when adding drive to external container
When adding drive to container call validate_geometry to verify whether drive is supported and can be addded to container. Remove unused parameters from validate_geometry_imsm_container(). There is no need to pass them. Don't calculate freesize if it is not mandatory. Make it configurable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Manage.c b/Manage.c
index 0a5f09b..f789e0c 100644
--- a/Manage.c
+++ b/Manage.c
@@ -992,6 +992,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
return -1;
}
+ /* Check if metadata handler is able to accept the drive */
+ if (!tst->ss->validate_geometry(tst, LEVEL_CONTAINER, 0, 1, NULL,
+ 0, 0, dv->devname, NULL, 0, 1)) {
+ close(container_fd);
+ return -1;
+ }
+
Kill(dv->devname, NULL, 0, -1, 0);
dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
if (tst->ss->add_to_super(tst, &disc, dfd,