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

Phillip Susi psusi at ubuntu.com
Mon Oct 15 03:59:59 UTC 2012


_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 496e1c5..f0eb4aa 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2411,18 +2411,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;
@@ -2792,12 +2781,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..a09ef53 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 <<EOF > 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 /dev/sde 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.7.10.4




More information about the parted-devel mailing list