From 9db2ab4e9b1ad79b9364b6e03bdd675716a688a5 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 3 May 2017 14:25:57 -0400 Subject: util: md_array_valid(): Introduce md_array_valid() helper Using md_get_array_info() to determine if an array is valid is broken during creation, since the ioctl() returns -ENODEV if the device is valid but not active. Where did I leave my stash of brown paper bags? Fixes: ("40b054e mdopen/open_mddev: Use md_get_array_info() to determine valid array") Signed-off-by: Jes Sorensen --- mdopen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mdopen.c') diff --git a/mdopen.c b/mdopen.c index 099efa0a..c4f1c12c 100644 --- a/mdopen.c +++ b/mdopen.c @@ -442,7 +442,6 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, */ int open_mddev(char *dev, int report_errors) { - struct mdu_array_info_s array; int mdfd = open(dev, O_RDONLY); if (mdfd < 0) { @@ -452,7 +451,7 @@ int open_mddev(char *dev, int report_errors) return -1; } - if (md_get_array_info(mdfd, &array) != 0) { + if (md_array_valid(mdfd) == 0) { close(mdfd); if (report_errors) pr_err("%s does not appear to be an md device\n", dev); -- cgit v1.2.3