diff options
author | Karel Zak | 2018-06-11 12:21:56 +0200 |
---|---|---|
committer | Karel Zak | 2018-06-11 12:36:32 +0200 |
commit | 921f63433ee62894908f7f8c0a622057478e6fa1 (patch) | |
tree | 28e12cb313d197340a3e1bb63143d6a9c190eeb7 /libmount/src | |
parent | zramctl: (man) explain that --find is necessary (diff) | |
download | kernel-qcow2-util-linux-921f63433ee62894908f7f8c0a622057478e6fa1.tar.gz kernel-qcow2-util-linux-921f63433ee62894908f7f8c0a622057478e6fa1.tar.xz kernel-qcow2-util-linux-921f63433ee62894908f7f8c0a622057478e6fa1.zip |
wipefs: postpone BLKRRPART until all is done
It's possible we erase from the whole device before we erase from the
partition on the same disk:
# wipefs -a /dev/sdc /dev/sdc1
the current code calls re-read PT ioctl immediately after erase (so,
before sdc1 is processed). The result is that sdc1 node is no more
accessible:
# wipefs -a /dev/sdc /dev/sdc1
/dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdc: calling ioctl to re-read partition table: Success
wipefs: error: /dev/sdc1: probing initialization failed: No such file or directory
It seems the most simple solution is to postpone the re-read ioctl and
do it as the last thing.
# wipefs -a /dev/sdc /dev/sdc1
/dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdc1: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
/dev/sdc: calling ioctl to re-read partition table: Success
The patch also adds a small delay before the re-read ioctl call. It's
not elegant, but without the usleep(25000) the first attempt returns
EBUSY.
Addresses: https://github.com/karelzak/util-linux/issues/598
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
0 files changed, 0 insertions, 0 deletions