From a60d6b52179d851d1d1165a06afa778ac9868107 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 2 Jan 2018 14:48:01 +0100 Subject: sfdisk: wait before re-read The original old (v2.13) fdisk had sleep(2) beany ideafore re-read ioctl. It seems overkill, but short sleep is probably a good idea as we call re-read on sfdisk start and at the end. It's possible that sfdisk is too fast and the initial re-read is not gone yet. It would be nice to have something more elegant than sleep, any idea? Addresses: https://github.com/karelzak/util-linux/issues/557 Signed-off-by: Karel Zak --- disk-utils/sfdisk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'disk-utils') diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index d769ed8db..513a1152a 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -546,8 +546,15 @@ static int write_changes(struct sfdisk *sf) rc = move_partition_data(sf, sf->partno, sf->orig_pa); if (!rc) { fdisk_info(sf->cxt, _("\nThe partition table has been altered.")); - if (!sf->notell) + if (!sf->notell) { + /* Let's wait a little bit. It's possible that our + * system is still busy with a previous re-read + * ioctl (on sfdisk start) or with another task + * related to the write to the device. + */ + xusleep(250000); fdisk_reread_partition_table(sf->cxt); + } } } if (!rc) -- cgit v1.2.3-55-g7522