Accepting request 417986 from home:sparschauer:branches:Base:System
Sync with SLES-12 SP2 for bsc#989751 and bsc#979275 OBS-URL: https://build.opensuse.org/request/show/417986 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=123
This commit is contained in:
parent
c3afce22ec
commit
01fe17fce4
@ -50,8 +50,8 @@ Index: parted-3.2/libparted/arch/linux.c
|
|||||||
|
|
||||||
#define SCSI_BLK_MAJOR(M) ( \
|
#define SCSI_BLK_MAJOR(M) ( \
|
||||||
(M) == SCSI_DISK0_MAJOR \
|
(M) == SCSI_DISK0_MAJOR \
|
||||||
@@ -463,6 +464,12 @@ _ensure_read_write (PedDevice *dev)
|
@@ -461,6 +462,12 @@ _ensure_read_write (PedDevice *dev)
|
||||||
_flush_cache (dev);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+static int
|
+static int
|
||||||
@ -63,7 +63,7 @@ Index: parted-3.2/libparted/arch/linux.c
|
|||||||
#ifdef ENABLE_DEVICE_MAPPER
|
#ifdef ENABLE_DEVICE_MAPPER
|
||||||
static int
|
static int
|
||||||
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
||||||
@@ -714,6 +721,8 @@ _device_probe_type (PedDevice* dev)
|
@@ -712,6 +719,8 @@ _device_probe_type (PedDevice* dev)
|
||||||
dev->type = PED_DEVICE_LOOP;
|
dev->type = PED_DEVICE_LOOP;
|
||||||
} else if (dev_major == MD_MAJOR) {
|
} else if (dev_major == MD_MAJOR) {
|
||||||
dev->type = PED_DEVICE_MD;
|
dev->type = PED_DEVICE_MD;
|
||||||
@ -72,7 +72,7 @@ Index: parted-3.2/libparted/arch/linux.c
|
|||||||
} else {
|
} else {
|
||||||
dev->type = PED_DEVICE_UNKNOWN;
|
dev->type = PED_DEVICE_UNKNOWN;
|
||||||
}
|
}
|
||||||
@@ -1473,6 +1482,11 @@ linux_new (const char* path)
|
@@ -1471,6 +1480,11 @@ linux_new (const char* path)
|
||||||
goto error_free_arch_specific;
|
goto error_free_arch_specific;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4,6 +4,11 @@ Date: Thu, 26 May 2016 09:28:21 +0200
|
|||||||
Subject: [PATCH] libparted: open the device RO and lazily switch to RW only if
|
Subject: [PATCH] libparted: open the device RO and lazily switch to RW only if
|
||||||
necessary
|
necessary
|
||||||
|
|
||||||
|
[sparschauer: Use _flush_cache() also for reads, don't switch to RW
|
||||||
|
in _flush_cache() to avoid a possible recursion (bnc#989751), open
|
||||||
|
partitions in _flush_cache() O_RDONLY instead of O_WRONLY]
|
||||||
|
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
||||||
|
|
||||||
Avoid useless udev events triggered by opening the device RW
|
Avoid useless udev events triggered by opening the device RW
|
||||||
for purely read-only operations.
|
for purely read-only operations.
|
||||||
|
|
||||||
@ -14,11 +19,11 @@ Author: Michael Matz <matz@suse.de>
|
|||||||
libparted/arch/linux.h | 1 +
|
libparted/arch/linux.h | 1 +
|
||||||
2 files changed, 31 insertions(+), 3 deletions(-)
|
2 files changed, 31 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
Index: parted-3.2/libparted/arch/linux.c
|
||||||
index 326b956..0a50452 100644
|
===================================================================
|
||||||
--- a/libparted/arch/linux.c
|
--- parted-3.2.orig/libparted/arch/linux.c
|
||||||
+++ b/libparted/arch/linux.c
|
+++ parted-3.2/libparted/arch/linux.c
|
||||||
@@ -294,6 +294,9 @@ static unsigned int _device_get_partition_range(PedDevice const* dev);
|
@@ -295,6 +295,9 @@ static unsigned int _device_get_partitio
|
||||||
static int _device_open (PedDevice* dev, int flags);
|
static int _device_open (PedDevice* dev, int flags);
|
||||||
static int _device_open_ro (PedDevice* dev);
|
static int _device_open_ro (PedDevice* dev);
|
||||||
static int _device_close (PedDevice* dev);
|
static int _device_close (PedDevice* dev);
|
||||||
@ -28,7 +33,7 @@ index 326b956..0a50452 100644
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
_read_fd (int fd, char **buf)
|
_read_fd (int fd, char **buf)
|
||||||
@@ -441,6 +444,24 @@ _is_virtblk_major (int major)
|
@@ -442,6 +445,22 @@ _is_virtblk_major (int major)
|
||||||
return _major_type_in_devices (major, "virtblk");
|
return _major_type_in_devices (major, "virtblk");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,22 +51,21 @@ index 326b956..0a50452 100644
|
|||||||
+
|
+
|
||||||
+ if (!_device_open (dev, RW_MODE))
|
+ if (!_device_open (dev, RW_MODE))
|
||||||
+ return;
|
+ return;
|
||||||
+
|
|
||||||
+ _flush_cache (dev);
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
#ifdef ENABLE_DEVICE_MAPPER
|
#ifdef ENABLE_DEVICE_MAPPER
|
||||||
static int
|
static int
|
||||||
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
||||||
@@ -1604,6 +1625,7 @@ _flush_cache (PedDevice* dev)
|
@@ -1603,7 +1622,7 @@ _flush_cache (PedDevice* dev)
|
||||||
|
if (!name)
|
||||||
if (dev->read_only)
|
break;
|
||||||
return;
|
if (!_partition_is_mounted_by_path (name)) {
|
||||||
+ _ensure_read_write (dev);
|
- fd = open (name, WR_MODE, 0);
|
||||||
dev->dirty = 0;
|
+ fd = open (name, RD_MODE, 0);
|
||||||
|
if (fd > 0) {
|
||||||
ioctl (arch_specific->fd, BLKFLSBUF);
|
ioctl (fd, BLKFLSBUF);
|
||||||
@@ -1647,7 +1669,7 @@ _device_open_ro (PedDevice* dev)
|
retry:
|
||||||
|
@@ -1634,7 +1653,7 @@ _device_open_ro (PedDevice* dev)
|
||||||
static int
|
static int
|
||||||
linux_open (PedDevice* dev)
|
linux_open (PedDevice* dev)
|
||||||
{
|
{
|
||||||
@ -70,7 +74,7 @@ index 326b956..0a50452 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1685,10 +1707,12 @@ retry:
|
@@ -1672,6 +1691,10 @@ retry:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev->read_only = 0;
|
dev->read_only = 0;
|
||||||
@ -80,12 +84,8 @@ index 326b956..0a50452 100644
|
|||||||
+ arch_specific->rw = 0;
|
+ arch_specific->rw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- _flush_cache (dev);
|
_flush_cache (dev);
|
||||||
-
|
@@ -1907,6 +1930,7 @@ _write_lastoddsector (PedDevice* dev, co
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1920,6 +1944,7 @@ _write_lastoddsector (PedDevice* dev, const void* buffer)
|
|
||||||
|
|
||||||
PED_ASSERT(dev != NULL);
|
PED_ASSERT(dev != NULL);
|
||||||
PED_ASSERT(buffer != NULL);
|
PED_ASSERT(buffer != NULL);
|
||||||
@ -93,15 +93,17 @@ index 326b956..0a50452 100644
|
|||||||
|
|
||||||
arch_specific = LINUX_SPECIFIC (dev);
|
arch_specific = LINUX_SPECIFIC (dev);
|
||||||
|
|
||||||
@@ -1968,6 +1993,7 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
|
@@ -1955,6 +1979,9 @@ linux_write (PedDevice* dev, const void*
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ _ensure_read_write (dev);
|
+ _ensure_read_write (dev);
|
||||||
|
+ if (count == 0)
|
||||||
|
+ return 1; /* We just ensured the device is open RW (see call from dasd_write()) */
|
||||||
if (_get_linux_version() < KERNEL_VERSION (2,6,0)) {
|
if (_get_linux_version() < KERNEL_VERSION (2,6,0)) {
|
||||||
/* Kludge. This is necessary to read/write the last
|
/* Kludge. This is necessary to read/write the last
|
||||||
block of an odd-sized disk, until Linux 2.5.x kernel fixes.
|
block of an odd-sized disk, until Linux 2.5.x kernel fixes.
|
||||||
@@ -2497,6 +2523,7 @@ _blkpg_part_command (PedDevice* dev, struct blkpg_partition* part, int op)
|
@@ -2480,6 +2507,7 @@ _blkpg_part_command (PedDevice* dev, str
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
||||||
struct blkpg_ioctl_arg ioctl_arg;
|
struct blkpg_ioctl_arg ioctl_arg;
|
||||||
|
|
||||||
@ -109,10 +111,10 @@ index 326b956..0a50452 100644
|
|||||||
ioctl_arg.op = op;
|
ioctl_arg.op = op;
|
||||||
ioctl_arg.flags = 0;
|
ioctl_arg.flags = 0;
|
||||||
ioctl_arg.datalen = sizeof (struct blkpg_partition);
|
ioctl_arg.datalen = sizeof (struct blkpg_partition);
|
||||||
diff --git a/libparted/arch/linux.h b/libparted/arch/linux.h
|
Index: parted-3.2/libparted/arch/linux.h
|
||||||
index 95def1f..926f7e2 100644
|
===================================================================
|
||||||
--- a/libparted/arch/linux.h
|
--- parted-3.2.orig/libparted/arch/linux.h
|
||||||
+++ b/libparted/arch/linux.h
|
+++ parted-3.2/libparted/arch/linux.h
|
||||||
@@ -30,6 +30,7 @@ struct _LinuxSpecific {
|
@@ -30,6 +30,7 @@ struct _LinuxSpecific {
|
||||||
int fd;
|
int fd;
|
||||||
int major;
|
int major;
|
||||||
@ -121,6 +123,18 @@ index 95def1f..926f7e2 100644
|
|||||||
char* dmtype; /**< device map target type */
|
char* dmtype; /**< device map target type */
|
||||||
#if defined __s390__ || defined __s390x__
|
#if defined __s390__ || defined __s390x__
|
||||||
unsigned int real_sector_size;
|
unsigned int real_sector_size;
|
||||||
--
|
Index: parted-3.2/libparted/labels/dasd.c
|
||||||
1.8.4.5
|
===================================================================
|
||||||
|
--- parted-3.2.orig/libparted/labels/dasd.c
|
||||||
|
+++ parted-3.2/libparted/labels/dasd.c
|
||||||
|
@@ -639,6 +639,10 @@ dasd_write (const PedDisk* disk)
|
||||||
|
if (disk_specific->format_type == 1)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
+ /* Ensure the device is open RW */
|
||||||
|
+ char dummy[10]; /* to avoid assertion in ped_device_write */
|
||||||
|
+ ped_device_write(disk->dev, &dummy, 0, 0);
|
||||||
|
+
|
||||||
|
/* initialize the anchor */
|
||||||
|
fdasd_initialize_anchor(&anchor);
|
||||||
|
fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd);
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Aug 9 14:36:20 CEST 2016 - sparschauer@suse.de
|
||||||
|
|
||||||
|
- Sync with SLES-12 SP2 for bsc#979275
|
||||||
|
- amend: libparted-open-the-device-RO-and-lazily-switch-to-RW.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Aug 9 14:04:47 CEST 2016 - sparschauer@suse.de
|
||||||
|
|
||||||
|
- Correctly flush caches before reading from the device
|
||||||
|
(bsc#989751)
|
||||||
|
- amend: libparted-open-the-device-RO-and-lazily-switch-to-RW.patch
|
||||||
|
- refresh: libparted-Add-support-for-NVMe-devices.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jun 18 07:08:01 UTC 2016 - jengelh@inai.de
|
Sat Jun 18 07:08:01 UTC 2016 - jengelh@inai.de
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user