[parted-devel] [PATCH 2/4] libparted: remove extraneous blkpg add partition ped exception

Jim Meyering jim at meyering.net
Wed Jan 11 18:37:01 UTC 2012


Phillip Susi wrote:
> _blkpg_add_partition was throwing an exception if it failed to add the new
> partition, in addition to _disk_sync_part_table throwing one, and then
> bailing out.  Instead of bailing out, just log the error for reporting
> later and continue.

Thanks for the patch.
Would you please at least outline a test case for this?

> ---
>  libparted/arch/linux.c |   21 +++------------------
>  1 files changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
> index 3991adb..a521652 100644
> --- a/libparted/arch/linux.c
> +++ b/libparted/arch/linux.c
> @@ -2390,18 +2390,7 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part)
>
>          if (!_blkpg_part_command (disk->dev, &linux_part,
>                                    BLKPG_ADD_PARTITION)) {
> -                return ped_exception_throw (
> -                        PED_EXCEPTION_ERROR,
> -                        PED_EXCEPTION_IGNORE_CANCEL,
> -                        _("Error informing the kernel about modifications to "
> -                          "partition %s -- %s.  This means Linux won't know "
> -                          "about any changes you made to %s until you reboot "
> -                          "-- so you shouldn't mount it or use it in any way "
> -                          "before rebooting."),
> -                        linux_part.devname,
> -                        strerror (errno),
> -                        linux_part.devname)
> -                                == PED_EXCEPTION_IGNORE;
> +                return 0;
>          }
>
>          return 1;
> @@ -2649,12 +2638,8 @@ _disk_sync_part_table (PedDisk* disk)
>
>                          /* add the (possibly modified or new) partition */
>                          if (!add_partition (disk, part)) {
> -                                ped_exception_throw (
> -                                        PED_EXCEPTION_ERROR,
> -                                        PED_EXCEPTION_RETRY_CANCEL,
> -                                        _("Failed to add partition %d (%s)"),
> -                                        i, strerror (errno));
> -                                goto cleanup;
> +                                ok[i - 1] = 0;
> +                                errnums[i - 1] = errno;
>                          }
>                  }
>          }



More information about the parted-devel mailing list