diff mbox series

[3/9] diskpart: add a pause for rereading partitions

Message ID 20210428135459.951203-4-sbabic@denx.de
State Accepted
Headers show
Series Improve filesystem support | expand

Commit Message

Stefano Babic April 28, 2021, 1:54 p.m. UTC
It could be that the kernel needs some more time after rereading the
partitions to make them available for user space, so introduce a one
second delay after partitioning was finished.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 handlers/diskpart_handler.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c
index ad9ddfc..89ab151 100644
--- a/handlers/diskpart_handler.c
+++ b/handlers/diskpart_handler.c
@@ -383,6 +383,7 @@  static int diskpart(struct img_type *img,
 			ERROR("Partition table cannot be written on disk");
 		if (fdisk_reread_partition_table(cxt))
 			WARN("Table cannot be reread from the disk, be careful !");
+		sleep(2);
 	} else {
 		ret = 0;
 		TRACE("Same partition table on disk, do not touch partition table !");
@@ -433,6 +434,14 @@  handler_release:
 
 	fdisk_unref_context(cxt);
 
+	/*
+	 * Kernel rereads the partition table and add just a delay to be sure
+	 * that SWUpdate does not try to access the partitions before the kernel is
+	 * ready
+	 */
+
+	sleep(2);
+
 	return ret;
 }