Whamcloud - gitweb
LU-2800 autoconf: block device release changed in newer kernels. 80/5380/9
authorJames Simmons <uja.ornl@gmail.com>
Fri, 15 Nov 2013 17:40:42 +0000 (12:40 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Dec 2013 13:01:15 +0000 (13:01 +0000)
For kernels at 3.10 and above the release method for block
devices no longer return a integer. This impacts the lloop
block device we use on the lustre client side.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ib63e2897a48989f1cf5185a1c88a5ddbf989c0a9
Reviewed-on: http://review.whamcloud.com/5380
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/llite/lloop.c

index d31510b..27a6299 100644 (file)
@@ -1238,6 +1238,25 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# 3.10 release for block device doesn't return int
+AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT],
+[AC_MSG_CHECKING([if block_device_operations release returns int])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/blkdev.h>
+],[
+       struct block_device_operations fops;
+       int i __attribute__ ((unused));
+
+       i = fops.release(NULL,0);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
+                 [block device release returns int])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
 #
 # LC_PROG_LINUX
 #
@@ -1334,6 +1353,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
         # 3.10
         LC_HAVE_ONLY_PROCFS_SEQ
+        LC_BLKDEV_RELEASE_RETURN_INT
 
         #
         if test x$enable_server != xno ; then
index 1f5c6de..cef0de6 100644 (file)
@@ -608,15 +608,21 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
         return 0;
 }
 
-static int lo_release(struct gendisk *disk, fmode_t mode)
+#ifdef HAVE_BLKDEV_RELEASE_RETURN_INT
+static int
+#else
+static void
+#endif
+lo_release(struct gendisk *disk, fmode_t mode)
 {
-        struct lloop_device *lo = disk->private_data;
+       struct lloop_device *lo = disk->private_data;
 
        mutex_lock(&lo->lo_ctl_mutex);
-        --lo->lo_refcnt;
+       --lo->lo_refcnt;
        mutex_unlock(&lo->lo_ctl_mutex);
-
-        return 0;
+#ifdef HAVE_BLKDEV_RELEASE_RETURN_INT
+       return 0;
+#endif
 }
 
 /* lloop device node's ioctl function. */