From f87ff28d1aa8eff085e737ab22d031b0519e5510 Mon Sep 17 00:00:00 2001 From: Phillip Susi Date: Sun, 14 Oct 2012 23:59:59 -0400 Subject: [PATCH 46/89] libparted: remove extraneous blkpg add partition ped exception _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. --- libparted/arch/linux.c | 21 +++------------------ tests/t2310-dos-extended-2-sector-min-offset.sh | 3 +-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index 70b26a9..5721d4b 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -2407,18 +2407,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; @@ -2790,12 +2779,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; } } } diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh index 89453ae..17c777c 100644 --- a/tests/t2310-dos-extended-2-sector-min-offset.sh +++ b/tests/t2310-dos-extended-2-sector-min-offset.sh @@ -39,8 +39,7 @@ $scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:; EOF cat < err.exp || framework_failure -Error: Error informing the kernel about modifications to partition $p5 -- Device or resource busy. This means Linux won't know about any changes you made to $p5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting. -Error: Failed to add partition 5 (Device or resource busy) +Error: Partition(s) 5 on $scsi_dev have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. EOF # Create a DOS label with an extended partition starting at sector 64. -- 1.8.5.3