summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-07-23 15:40:15 -0700
committerGitHub <[email protected]>2018-07-23 15:40:15 -0700
commitd441e85dd754ecc15659322b4d36796cbd3838de (patch)
tree3b5adc51a6bda08c513edd382769cade243bb0ca /config
parent2e5dc449c1a65e0b0bf730fd69c9b5804bd57ee8 (diff)
Add support for autoexpand property
While the autoexpand property may seem like a small feature it depends on a significant amount of system infrastructure. Enough of that infrastructure is now in place that with a few modifications for Linux it can be supported. Auto-expand works as follows; when a block device is modified (re-sized, closed after being open r/w, etc) a change uevent is generated for udev. The ZED, which is monitoring udev events, passes the change event along to zfs_deliver_dle() if the disk or partition contains a zfs_member as identified by blkid. From here the device is matched against all imported pool vdevs using the vdev_guid which was read from the label by blkid. If a match is found the ZED reopens the pool vdev. This re-opening is important because it allows the vdev to be briefly closed so the disk partition table can be re-read. Otherwise, it wouldn't be possible to report the maximum possible expansion size. Finally, if the property autoexpand=on a vdev expansion will be attempted. After performing some sanity checks on the disk to verify that it is safe to expand, the primary partition (-part1) will be expanded and the partition table updated. The partition is then re-opened (again) to detect the updated size which allows the new capacity to be used. In order to make all of the above possible the following changes were required: * Updated the zpool_expand_001_pos and zpool_expand_003_pos tests. These tests now create a pool which is layered on a loopback, scsi_debug, and file vdev. This allows for testing of non- partitioned block device (loopback), a partition block device (scsi_debug), and a file which does not receive udev change events. This provided for better test coverage, and by removing the layering on ZFS volumes there issues surrounding layering one pool on another are avoided. * zpool_find_vdev_by_physpath() updated to accept a vdev guid. This allows for matching by guid rather than path which is a more reliable way for the ZED to reference a vdev. * Fixed zfs_zevent_wait() signal handling which could result in the ZED spinning when a signal was not handled. * Removed vdev_disk_rrpart() functionality which can be abandoned in favor of kernel provided blkdev_reread_part() function. * Added a rwlock which is held as a writer while a disk is being reopened. This is important to prevent errors from occurring for any configuration related IOs which bypass the SCL_ZIO lock. The zpool_reopen_007_pos.ksh test case was added to verify IO error are never observed when reopening. This is not expected to impact IO performance. Additional fixes which aren't critical but were discovered and resolved in the course of developing this functionality. * Added PHYS_PATH="/dev/zvol/dataset" to the vdev configuration for ZFS volumes. This is as good as a unique physical path, while the volumes are not used in the test cases anymore for other reasons this improvement was included. Reviewed by: Richard Elling <[email protected]> Signed-off-by: Sara Hartse <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #120 Closes #2437 Closes #5771 Closes #7366 Closes #7582 Closes #7629
Diffstat (limited to 'config')
-rw-r--r--config/kernel-blkdev-get.m419
-rw-r--r--config/kernel-blkdev-reread-part.m421
-rw-r--r--config/kernel-get-gendisk.m417
-rw-r--r--config/kernel.m43
4 files changed, 22 insertions, 38 deletions
diff --git a/config/kernel-blkdev-get.m4 b/config/kernel-blkdev-get.m4
deleted file mode 100644
index e31d71770..000000000
--- a/config/kernel-blkdev-get.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-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-blkdev-reread-part.m4 b/config/kernel-blkdev-reread-part.m4
new file mode 100644
index 000000000..5664769a3
--- /dev/null
+++ b/config/kernel-blkdev-reread-part.m4
@@ -0,0 +1,21 @@
+dnl #
+dnl # 4.1 API, exported blkdev_reread_part() symbol, backported to the
+dnl # 3.10.0 CentOS 7.x enterprise kernels.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [
+ AC_MSG_CHECKING([whether blkdev_reread_part() is available])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ], [
+ struct block_device *bdev = NULL;
+ int error;
+
+ error = blkdev_reread_part(bdev);
+ ], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1,
+ [blkdev_reread_part() is available])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel-get-gendisk.m4 b/config/kernel-get-gendisk.m4
deleted file mode 100644
index b0913770e..000000000
--- a/config/kernel-get-gendisk.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-dnl #
-dnl # 2.6.34 API change
-dnl # Verify the get_gendisk() symbol is available.
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_GET_GENDISK],
- [AC_MSG_CHECKING([whether get_gendisk() is available])
- ZFS_LINUX_TRY_COMPILE_SYMBOL([
- #include <linux/genhd.h>
- ], [
- get_gendisk(0, NULL);
- ], [get_gendisk], [block/genhd.c], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_GET_GENDISK, 1, [get_gendisk() is available])
- ], [
- AC_MSG_RESULT(no)
- ])
-])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 8c2998204..7ae10c127 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -44,8 +44,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
ZFS_AC_KERNEL_TYPE_FMODE_T
- ZFS_AC_KERNEL_3ARG_BLKDEV_GET
ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH
+ ZFS_AC_KERNEL_BLKDEV_REREAD_PART
ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE
ZFS_AC_KERNEL_LOOKUP_BDEV
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
@@ -73,7 +73,6 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
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
ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL
ZFS_AC_KERNEL_DISCARD_GRANULARITY