megactl: new patches and updated debian packaging

This commit is contained in:
Adam Cécile (Le_Vert) 2014-01-25 23:29:12 +01:00
parent ab29056206
commit 849bde0ca7
6 changed files with 103 additions and 0 deletions

View File

@ -1,3 +1,22 @@
megactl (0.4.1+svn20090725.r6-5) unstable; urgency=medium
* Update 003-Fix_disk_enumeration_loop patch (fix issues with PERC6e).
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Sat, 25 Jan 2014 23:10:36 +0100
megactl (0.4.1+svn20090725.r6-4) unstable; urgency=medium
* Fix build on Jessie+.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Tue, 21 Jan 2014 22:54:42 +0100
megactl (0.4.1+svn20090725.r6-3) unstable; urgency=medium
* New patch by Pat Suwalski <pat@suwalski.net> to fix a bad disks
enumeration loop.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Tue, 21 Jan 2014 20:24:22 +0100
megactl (0.4.1+svn20090725.r6-2) unstable; urgency=medium megactl (0.4.1+svn20090725.r6-2) unstable; urgency=medium
* Integrate patch by Pat Suwalski <pat@suwalski.net> to handle devices * Integrate patch by Pat Suwalski <pat@suwalski.net> to handle devices

View File

View File

@ -0,0 +1,64 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 003-Fix_disk_enumeration_loop.dpatch by Pat Suwalski <pat@suwalski.net>
##
## DP: When my controller has a failed disk, megasasctl fails.
## DP:
## DP: I have tracked the problem down to a bad assumption, that the various
## DP: disk enumeration loops would use the number of currently online drives
## DP: as the basis for the iterator.
## DP:
## DP: This number decreases when a disk fails. It is not noticeable in many
## DP: cases, because on many some controllers pinfo->pd_present_count is
## DP: one higher than the actual number of disks.
## DP: However, the same situation would be encountered in a RAID1 system with
## DP: two failed disks.
## DP:
## DP: The attached one-line patch uses the number of ports
## DP: on the controller as the basis.
@DPATCH@
This patch fixes a segfault based on an incorrect assumption that the number
of physical drives to loop over is the number of currently online drives
connected to the controller. This change plays it safe and makes it use the
number of ports on the controller, with a fallback for the worst case
scenario.
Pat Suwalski <pat@suwalski.net>
diff -ur megactl-code/src/adapter.c megactl-code2/src/adapter.c
--- a/src/adapter.c 2014-01-20 11:13:48.114598462 -0500
+++ b/src/adapter.c 2014-01-20 14:33:32.950851825 -0500
@@ -706,7 +706,31 @@
}
qsort (a->channel, a->num_channels, sizeof (*a->channel), cmpChannel);
- a->num_physicals = pinfo->pd_present_count;
+ /* Some notes:
+ Different meanings on different models.
+ - FC_MAX_PHYSICAL_DEVICES used on older controllers, which is 256
+ disks (overallocation)
+ - pd_disk_present_count is number of working drives, not counting
+ missing drives
+ - pd_present_count is unclear. It is pd_disk_present_count + 1 on some
+ controllers
+ - device_interface.port_count contains number of physical ports on the
+ controller
+
+ pd_present_count was used here, but in some controllers causes segfaults
+ when there is a failed drive, and not enough space is allocated.
+
+ Since there cannot be more devices than there are ports, that is a safe
+ number to set without going overboard.
+ */
+ a->num_physicals = pinfo->device_interface.port_count;
+
+ /* On some controllers, namely the PERC6e, the controller does not know
+ how many ports there are in the enclosure. Fall back to the worst case
+ scenario. */
+ if (a->num_physicals < pinfo->pd_disk_present_count)
+ a->num_physicals = FC_MAX_PHYSICAL_DEVICES;
+
if ((a->physical = (struct physical_drive_info *) malloc (a->num_physicals * sizeof (*a->physical))) == NULL)
return "out of memory (physical drives)";
memset (a->physical, 0, a->num_physicals * sizeof (*a->physical));

View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 004-Fix_build_on_recent_distros.dpatch by Adam Cécile (Le_Vert) <gandalf@le-vert.net>
##
## DP: SYS_madvise1 has been renamed to SYS_madvise a long time ago (btw, it's
## DP: not used anywhere)
@DPATCH@
--- a/src/callinfo.c 2007-08-21 08:47:29.000000000 +0200
+++ b/src/callinfo.c 2014-01-21 22:51:59.788201043 +0100
@@ -255,7 +255,7 @@
{ SYS_setfsgid32, 0, "setfsgid32" },
{ SYS_pivot_root, 0, "pivot_root" },
{ SYS_mincore, 0, "mincore" },
- { SYS_madvise1, 0, "madvise1" },
+ { SYS_madvise, 0, "madvise" },
{ SYS_getdents64, 0, "getdents64" },
{ SYS_fcntl64, 0, "fcntl64" },
{ 222, 0, NULL },

View File

@ -1,3 +1,5 @@
000-No_absolute_pathes_in_examples.dpatch 000-No_absolute_pathes_in_examples.dpatch
001-Drop_obsolete_asm_user.h.dpatch 001-Drop_obsolete_asm_user.h.dpatch
002-No_enclosure_support.dpatch 002-No_enclosure_support.dpatch
003-Fix_disk_enumeration_loop.dpatch
004-Fix_build_on_recent_distros.dpatch