75b07eca3e
by importing the upstream release as patches. replace user namespace patch with version which has been applied usptream.
99 lines
3.2 KiB
Diff
99 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Giuseppe Di Natale <dinatale2@users.noreply.github.com>
|
|
Date: Mon, 5 Mar 2018 12:44:35 -0800
|
|
Subject: [PATCH] Linux 4.16 compat: get_disk_and_module()
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
As of https://github.com/torvalds/linux/commit/fb6d47a, get_disk()
|
|
is now get_disk_and_module(). Add a configure check to determine
|
|
if we need to use get_disk_and_module().
|
|
|
|
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
|
|
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
|
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
|
|
Closes #7264
|
|
(cherry picked from commit 8d7f17798d0faa0001bf7257759be0c688b91044)
|
|
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
|
---
|
|
include/linux/blkdev_compat.h | 8 ++++++++
|
|
module/zfs/zvol.c | 2 +-
|
|
config/kernel-get-disk-and-module.m4 | 19 +++++++++++++++++++
|
|
config/kernel.m4 | 1 +
|
|
4 files changed, 29 insertions(+), 1 deletion(-)
|
|
create mode 100644 config/kernel-get-disk-and-module.m4
|
|
|
|
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
|
|
index c8a8e856d..4406493e4 100644
|
|
--- a/include/linux/blkdev_compat.h
|
|
+++ b/include/linux/blkdev_compat.h
|
|
@@ -139,6 +139,14 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
|
|
#endif
|
|
}
|
|
|
|
+#ifndef HAVE_GET_DISK_AND_MODULE
|
|
+static inline struct kobject *
|
|
+get_disk_and_module(struct gendisk *disk)
|
|
+{
|
|
+ return (get_disk(disk));
|
|
+}
|
|
+#endif
|
|
+
|
|
#ifndef HAVE_GET_DISK_RO
|
|
static inline int
|
|
get_disk_ro(struct gendisk *disk)
|
|
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
|
|
index aac494209..62176e1cf 100644
|
|
--- a/module/zfs/zvol.c
|
|
+++ b/module/zfs/zvol.c
|
|
@@ -1559,7 +1559,7 @@ zvol_probe(dev_t dev, int *part, void *arg)
|
|
struct kobject *kobj;
|
|
|
|
zv = zvol_find_by_dev(dev);
|
|
- kobj = zv ? get_disk(zv->zv_disk) : NULL;
|
|
+ kobj = zv ? get_disk_and_module(zv->zv_disk) : NULL;
|
|
ASSERT(zv == NULL || MUTEX_HELD(&zv->zv_state_lock));
|
|
if (zv)
|
|
mutex_exit(&zv->zv_state_lock);
|
|
diff --git a/config/kernel-get-disk-and-module.m4 b/config/kernel-get-disk-and-module.m4
|
|
new file mode 100644
|
|
index 000000000..2a51a5af7
|
|
--- /dev/null
|
|
+++ b/config/kernel-get-disk-and-module.m4
|
|
@@ -0,0 +1,19 @@
|
|
+dnl #
|
|
+dnl # 4.16 API change
|
|
+dnl # Verify if get_disk_and_module() symbol is available.
|
|
+dnl #
|
|
+AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE],
|
|
+ [AC_MSG_CHECKING([whether get_disk_and_module() is available])
|
|
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
|
+ #include <linux/genhd.h>
|
|
+ ], [
|
|
+ struct gendisk *disk = NULL;
|
|
+ (void) get_disk_and_module(disk);
|
|
+ ], [get_disk_and_module], [block/genhd.c], [
|
|
+ AC_MSG_RESULT(yes)
|
|
+ AC_DEFINE(HAVE_GET_DISK_AND_MODULE,
|
|
+ 1, [get_disk_and_module() is available])
|
|
+ ], [
|
|
+ AC_MSG_RESULT(no)
|
|
+ ])
|
|
+])
|
|
diff --git a/config/kernel.m4 b/config/kernel.m4
|
|
index 3e499e447..419ed1a2c 100644
|
|
--- a/config/kernel.m4
|
|
+++ b/config/kernel.m4
|
|
@@ -40,6 +40,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
|
|
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG
|
|
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG
|
|
+ ZFS_AC_KERNEL_GET_DISK_AND_MODULE
|
|
ZFS_AC_KERNEL_GET_DISK_RO
|
|
ZFS_AC_KERNEL_GET_GENDISK
|
|
ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
|
|
--
|
|
2.14.2
|
|
|