- Update manpage NAME so whatis will work (bcl)
- libparted: device mapper uses 512b sectors (bcl) - tests: Add a test for device-mapper partition sizes (bcl) - parted: don't crash in disk_set when disk label not found (psusi)
This commit is contained in:
parent
00c01769a8
commit
42e67f88fc
@ -0,0 +1,43 @@
|
||||
From 624a8b14af7d358782ecc12627c84da72c28aeff Mon Sep 17 00:00:00 2001
|
||||
From: Phillip Susi <psusi@ubuntu.com>
|
||||
Date: Tue, 13 Jan 2015 11:05:48 -0500
|
||||
Subject: [PATCH 08/11] parted: don't crash in disk_set when disk label not
|
||||
found
|
||||
|
||||
Due to a typeo in commit 7eac058 "parted: don't reload partition
|
||||
table on every command", the disk_set command would crash if
|
||||
a disk label was not found.
|
||||
---
|
||||
NEWS | 2 ++
|
||||
parted/parted.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index da7db50..10c9a6e 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*-
|
||||
|
||||
** Bug Fixes
|
||||
|
||||
+ Don't crash in the disk_set command when a disk label is not found
|
||||
+
|
||||
libparted-fs-resize: Prevent crash resizing FAT16 file systems.
|
||||
|
||||
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index f27a035..2678554 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -1684,7 +1684,7 @@ do_disk_set (PedDevice** dev, PedDisk** diskp)
|
||||
|
||||
if (!*diskp)
|
||||
*diskp = ped_disk_new (*dev);
|
||||
- if (!diskp)
|
||||
+ if (!*diskp)
|
||||
goto error;
|
||||
|
||||
if (!command_line_get_disk_flag (_("Flag to Invert?"), *diskp, &flag))
|
||||
--
|
||||
2.1.0
|
||||
|
103
0009-tests-Add-a-test-for-device-mapper-partition-sizes.patch
Normal file
103
0009-tests-Add-a-test-for-device-mapper-partition-sizes.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 8ab27474806687a2af7efb008b80b33615e6eb1d Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 4 Feb 2015 16:31:00 -0800
|
||||
Subject: [PATCH 09/11] tests: Add a test for device-mapper partition sizes
|
||||
|
||||
device-mapper uses 512b sector units, not device specific sector sizes.
|
||||
This test ensures that the correct partition size is created, no matter
|
||||
what the device's sector size is.
|
||||
---
|
||||
tests/Makefile.am | 1 +
|
||||
tests/t6006-dm-512b-sectors.sh | 68 ++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 69 insertions(+)
|
||||
create mode 100644 tests/t6006-dm-512b-sectors.sh
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index b726366..ce8391d 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -69,6 +69,7 @@ TESTS = \
|
||||
t6003-dm-hide.sh \
|
||||
t6004-dm-many-partitions.sh \
|
||||
t6005-dm-uuid.sh \
|
||||
+ t6006-dm-512b-sectors.sh \
|
||||
t6100-mdraid-partitions.sh \
|
||||
t7000-scripting.sh \
|
||||
t8000-loop.sh \
|
||||
diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh
|
||||
new file mode 100644
|
||||
index 0000000..31abba9
|
||||
--- /dev/null
|
||||
+++ b/tests/t6006-dm-512b-sectors.sh
|
||||
@@ -0,0 +1,68 @@
|
||||
+#!/bin/sh
|
||||
+# device-mapper sector sizes are 512b, make sure partitions are the correct
|
||||
+# size when using larger sector sizes and a linear dm table.
|
||||
+
|
||||
+# Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
||||
+
|
||||
+require_root_
|
||||
+require_scsi_debug_module_
|
||||
+
|
||||
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
|
||||
+ skip_ 'this system lacks a new-enough libblkid'
|
||||
+
|
||||
+(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
|
||||
+
|
||||
+# Device maps names - should be random to not conflict with existing ones on
|
||||
+# the system
|
||||
+linear_=plinear-$$test
|
||||
+
|
||||
+cleanup_fn_() {
|
||||
+ i=0
|
||||
+ udevadm settle
|
||||
+ while [ $i -lt 10 ] ; do
|
||||
+ [ -e "/dev/mapper/${linear_}1" ] && dmsetup remove ${linear_}1
|
||||
+ sleep .2
|
||||
+ [ -e "/dev/mapper/$linear_" ] && dmsetup remove $linear_
|
||||
+ sleep .2
|
||||
+ [ -e "/dev/mapper/${linear_}1" -o -e "/dev/mapper/$linear_" ] || i=10
|
||||
+ i=$((i + 1))
|
||||
+ done
|
||||
+ udevadm settle
|
||||
+}
|
||||
+
|
||||
+# Create a 500M device
|
||||
+ss=$sector_size_
|
||||
+scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name ||
|
||||
+ skip_ 'failed to create scsi_debug device'
|
||||
+scsi_dev=$(cat dev-name)
|
||||
+
|
||||
+# Size of device, in 512b units
|
||||
+scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure
|
||||
+
|
||||
+dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure
|
||||
+dev="/dev/mapper/$linear_"
|
||||
+
|
||||
+# Create msdos partition table with a partition from 1MiB to 100MiB
|
||||
+parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1
|
||||
+compare /dev/null out || fail=1
|
||||
+
|
||||
+# The size of the partition should be 100MiB, or 204800 512b sectors
|
||||
+p1_size=$(blockdev --getsz ${dev}1) || framework_failure
|
||||
+[ $p1_size == 204800 ] || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.1.0
|
||||
|
93
0010-libparted-device-mapper-uses-512b-sectors.patch
Normal file
93
0010-libparted-device-mapper-uses-512b-sectors.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From f98f791e19669b900345dad7d96ea4df974e4596 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 4 Feb 2015 16:46:07 -0800
|
||||
Subject: [PATCH 10/11] libparted: device mapper uses 512b sectors
|
||||
|
||||
device mapper doesn't use the device's sector size when creating a
|
||||
table. It always uses 512b units. This causes partitions to be created
|
||||
8x smaller than expected on devices with 4906b sectors.
|
||||
---
|
||||
NEWS | 4 ++++
|
||||
libparted/arch/linux.c | 21 +++++++++++++++++----
|
||||
2 files changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 10c9a6e..96135ed 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -4,6 +4,10 @@ GNU parted NEWS -*- outline -*-
|
||||
|
||||
** Bug Fixes
|
||||
|
||||
+ Use 512b sector size when communicating with device-mapper. Fixes
|
||||
+ problems with partitions being created too small on dm devices
|
||||
+ with sector sizes > 5121b
|
||||
+
|
||||
Don't crash in the disk_set command when a disk label is not found
|
||||
|
||||
libparted-fs-resize: Prevent crash resizing FAT16 file systems.
|
||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
||||
index 0f18904..90ab21d 100644
|
||||
--- a/libparted/arch/linux.c
|
||||
+++ b/libparted/arch/linux.c
|
||||
@@ -2763,6 +2763,12 @@ _dm_get_partition_start_and_length(PedPartition const *part,
|
||||
if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3)
|
||||
goto err;
|
||||
rc = 1;
|
||||
+
|
||||
+ /* device-mapper uses 512b units, make sure we return length and start in terms of the device's
|
||||
+ * sector size.
|
||||
+ */
|
||||
+ *start /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT);
|
||||
+ *length /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT);
|
||||
err:
|
||||
free (path);
|
||||
dm_task_destroy(task);
|
||||
@@ -2810,8 +2816,10 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
|
||||
/* Caution: dm_task_destroy frees dev_name. */
|
||||
dm_task_destroy (task);
|
||||
task = NULL;
|
||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
||||
if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
|
||||
- arch_specific->minor, part->geom.start)))
|
||||
+ arch_specific->minor,
|
||||
+ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT))))
|
||||
goto err;
|
||||
|
||||
task = dm_task_create (DM_DEVICE_CREATE);
|
||||
@@ -2821,7 +2829,8 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
|
||||
dm_task_set_name (task, vol_name);
|
||||
if (vol_uuid)
|
||||
dm_task_set_uuid (task, vol_uuid);
|
||||
- dm_task_add_target (task, 0, part->geom.length,
|
||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
||||
+ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT),
|
||||
"linear", params);
|
||||
if (!dm_task_set_cookie (task, &cookie, 0))
|
||||
goto err;
|
||||
@@ -2878,8 +2887,11 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
||||
/* Caution: dm_task_destroy frees dev_name. */
|
||||
dm_task_destroy (task);
|
||||
task = NULL;
|
||||
+
|
||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
||||
if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
|
||||
- arch_specific->minor, part->geom.start)))
|
||||
+ arch_specific->minor,
|
||||
+ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT))))
|
||||
goto err;
|
||||
|
||||
task = dm_task_create (DM_DEVICE_RELOAD);
|
||||
@@ -2887,7 +2899,8 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
||||
goto err;
|
||||
|
||||
dm_task_set_name (task, vol_name);
|
||||
- dm_task_add_target (task, 0, part->geom.length,
|
||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
||||
+ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT),
|
||||
"linear", params);
|
||||
if (!dm_task_set_cookie (task, &cookie, 0))
|
||||
goto err;
|
||||
--
|
||||
2.1.0
|
||||
|
24
0011-Update-manpage-NAME-so-whatis-will-work.patch
Normal file
24
0011-Update-manpage-NAME-so-whatis-will-work.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 098bf9ca4c1ea7955ad683694c64f0201760de60 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Fri, 1 Aug 2014 14:48:13 -0700
|
||||
Subject: [PATCH 11/11] Update manpage NAME so whatis will work
|
||||
|
||||
---
|
||||
doc/C/parted.8 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
||||
index 689011c..5304375 100644
|
||||
--- a/doc/C/parted.8
|
||||
+++ b/doc/C/parted.8
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH PARTED 8 "2007 March 29" parted "GNU Parted Manual"
|
||||
.SH NAME
|
||||
-GNU Parted \- a partition manipulation program
|
||||
+parted \- a partition manipulation program
|
||||
.SH SYNOPSIS
|
||||
.B parted
|
||||
[options] [device [command [options...]...]]
|
||||
--
|
||||
2.1.0
|
||||
|
12
parted.spec
12
parted.spec
@ -4,7 +4,7 @@
|
||||
Summary: The GNU disk partition manipulation program
|
||||
Name: parted
|
||||
Version: 3.2
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/System
|
||||
URL: http://www.gnu.org/software/parted
|
||||
@ -21,6 +21,10 @@ Patch0004: 0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch
|
||||
Patch0005: 0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch
|
||||
Patch0006: 0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch
|
||||
Patch0007: 0007-tests-Change-minimum-size-to-256MiB.patch
|
||||
Patch0008: 0008-parted-don-t-crash-in-disk_set-when-disk-label-not-f.patch
|
||||
Patch0009: 0009-tests-Add-a-test-for-device-mapper-partition-sizes.patch
|
||||
Patch0010: 0010-libparted-device-mapper-uses-512b-sectors.patch
|
||||
Patch0011: 0011-Update-manpage-NAME-so-whatis-will-work.patch
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: e2fsprogs-devel
|
||||
@ -162,6 +166,12 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 28 2015 Brian C. Lane <bcl@redhat.com> 3.2-6
|
||||
- Update manpage NAME so whatis will work (bcl)
|
||||
- libparted: device mapper uses 512b sectors (bcl)
|
||||
- tests: Add a test for device-mapper partition sizes (bcl)
|
||||
- parted: don't crash in disk_set when disk label not found (psusi)
|
||||
|
||||
* Fri Nov 07 2014 Brian C. Lane <bcl@redhat.com> 3.2-5
|
||||
- tests: Change minimum size to 256MiB for t1700-probe-fs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user