dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0098-Create.c-close-mdfd-and-generate-uevent.patch

3c4af5
From ce559078a5650afb9f635204b31a89a1fa0061e3 Mon Sep 17 00:00:00 2001
3c4af5
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
3c4af5
Date: Tue, 24 Nov 2020 13:39:49 +0100
3c4af5
Subject: [PATCH 098/108] Create.c: close mdfd and generate uevent
3c4af5
3c4af5
During mdfd closing change event is not generated because open() is
3c4af5
called before start watching mddevice by udev.
3c4af5
Device is ready at this stage. Unblock device, close fd and
3c4af5
generate event to give a chance next layers to work.
3c4af5
3c4af5
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
3c4af5
---
3c4af5
 Create.c | 7 ++-----
3c4af5
 1 file changed, 2 insertions(+), 5 deletions(-)
3c4af5
3c4af5
diff --git a/Create.c b/Create.c
3c4af5
index 0efa19c..51f8826 100644
3c4af5
--- a/Create.c
3c4af5
+++ b/Create.c
3c4af5
@@ -1083,12 +1083,9 @@ int Create(struct supertype *st, char *mddev,
3c4af5
 	} else {
3c4af5
 		pr_err("not starting array - not enough devices.\n");
3c4af5
 	}
3c4af5
-	close(mdfd);
3c4af5
-	/* Give udev a moment to process the Change event caused
3c4af5
-	 * by the close.
3c4af5
-	 */
3c4af5
-	usleep(100*1000);
3c4af5
 	udev_unblock();
3c4af5
+	close(mdfd);
3c4af5
+	sysfs_uevent(&info, "change");
3c4af5
 	return 0;
3c4af5
 
3c4af5
  abort:
3c4af5
-- 
3c4af5
2.7.5
3c4af5