Although this bug was reported to affect Linux 3.10+, a different issue
has made the module impossible to load since Linux 3.4!

I fixed this and the dependency on linux-headers with an NMU, for which
the diff is below.

Ben.

---
diff -Nru blktap-dkms-2.0.91/blktap.h blktap-dkms-2.0.93/blktap.h
--- blktap-dkms-2.0.91/blktap.h 2011-12-10 14:36:49.000000000 +0000
+++ blktap-dkms-2.0.93/blktap.h 2013-11-18 14:31:42.000000000 +0000
@@ -29,6 +29,7 @@
 #include <linux/cdev.h>
 #include <linux/init.h>
 #include <linux/scatterlist.h>
+#include <linux/mutex.h>
 #include "linux-blktap.h"
 
 extern int blktap_debug_level;
@@ -67,6 +68,7 @@
        struct task_struct            *task;
 
        struct vm_area_struct         *vma;
+       struct mutex                   vma_lock;
        struct blktap_front_ring       ring;
        unsigned long                  ring_vstart;
        unsigned long                  user_vstart;
diff -Nru blktap-dkms-2.0.91/debian/changelog 
blktap-dkms-2.0.93/debian/changelog
--- blktap-dkms-2.0.91/debian/changelog 2013-03-22 11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/changelog 2013-11-18 14:37:48.000000000 +0000
@@ -1,3 +1,13 @@
+blktap-dkms (2.0.93-0.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * copyright: Update details for new upstream maintainer
+  * New upstream release
+    - Fix compatibility with Linux 3.4+ (Closes: #717157)
+  * Remove dependency on obsolete linux-headers packages (Closes: #728266)
+
+ -- Ben Hutchings <b...@decadent.org.uk>  Mon, 18 Nov 2013 13:53:20 +0000
+
 blktap-dkms (2.0.91-3) experimental; urgency=low
 
   * Uploading to experimental during the freeze.
diff -Nru blktap-dkms-2.0.91/debian/control blktap-dkms-2.0.93/debian/control
--- blktap-dkms-2.0.91/debian/control   2013-03-22 11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/control   2013-11-18 14:39:53.000000000 +0000
@@ -11,7 +11,8 @@
 
 Package: blktap-dkms
 Architecture: i386 amd64
-Depends: ${misc:Depends}, dkms, linux-libc-dev, libc6-dev, 
${xcp-kernel-header-depends}
+Depends: ${misc:Depends}, dkms, linux-libc-dev, libc6-dev
+Recommends: ${xcp-kernel-header-recommends}
 Description: Xen API blktap kernel component DKMS package
  The Xen Cloud Platform (XCP) is an open source enterprise-ready server
  virtualization and cloud computing platform, delivering the Xen Hypervisor
diff -Nru blktap-dkms-2.0.91/debian/copyright 
blktap-dkms-2.0.93/debian/copyright
--- blktap-dkms-2.0.91/debian/copyright 2013-03-22 11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/copyright 2013-11-18 14:36:23.000000000 +0000
@@ -1,15 +1,16 @@
 Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=173
 Upstream-Name: blktap-dkms
-Upstream-Contact: Jonathan Ludlam <jonathan.lud...@eu.citrix.com>
-Source: git clone http://github.com/jonludlam/blktap-dkms.git
+Upstream-Contact: Mike McClurg <mike.mccl...@citrix.com>
+Source: git clone https://github.com/mcclurmc/blktap-dkms.git
 
 Files: debian/*
 Copyright: (c) 2011, Jon Ludlam <jonathan.lud...@eu.citrix.com>
  (c) 2011, Thomas Goirand <z...@debian.org>
+ 2012, Mike McClurg <mike.mccl...@citrix.com>
 License: 2 clauses BSD
 
 Files: *
-Copyright: (c) 2011, Citrix Systems, Inc.
+Copyright: (c) 2011-2012, Citrix Systems, Inc.
 License: GPL-2
 
 License: 2 clauses BSD
diff -Nru blktap-dkms-2.0.91/debian/debian_control_vars 
blktap-dkms-2.0.93/debian/debian_control_vars
--- blktap-dkms-2.0.91/debian/debian_control_vars       2013-03-22 
11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/debian_control_vars       2013-11-18 
14:23:48.000000000 +0000
@@ -1 +1 @@
-xcp-kernel-header-depends= linux-headers-generic [i386 amd64] | linux-headers
+xcp-kernel-header-recommends= linux-headers-686-pae [i386], 
linux-headers-amd64 [amd64]
diff -Nru 
blktap-dkms-2.0.91/debian/patches/compatibility_with_linux_3.7_onward.patch 
blktap-dkms-2.0.93/debian/patches/compatibility_with_linux_3.7_onward.patch
--- blktap-dkms-2.0.91/debian/patches/compatibility_with_linux_3.7_onward.patch 
2013-03-22 11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/patches/compatibility_with_linux_3.7_onward.patch 
1970-01-01 01:00:00.000000000 +0100
@@ -1,58 +0,0 @@
-Description: Changed flag VM_RESERVED to VM_DONTDUMP to provide compatibility 
with Linux 3.7 onwards.
-Origin: upstream, 
https://github.com/xen-org/blktap-dkms/commit/3bd35d662de12139b7ed5b6dc1076a231a651d10
-Author: Vincent Bernardoff <vincent.bernard...@citrix.com>
-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/blktap-dkms/+bug/1078843
-Date: 2013-02-26
-
-diff --git a/ring.c b/ring.c
-index 3e33f7a..f1a3b59 100644
---- a/ring.c
-+++ b/ring.c
-@@ -14,7 +14,7 @@
-  * GNU General Public License version 2 for more details.
-  *
-  * You should have received a copy of the GNU General Public License
-- * version 2 along with Blktap2.  If not, see 
-+ * version 2 along with Blktap2.  If not, see
-  * <http://www.gnu.org/licenses/>.
-  *
-  *
-@@ -27,12 +27,19 @@
- #include <linux/blkdev.h>
- #include <linux/mman.h>
- 
-+/* VM_RESERVED has disappeared starting from Linux 3.7 and has been
-+ * replaced by VM_DONTDUMP since then.
-+ */
-+#ifndef VM_DONTDUMP
-+#define VM_DONTDUMP VM_RESERVED
-+#endif
-+
- #include "blktap.h"
- 
- int blktap_ring_major;
- static struct cdev blktap_ring_cdev;
- 
-- /* 
-+ /*
-   * BLKTAP - immediately before the mmap area,
-   * we have a bunch of pages reserved for shared memory rings.
-   */
-@@ -435,7 +442,7 @@ blktap_ring_mmap_request(struct blktap *tap,
-       }
- 
-       vma->vm_flags |= VM_DONTCOPY;
--      vma->vm_flags |= VM_RESERVED;
-+      vma->vm_flags |= VM_DONTDUMP;
- 
-       return 0;
- }
-@@ -471,7 +478,7 @@ blktap_ring_mmap_sring(struct blktap *tap, struct 
vm_area_struct *vma)
-       vma->vm_private_data = tap;
- 
-       vma->vm_flags |= VM_DONTCOPY;
--      vma->vm_flags |= VM_RESERVED;
-+      vma->vm_flags |= VM_DONTDUMP;
- 
-       vma->vm_ops = &blktap_ring_vm_operations;
- 
diff -Nru blktap-dkms-2.0.91/debian/patches/series 
blktap-dkms-2.0.93/debian/patches/series
--- blktap-dkms-2.0.91/debian/patches/series    2013-03-22 11:51:00.000000000 
+0000
+++ blktap-dkms-2.0.93/debian/patches/series    2013-11-18 14:27:56.000000000 
+0000
@@ -1,2 +1 @@
 fixes-DEST_MODULE_LOCATION-in-dkms.conf.patch
-compatibility_with_linux_3.7_onward.patch
diff -Nru blktap-dkms-2.0.91/debian/ubuntu_control_vars 
blktap-dkms-2.0.93/debian/ubuntu_control_vars
--- blktap-dkms-2.0.91/debian/ubuntu_control_vars       2013-03-22 
11:51:00.000000000 +0000
+++ blktap-dkms-2.0.93/debian/ubuntu_control_vars       2013-11-18 
14:23:10.000000000 +0000
@@ -0,0 +1 @@
+xcp-kernel-header-recommends= linux-headers-generic
diff -Nru blktap-dkms-2.0.91/dkms.conf blktap-dkms-2.0.93/dkms.conf
--- blktap-dkms-2.0.91/dkms.conf        2011-12-10 14:36:49.000000000 +0000
+++ blktap-dkms-2.0.93/dkms.conf        2013-11-18 14:31:54.000000000 +0000
@@ -1,4 +1,4 @@
-PACKAGE_VERSION="2.0.91"
+PACKAGE_VERSION="2.0.93"
 PACKAGE_NAME="blktap"
 CLEAN="make -C ${kernel_source_dir} 
M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
 MAKE="make -C ${kernel_source_dir} 
M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
diff -Nru blktap-dkms-2.0.91/ring.c blktap-dkms-2.0.93/ring.c
--- blktap-dkms-2.0.91/ring.c   2011-11-28 20:16:07.000000000 +0000
+++ blktap-dkms-2.0.93/ring.c   2013-11-18 14:31:42.000000000 +0000
@@ -26,6 +26,7 @@
 #include <linux/poll.h>
 #include <linux/blkdev.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include "blktap.h"
 
@@ -96,9 +97,9 @@
        struct blktap_ring_response rsp;
        RING_IDX rc, rp;
 
-       down_read(&current->mm->mmap_sem);
+       mutex_lock(&ring->vma_lock);
        if (!ring->vma) {
-               up_read(&current->mm->mmap_sem);
+               mutex_unlock(&ring->vma_lock);
                return;
        }
 
@@ -113,7 +114,7 @@
 
        ring->ring.rsp_cons = rc;
 
-       up_read(&current->mm->mmap_sem);
+       mutex_unlock(&ring->vma_lock);
 }
 
 #define MMAP_VADDR(_start, _req, _seg)                         \
@@ -203,7 +204,7 @@
 
        pgoff = 1 + request->usr_idx * BLKTAP_SEGMENT_MAX;
 
-       addr = do_mmap_pgoff(filp, addr, len, prot, flags, pgoff);
+       addr = vm_mmap(filp, addr, len, prot, flags, pgoff << PAGE_SHIFT);
 
        return IS_ERR_VALUE(addr) ? addr : 0;
 }
@@ -223,7 +224,7 @@
        addr  = MMAP_VADDR(ring->user_vstart, request->usr_idx, 0);
        len   = request->nr_pages << PAGE_SHIFT;
 
-       err = do_munmap(current->mm, addr, len);
+       err = vm_munmap(addr, len);
        WARN_ON_ONCE(err);
 }
 
@@ -597,10 +598,10 @@
        poll_wait(filp, &tap->pool->wait, wait);
        poll_wait(filp, &ring->poll_wait, wait);
 
-       down_read(&current->mm->mmap_sem);
+       mutex_lock(&ring->vma_lock);
        if (ring->vma && tap->device.gd)
                blktap_device_run_queue(tap, filp);
-       up_read(&current->mm->mmap_sem);
+       mutex_unlock(&ring->vma_lock);
 
        work = ring->ring.req_prod_pvt - ring->ring.sring->req_prod;
        RING_PUSH_REQUESTS(&ring->ring);
@@ -646,6 +647,7 @@
 
        init_waitqueue_head(&ring->poll_wait);
        ring->devno = MKDEV(blktap_ring_major, tap->minor);
+       mutex_init(&ring->vma_lock);
 
        return 0;
 }


-- 
Ben Hutchings
Teamwork is essential - it allows you to blame someone else.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to