parted/libparted-use-BLKRRPART-for-DASD.patch.patch
Petr Uzel 5a2cd49a44 Accepting request 303792 from home:puzel:branches:Base:System
- Update to parted-3.2; Notable changes:
  - Added new partition type flag, esp, to set the type to 0xEF on
    MS-DOS.  Also aliased to boot on GPT to set the UEFI ESP GUID.
  - You can now choose to ignore errors about partitions that
    overlap, or are longer than the disk.  This allows you to use
    parted to repair the problem.
  - When attempting to manipulate a mounted partition, parted now
    issues a warning that you can choose to ignore, instead of an
    error.
  - When creating a loop label, it automatically comes with a
    partition using the whole disk.
  - parted -l no longer lists device-mapper devices other than
    dmraid whole disks.
  - Added new Linux-specific partition GUID type code
    (0FC63DAF-8483-4772-8E79-3D69D8477DE4) for Linux filesystem
    data on GPT disks.  This type code is now assigned as the
    default partition type code for new partitions holding Linux
    filesystems.
  - Added new "msftdata" flag to identify partitions holding NTFS
    or FAT filesystems on GPT disks.  This flag corresponds to a
    GPT type code of EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
    ("Microsoft Basic Data").  Since Linux filesystem partitions
    formerly used this type code, this flag may optionally be set
    on Linux partitions to make the partition table type codes
    match former configurations in case the new Linux filesystem
    type code causes problems with some utility.  Note that this
    flag cannot be removed from NTFS or FAT partitions within
    parted except by setting a competing flag, such as "boot"
    (which sets the type code used by EFI System partitions) or
    "msftres" (which sets the "Microsoft Reserved" type code).

OBS-URL: https://build.opensuse.org/request/show/303792
OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=109
2015-04-24 15:49:30 +00:00

83 lines
2.9 KiB
Diff

From ac422c32ae3be0e599f7b3f4ab6961b61129c4ba Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Fri, 14 Feb 2014 09:12:47 +0100
Subject: [PATCH] libparted-used-BLKRRPART-for-DASD.patch
Addresses: bnc#862139
This reverts upstream commit 9fa0e1800db5b9f094ae481fd95a51da03f19e95.
This reverts upstream commit 1223b9fc07859cb619c80dc057bd05458f9b5669.
and some fixups on top
---
libparted/arch/linux.c | 50 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 41 insertions(+), 9 deletions(-)
Index: parted-3.2/libparted/arch/linux.c
===================================================================
--- parted-3.2.orig/libparted/arch/linux.c
+++ parted-3.2/libparted/arch/linux.c
@@ -3097,6 +3097,34 @@ _disk_sync_part_table (PedDisk* disk)
}
static int
+_kernel_reread_part_table (PedDevice* dev)
+{
+ LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
+ int retry_count = 9;
+
+ sync();
+ while (ioctl (arch_specific->fd, BLKRRPART)) {
+ retry_count--;
+ sync();
+ if (retry_count == 3)
+ sleep(1); /* Pause to allow system to settle */
+
+ if (!retry_count) {
+ ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_IGNORE,
+ _("WARNING: the kernel failed to re-read the partition "
+ "table on %s (%s). As a result, it may not "
+ "reflect all of your changes until after reboot."),
+ dev->path, strerror (errno));
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int
_have_blkpg ()
{
static int have_blkpg = -1;
@@ -3114,15 +3142,19 @@ static int
linux_disk_commit (PedDisk* disk)
{
if (disk->dev->type != PED_DEVICE_FILE) {
-
- /* We now require BLKPG support. If this assertion fails,
- please write to the mailing list describing your system.
- Assuming it's never triggered, ...
- FIXME: remove this assertion in 2012. */
- assert (_have_blkpg ());
-
- if (!_disk_sync_part_table (disk))
- return 0;
+ /* The ioctl() command BLKPG_ADD_PARTITION does not notify
+ * the devfs system; consequently, /proc/partitions will not
+ * be up to date, and the proper links in /dev are not
+ * created. Therefore, if using DevFS, we must get the kernel
+ * to re-read and grok the partition table.
+ */
+ /* Work around kernel dasd problem so we really do BLKRRPART */
+ if (disk->dev->type == PED_DEVICE_DASD)
+ return _kernel_reread_part_table(disk->dev);
+
+ assert(_have_blkpg());
+ if (!_disk_sync_part_table(disk))
+ return 0;
}
return 1;