diff --git a/packaging/debian/megactl/changelog b/packaging/debian/megactl/changelog index ee6a5a0..ed1e94d 100644 --- a/packaging/debian/megactl/changelog +++ b/packaging/debian/megactl/changelog @@ -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) 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) Tue, 21 Jan 2014 22:54:42 +0100 + +megactl (0.4.1+svn20090725.r6-3) unstable; urgency=medium + + * New patch by Pat Suwalski to fix a bad disks + enumeration loop. + + -- Adam Cécile (Le_Vert) Tue, 21 Jan 2014 20:24:22 +0100 + megactl (0.4.1+svn20090725.r6-2) unstable; urgency=medium * Integrate patch by Pat Suwalski to handle devices diff --git a/packaging/debian/megactl/patches/000-No_absolute_pathes_in_examples.dpatch b/packaging/debian/megactl/patches/000-No_absolute_pathes_in_examples.dpatch old mode 100644 new mode 100755 diff --git a/packaging/debian/megactl/patches/001-Drop_obsolete_asm_user.h.dpatch b/packaging/debian/megactl/patches/001-Drop_obsolete_asm_user.h.dpatch old mode 100644 new mode 100755 diff --git a/packaging/debian/megactl/patches/003-Fix_disk_enumeration_loop.dpatch b/packaging/debian/megactl/patches/003-Fix_disk_enumeration_loop.dpatch new file mode 100755 index 0000000..6ff80f3 --- /dev/null +++ b/packaging/debian/megactl/patches/003-Fix_disk_enumeration_loop.dpatch @@ -0,0 +1,64 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 003-Fix_disk_enumeration_loop.dpatch by Pat Suwalski +## +## 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 + +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)); diff --git a/packaging/debian/megactl/patches/004-Fix_build_on_recent_distros.dpatch b/packaging/debian/megactl/patches/004-Fix_build_on_recent_distros.dpatch new file mode 100755 index 0000000..50491a7 --- /dev/null +++ b/packaging/debian/megactl/patches/004-Fix_build_on_recent_distros.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 004-Fix_build_on_recent_distros.dpatch by Adam Cécile (Le_Vert) +## +## 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 }, diff --git a/packaging/debian/megactl/patches/00list b/packaging/debian/megactl/patches/00list index 4a994f2..f4c9553 100644 --- a/packaging/debian/megactl/patches/00list +++ b/packaging/debian/megactl/patches/00list @@ -1,3 +1,5 @@ 000-No_absolute_pathes_in_examples.dpatch 001-Drop_obsolete_asm_user.h.dpatch 002-No_enclosure_support.dpatch +003-Fix_disk_enumeration_loop.dpatch +004-Fix_build_on_recent_distros.dpatch