summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorMateusz Grzonka <mateusz.grzonka@intel.com>2023-11-21 01:58:24 +0100
committerJes Sorensen <jes@trained-monkey.org>2023-11-21 17:12:06 +0100
commit9f376da6439b07dc93ae084ab576e133b9d8d839 (patch)
tree78092973d6591d33af1e0a0fb03c11d8458e1793 /mdopen.c
parentMdmonitor: Improve udev event handling (diff)
downloadmdadm-9f376da6439b07dc93ae084ab576e133b9d8d839.tar.xz
mdadm-9f376da6439b07dc93ae084ab576e133b9d8d839.zip
udev: Move udev_block() and udev_unblock() into udev.c
Add kernel style comments and better error handling. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdopen.c')
-rw-r--r--mdopen.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mdopen.c b/mdopen.c
index f9b04e1c..eaa59b59 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -336,8 +336,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
devnm[0] = 0;
if (num < 0 && cname && ci->names) {
sprintf(devnm, "md_%s", cname);
- if (block_udev)
- udev_block(devnm);
+ if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS)
+ return -1;
if (!create_named_array(devnm)) {
devnm[0] = 0;
udev_unblock();
@@ -345,8 +345,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
}
if (num >= 0) {
sprintf(devnm, "md%d", num);
- if (block_udev)
- udev_block(devnm);
+ if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS)
+ return -1;
if (!create_named_array(devnm)) {
devnm[0] = 0;
udev_unblock();
@@ -369,8 +369,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
return -1;
}
}
- if (block_udev)
- udev_block(devnm);
+ if (block_udev && udev_block(devnm) != UDEV_STATUS_SUCCESS)
+ return -1;
create_named_array(devnm);
}