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

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