diff options
author | Karel Zak | 2018-01-02 14:48:01 +0100 |
---|---|---|
committer | Karel Zak | 2018-01-02 14:48:01 +0100 |
commit | a60d6b52179d851d1d1165a06afa778ac9868107 (patch) | |
tree | d38e152d3781818f201aa527b9f9681c8abffe4e | |
parent | Merge branch 'patch-1' of https://github.com/kenyon/util-linux (diff) | |
download | kernel-qcow2-util-linux-a60d6b52179d851d1d1165a06afa778ac9868107.tar.gz kernel-qcow2-util-linux-a60d6b52179d851d1d1165a06afa778ac9868107.tar.xz kernel-qcow2-util-linux-a60d6b52179d851d1d1165a06afa778ac9868107.zip |
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 <kzak@redhat.com>
-rw-r--r-- | disk-utils/sfdisk.c | 9 |
1 files changed, 8 insertions, 1 deletions
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) |