summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorEtienne Dechamps <[email protected]>2012-07-11 15:06:32 +0200
committerBrian Behlendorf <[email protected]>2012-07-17 09:17:31 -0700
commitb5a28807cdec3c05aa69cbe4689cd914dc94783a (patch)
tree74d6949d5c6c27dbb5db9f3f3c23bffb81a75cfb /config
parentfb7eb3e3e9f8e611a34192ceb5c2d2e849ca6de8 (diff)
Move partition scanning from userspace to module.
Currently, zpool online -e (dynamic vdev expansion) doesn't work on whole disks because we're invoking ioctl(BLKRRPART) from userspace while ZFS still has a partition open on the disk, which results in EBUSY. This patch moves the BLKRRPART invocation from the zpool utility to the module. Specifically, this is done just before opening the device in vdev_disk_open() which is called inside vdev_reopen(). This requires jumping through some hoops to get to the disk device from the partition device, and to make sure we can still open the partition after the BLKRRPART call. Note that this new code path is triggered on dynamic vdev expansion only; other actions, like creating a new pool, are unchanged and still call BLKRRPART from userspace. This change also depends on API changes which are available in 2.6.37 and latter kernels. The build system has been updated to detect this, but there is no compatibility mode for older kernels. This means that online expansion will NOT be available in older kernels. However, it will still be possible to expand the vdev offline. Signed-off-by: Brian Behlendorf <[email protected]> Closes #808
Diffstat (limited to 'config')
-rw-r--r--config/kernel-blkdev-get.m419
-rw-r--r--config/kernel-get-gendisk.m411
-rw-r--r--config/kernel.m42
3 files changed, 32 insertions, 0 deletions
diff --git a/config/kernel-blkdev-get.m4 b/config/kernel-blkdev-get.m4
new file mode 100644
index 000000000..e31d71770
--- /dev/null
+++ b/config/kernel-blkdev-get.m4
@@ -0,0 +1,19 @@
+dnl #
+dnl # 2.6.37 API change
+dnl # Added 3rd argument for the active holder, previously this was
+dnl # hardcoded to NULL.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_3ARG_BLKDEV_GET], [
+ AC_MSG_CHECKING([whether blkdev_get() wants 3 args])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ struct block_device *bdev = NULL;
+ (void) blkdev_get(bdev, 0, NULL);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_3ARG_BLKDEV_GET, 1, [blkdev_get() wants 3 args])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel-get-gendisk.m4 b/config/kernel-get-gendisk.m4
new file mode 100644
index 000000000..8cd725f0e
--- /dev/null
+++ b/config/kernel-get-gendisk.m4
@@ -0,0 +1,11 @@
+dnl #
+dnl # 2.6.34 API change
+dnl # Verify the get_gendisk() symbol is exported.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK], [
+ ZFS_CHECK_SYMBOL_EXPORT(
+ [get_gendisk],
+ [block/genhd.c],
+ [AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available])],
+ [])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 7f07c9063..7d7f16730 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -8,6 +8,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_TYPE_FMODE_T
ZFS_AC_KERNEL_KOBJ_NAME_LEN
+ ZFS_AC_KERNEL_3ARG_BLKDEV_GET
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
@@ -34,6 +35,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BLK_RQ_POS
ZFS_AC_KERNEL_BLK_RQ_SECTORS
ZFS_AC_KERNEL_GET_DISK_RO
+ ZFS_AC_KERNEL_GET_GENDISK
ZFS_AC_KERNEL_RQ_IS_SYNC
ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT
ZFS_AC_KERNEL_CONST_XATTR_HANDLER