From 96daa1b1ec0b4c9c61d30ff18a32f015a14fd528 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 15 Nov 2013 12:40:42 -0500 Subject: [PATCH] LU-2800 autoconf: block device release changed in newer kernels. 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 Change-Id: Ib63e2897a48989f1cf5185a1c88a5ddbf989c0a9 Reviewed-on: http://review.whamcloud.com/5380 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/llite/lloop.c | 16 +++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index d31510bc..27a6299 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 1f5c6de..cef0de6 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -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. */ -- 1.8.3.1