From df554c148ecfdfb7e597f8ab7eee71388b24a19d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 25 Feb 2011 14:36:01 +0700 Subject: Fix 'zfs set volsize=N pool/dataset' This change fixes a kernel panic which would occur when resizing a dataset which was not open. The objset_t stored in the zvol_state_t will be set to NULL when the block device is closed. To avoid this issue we pass the correct objset_t as the third arg. The code has also been updated to correctly notify the kernel when the block device capacity changes. For 2.6.28 and newer kernels the capacity change will be immediately detected. For earlier kernels the capacity change will be detected when the device is next opened. This is a known limitation of older kernels. Online ext3 resize test case passes on 2.6.28+ kernels: $ dd if=/dev/zero of=/tmp/zvol bs=1M count=1 seek=1023 $ zpool create tank /tmp/zvol $ zfs create -V 500M tank/zd0 $ mkfs.ext3 /dev/zd0 $ mkdir /mnt/zd0 $ mount /dev/zd0 /mnt/zd0 $ df -h /mnt/zd0 $ zfs set volsize=800M tank/zd0 $ resize2fs /dev/zd0 $ df -h /mnt/zd0 Original-patch-by: Fajar A. Nugraha Closes #68 Closes #84 --- dracut/90zfs/Makefile.in | 1 + dracut/Makefile.in | 1 + 2 files changed, 2 insertions(+) (limited to 'dracut') diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in index 14918a7e6..16d7bfb41 100644 --- a/dracut/90zfs/Makefile.in +++ b/dracut/90zfs/Makefile.in @@ -53,6 +53,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/kernel-blk-rq-pos.m4 \ $(top_srcdir)/config/kernel-blk-rq-sectors.m4 \ $(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \ + $(top_srcdir)/config/kernel-check-disk-size-change.m4 \ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \ $(top_srcdir)/config/kernel-evict-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ diff --git a/dracut/Makefile.in b/dracut/Makefile.in index 8afe241a5..c4c747e49 100644 --- a/dracut/Makefile.in +++ b/dracut/Makefile.in @@ -51,6 +51,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/kernel-blk-rq-pos.m4 \ $(top_srcdir)/config/kernel-blk-rq-sectors.m4 \ $(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \ + $(top_srcdir)/config/kernel-check-disk-size-change.m4 \ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \ $(top_srcdir)/config/kernel-evict-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ -- cgit v1.2.3