[parted-devel] [PATCH] Don't fail if unable to reread partition table
Jim Meyering
jim at meyering.net
Wed Aug 6 12:50:58 UTC 2008
Soren Hansen <soren at ubuntu.com> wrote:
> I used to use parted 1.7.7 as this was what was shipped by Ubuntu and
> Debian up until very recently. I used parted to add a partition table to
> disk images that I'd be using for virtual machines.
> When parted was updated to 1.8.8, this stopped working, since parted
> fails if telling the kernel to reread the partition table for the device
> in question fails. However, for disk images this makes little sense.
>
> This patch makes libparted consider (ioctl(fd, BLKRRPART) || errno
> == EINVAL) succesful.
>
> Signed-off-by: Soren Hansen <soren at canonical.com>
>
> diff -urNad parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c parted-1.8.8.git.2008.03.24/libparted/arch/linux.c
> --- parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c 2008-08-05 17:02:18.151661314 +0200
> +++ parted-1.8.8.git.2008.03.24/libparted/arch/linux.c 2008-08-05 17:02:47.096662006 +0200
> @@ -2454,7 +2467,7 @@
> int retry_count = 5;
>
> sync();
> - while (ioctl (arch_specific->fd, BLKRRPART)) {
> + while (ioctl (arch_specific->fd, BLKRRPART) || errno == EINVAL) {
> retry_count--;
> sync();
> if (!retry_count) {
Thanks!
This looks like a fine change.
Do you feel like adding a test to demonstrate the failure and fix?
If it requires running losetup, you can model the script after
parts of tests/t6000-dm.sh.
Otherwise, just list the few commands required to demonstrate
the failure and I'll write the script.
More information about the parted-devel
mailing list