Accepting request 569975 from home:sparschauer:branches:Base:System
libparted: dasd: Use BLKRRPART only when needed OBS-URL: https://build.opensuse.org/request/show/569975 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=138
This commit is contained in:
parent
891b7feb03
commit
1dbfe78029
108
libparted-use-BLKRRPART-only-when-needed.patch
Normal file
108
libparted-use-BLKRRPART-only-when-needed.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From: Sebastian Parschauer <sparschauer@suse.de>
|
||||||
|
Date: Thu, 25 Jan 2018 17:06:00 +0100
|
||||||
|
Subject: libparted: dasd: Use BLKRRPART only when needed
|
||||||
|
References: bsc#1065197, bsc#1067435
|
||||||
|
Patch-mainline: no, upstream dropped proper DASD support
|
||||||
|
|
||||||
|
The BLKRRPART ioctl is required due to limitations of the DASD
|
||||||
|
disk layout. We use it always for those devices right now but when
|
||||||
|
adding or removing a partition at the end, then it is enough to use
|
||||||
|
the BLKPG* ioctls. The problem with BLKRRPART occurs when one of the
|
||||||
|
first partitions is busy. BLKRRPART touches all partitions and the
|
||||||
|
parted command fails in this case.
|
||||||
|
So detect that situation and use BLKRRPART only when needed instead.
|
||||||
|
|
||||||
|
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
||||||
|
---
|
||||||
|
include/parted/disk.in.h | 1 +
|
||||||
|
libparted/arch/linux.c | 13 +++++++------
|
||||||
|
libparted/disk.c | 15 +++++++++++++--
|
||||||
|
3 files changed, 21 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
|
||||||
|
index b42e7cf..ac57d68 100644
|
||||||
|
--- a/include/parted/disk.in.h
|
||||||
|
+++ b/include/parted/disk.in.h
|
||||||
|
@@ -195,6 +195,7 @@ struct _PedDisk {
|
||||||
|
int update_mode; /**< mode without free/metadata
|
||||||
|
partitions, for easier
|
||||||
|
update */
|
||||||
|
+ int needs_blkrrpart; /* special cases on DASDs */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _PedDiskOps {
|
||||||
|
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||||
|
index 461c095..d7d37e7 100644
|
||||||
|
--- a/libparted/arch/linux.c
|
||||||
|
+++ b/libparted/arch/linux.c
|
||||||
|
@@ -3264,14 +3264,15 @@ static int
|
||||||
|
linux_disk_commit (PedDisk* disk)
|
||||||
|
{
|
||||||
|
if (disk->dev->type != PED_DEVICE_FILE) {
|
||||||
|
- /* 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.
|
||||||
|
+ /* If adding or removing partitions not at the end, then 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)
|
||||||
|
+ if (disk->dev->type == PED_DEVICE_DASD && disk->needs_blkrrpart)
|
||||||
|
return _kernel_reread_part_table(disk->dev);
|
||||||
|
|
||||||
|
assert(_have_blkpg());
|
||||||
|
diff --git a/libparted/disk.c b/libparted/disk.c
|
||||||
|
index 18cee12..03f8548 100644
|
||||||
|
--- a/libparted/disk.c
|
||||||
|
+++ b/libparted/disk.c
|
||||||
|
@@ -406,6 +406,7 @@ _ped_disk_alloc (const PedDevice* dev, const PedDiskType* disk_type)
|
||||||
|
disk->update_mode = 1;
|
||||||
|
disk->part_list = NULL;
|
||||||
|
disk->needs_clobber = 0;
|
||||||
|
+ disk->needs_blkrrpart = 0;
|
||||||
|
return disk;
|
||||||
|
|
||||||
|
error:
|
||||||
|
@@ -1733,8 +1734,12 @@ _disk_raw_remove (PedDisk* disk, PedPartition* part)
|
||||||
|
|
||||||
|
if (part->prev) {
|
||||||
|
part->prev->next = part->next;
|
||||||
|
- if (part->next)
|
||||||
|
+ if (part->next) {
|
||||||
|
+ /* remove partition in the middle */
|
||||||
|
+ if (part->type == PED_PARTITION_NORMAL)
|
||||||
|
+ disk->needs_blkrrpart = 1;
|
||||||
|
part->next->prev = part->prev;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
if (part->type & PED_PARTITION_LOGICAL) {
|
||||||
|
ped_disk_extended_partition (disk)->part_list
|
||||||
|
@@ -1742,8 +1747,12 @@ _disk_raw_remove (PedDisk* disk, PedPartition* part)
|
||||||
|
} else {
|
||||||
|
disk->part_list = part->next;
|
||||||
|
}
|
||||||
|
- if (part->next)
|
||||||
|
+ if (part->next) {
|
||||||
|
+ /* remove first partition */
|
||||||
|
+ if (part->type == PED_PARTITION_NORMAL)
|
||||||
|
+ disk->needs_blkrrpart = 1;
|
||||||
|
part->next->prev = NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
@@ -1773,6 +1782,8 @@ _disk_raw_add (PedDisk* disk, PedPartition* part)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (walk) {
|
||||||
|
+ if (part->type == PED_PARTITION_NORMAL)
|
||||||
|
+ disk->needs_blkrrpart = 1;
|
||||||
|
return _disk_raw_insert_before (disk, walk, part);
|
||||||
|
} else {
|
||||||
|
if (last) {
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 26 15:22:20 UTC 2018 - sparschauer@suse.de
|
||||||
|
|
||||||
|
- libparted: dasd: Use BLKRRPART only when needed (bsc#1065197,
|
||||||
|
bsc#1067435)
|
||||||
|
- add: libparted-use-BLKRRPART-only-when-needed.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Dec 22 17:23:25 CET 2017 - sparschauer@suse.de
|
Fri Dec 22 17:23:25 CET 2017 - sparschauer@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package parted
|
# spec file for package parted
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -85,6 +85,7 @@ Patch56: libparted-fix-NVDIMM-partition-naming.patch
|
|||||||
Patch57: parted-escape-printed-device-path.patch
|
Patch57: parted-escape-printed-device-path.patch
|
||||||
Patch58: parted-add-ignore-busy-option.patch
|
Patch58: parted-add-ignore-busy-option.patch
|
||||||
Patch59: parted-fix-resizepart-and-rm-command.patch
|
Patch59: parted-fix-resizepart-and-rm-command.patch
|
||||||
|
Patch60: libparted-use-BLKRRPART-only-when-needed.patch
|
||||||
# Fatresize
|
# Fatresize
|
||||||
Patch100: parted-fatresize-autoconf.patch
|
Patch100: parted-fatresize-autoconf.patch
|
||||||
Patch101: fatresize-fix-getting-dev-name.patch
|
Patch101: fatresize-fix-getting-dev-name.patch
|
||||||
@ -194,6 +195,7 @@ to develop applications that require these.
|
|||||||
%patch57 -p1
|
%patch57 -p1
|
||||||
%patch58 -p1
|
%patch58 -p1
|
||||||
%patch59 -p1
|
%patch59 -p1
|
||||||
|
%patch60 -p1
|
||||||
%patch100 -p1
|
%patch100 -p1
|
||||||
%patch101 -p1
|
%patch101 -p1
|
||||||
%patch150 -p1
|
%patch150 -p1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user