summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin McCarthy <signals@gentoo.org>2011-03-02 23:29:51 +0000
committerKevin McCarthy <signals@gentoo.org>2011-03-02 23:29:51 +0000
commitbaa3022a3c28b0a8a68f986b49044cc88db503b4 (patch)
treed0bcc3925690563b42150af76e69c0422dae2b73 /sys-fs/vhba
parentEAPI=2; slot gtk+ dep (diff)
downloadgentoo-2-baa3022a3c28b0a8a68f986b49044cc88db503b4.tar.gz
gentoo-2-baa3022a3c28b0a8a68f986b49044cc88db503b4.tar.bz2
gentoo-2-baa3022a3c28b0a8a68f986b49044cc88db503b4.zip
Patch to fix oops on kernel >=2.6.37. Bug #350753
(Portage version: 2.2.0_alpha25/cvs/Linux x86_64)
Diffstat (limited to 'sys-fs/vhba')
-rw-r--r--sys-fs/vhba/ChangeLog10
-rw-r--r--sys-fs/vhba/files/vhba-20101015-scsi-host-lock-push-down.patch56
-rw-r--r--sys-fs/vhba/vhba-20101015-r1.ebuild60
3 files changed, 124 insertions, 2 deletions
diff --git a/sys-fs/vhba/ChangeLog b/sys-fs/vhba/ChangeLog
index 4f0b4b629040..8626c7e4cf8c 100644
--- a/sys-fs/vhba/ChangeLog
+++ b/sys-fs/vhba/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-fs/vhba
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/ChangeLog,v 1.20 2010/10/27 16:55:46 pva Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/ChangeLog,v 1.21 2011/03/02 23:29:51 signals Exp $
+
+*vhba-20101015-r1 (02 Mar 2011)
+
+ 02 Mar 2011; Kevin McCarthy <signals@gentoo.org> +vhba-20101015-r1.ebuild,
+ +files/vhba-20101015-scsi-host-lock-push-down.patch:
+ Patch to fix oops on kernel >=2.6.37. Bug #350753
27 Oct 2010; Peter Volkov <pva@gentoo.org> -vhba-1.2.1_p682.ebuild:
Drop broken version, #332961, thank nE0sIghT for tests.
diff --git a/sys-fs/vhba/files/vhba-20101015-scsi-host-lock-push-down.patch b/sys-fs/vhba/files/vhba-20101015-scsi-host-lock-push-down.patch
new file mode 100644
index 000000000000..e2b619c74ba8
--- /dev/null
+++ b/sys-fs/vhba/files/vhba-20101015-scsi-host-lock-push-down.patch
@@ -0,0 +1,56 @@
+From 9ad7ec7fae387f05249b9f4e6accb3bc3b0b8b0f Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gmail.com>
+Date: Thu, 6 Jan 2011 03:39:26 -0500
+Subject: [PATCH] Make vhba compatible with kernel 2.6.37 SCSI host API
+
+Due to the SCSI host lock push-down changes introduced in 2.6.37 (see
+http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f281233d3eba15fb225d21ae2e228fd4553d824a
+for more details), trying to use current vhba on 2.6.37 leads to oopses
+and kernel panics - e.g. see http://bugs.gentoo.org/show_bug.cgi?id=350753
+
+Add some #ifdefs to enable compatibility both with 2.6.37 and older API.
+Note that if future kernel versions remove the DEF_SCSI_QCMD macro, this
+issue will need to be revisited.
+
+Signed-off-by: Alexandre Rostovtsev <tetromino@gmail.com>
+---
+ vhba-module/vhba.c | 9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/vhba-module/vhba.c b/vhba-module/vhba.c
+index 059f6ce..9d13016 100644
+--- a/vhba-module/vhba.c
++++ b/vhba-module/vhba.c
+@@ -27,6 +27,7 @@
+ #include <linux/miscdevice.h>
+ #include <linux/poll.h>
+ #include <linux/slab.h>
++#include <linux/version.h>
+ #ifdef CONFIG_COMPAT
+ #include <linux/compat.h>
+ #endif
+@@ -363,7 +364,7 @@ static void vhba_free_command(struct vhba_command *vcmd)
+ spin_unlock_irqrestore(&vhost->cmd_lock, flags);
+ }
+
+-static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
++static int vhba_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
+ {
+ struct vhba_device *vdev;
+ int retval;
+@@ -388,6 +389,12 @@ static int vhba_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
+ return retval;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
++DEF_SCSI_QCMD(vhba_queuecommand)
++#else
++#define vhba_queuecommand vhba_queuecommand_lck
++#endif
++
+ static int vhba_abort(struct scsi_cmnd *cmd)
+ {
+ struct vhba_device *vdev;
+--
+1.7.3.4
+
diff --git a/sys-fs/vhba/vhba-20101015-r1.ebuild b/sys-fs/vhba/vhba-20101015-r1.ebuild
new file mode 100644
index 000000000000..e56c3d349d4e
--- /dev/null
+++ b/sys-fs/vhba/vhba-20101015-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/vhba-20101015-r1.ebuild,v 1.1 2011/03/02 23:29:51 signals Exp $
+
+# Use svn snapshots:
+# https://sourceforge.net/tracker/?func=detail&atid=603423&aid=3041832&group_id=93175
+# "As for the release, could you package the SVN version instead? I'd prefer
+# if people used latest SVN at any time anyway..." -- Upstream
+
+EAPI="2"
+
+inherit linux-mod eutils
+
+MY_P=vhba-module-${PV}
+DESCRIPTION="VHBA module provides Virtual (SCSI) Host Bus Adapter for the cdemu suite"
+HOMEPAGE="http://cdemu.org"
+SRC_URI="mirror://gentoo/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=virtual/linux-sources-2.6.19"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+MODULE_NAMES="vhba(block:${S})"
+BUILD_TARGETS=all
+
+pkg_setup() {
+ CONFIG_CHECK="~BLK_DEV_SR ~CHR_DEV_SG"
+ check_extra_config
+ BUILD_PARAMS="KDIR=${KV_DIR}"
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-scsi-host-lock-push-down.patch
+}
+
+src_install() {
+ linux-mod_src_install || die "Error: installing module failed!"
+
+ einfo "Generating udev rules ..."
+ dodir /etc/udev/rules.d/
+ cat > "${D}"/etc/udev/rules.d/70-vhba.rules <<-EOF || die
+ # do not edit this file, it will be overwritten on update
+ #
+ KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu"
+ EOF
+}
+
+pkg_postinst() {
+ enewgroup cdemu
+
+ elog "Don't forget to add your user to the cdemu group"
+ elog "if you want to be able to use virtual cdemu devices."
+ linux-mod_pkg_postinst
+}