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 /misc-utils/wipefs.8 | |
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 'misc-utils/wipefs.8')
-rw-r--r-- | misc-utils/wipefs.8 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/misc-utils/wipefs.8 b/misc-utils/wipefs.8 index c26b7890f..3874e1a7f 100644 --- a/misc-utils/wipefs.8 +++ b/misc-utils/wipefs.8 @@ -38,7 +38,8 @@ in environments where a stable output is required. .B wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature -to inform the kernel about the change. +to inform the kernel about the change. The ioctl is called as the last step +and when all specified signatures from all specified devices are already erased. Note that some filesystems and some partition tables store more magic strings on the device (e.g. FAT, ZFS, GPT). The |