Last active
August 29, 2015 14:02
-
-
Save b333z/c3e6da6001fccf9d39d1 to your computer and use it in GitHub Desktop.
zfs - issue-1208
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Info for issue-1208 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c | |
index 7751683..4c67792 100644 | |
--- a/module/zfs/vdev.c | |
+++ b/module/zfs/vdev.c | |
@@ -793,6 +793,17 @@ vdev_remove_parent(vdev_t *cvd) | |
cvd->vdev_orig_guid = cvd->vdev_guid; | |
cvd->vdev_guid += guid_delta; | |
cvd->vdev_guid_sum += guid_delta; | |
+ | |
+ /* | |
+ * If pool not set for autoexpand, we need to also preserve | |
+ * mvd's asize to prevent automatic expansion of cvd. | |
+ * Otherwise if we are adjusting the mirror by attaching and | |
+ * detaching children of non-uniform sizes, the mirror could | |
+ * autoexpand, unexpectedly requiring larger devices to | |
+ * re-establish the mirror. | |
+ */ | |
+ if (!cvd->vdev_spa->spa_autoexpand) | |
+ cvd->vdev_asize = mvd->vdev_asize; | |
} | |
cvd->vdev_id = mvd->vdev_id; | |
vdev_add_child(pvd, cvd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
zpool list -v testpool | |
zpool iostat -v testpool | |
zpool detach testpool /tmp/disk0.img | |
zpool get size,autoexpand,expandsize testpool | |
zpool list -v testpool | |
zpool iostat -v testpool | |
zdb -C testpool | |
zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
zpool export testpool | |
zpool import -d /tmp testpool | |
zpool get size,autoexpand,expandsize testpool | |
zpool list -v testpool | |
zpool iostat -v testpool | |
rm /tmp/disk0.img | |
rm /tmp/disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n# dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
100+0 records in | |
100+0 records out | |
104857600 bytes transferred in 0.088805 secs (1180762873 bytes/sec) | |
n# dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
200+0 records in | |
200+0 records out | |
209715200 bytes transferred in 0.172674 secs (1214513954 bytes/sec) | |
n# zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
n# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 95K 95.4M 0% 1.00x ONLINE - | |
mirror 95.5M 95K 95.4M - | |
/tmp/disk0.img - - - - | |
/tmp/disk1.img - - - - | |
n# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 95K 95.4M 5 72 5.84K 59.6K | |
mirror 95K 95.4M 5 72 5.84K 59.6K | |
/tmp/disk0.img - - 7 37 16.6K 720K | |
/tmp/disk1.img - - 1 35 10.8K 720K | |
------------------ ----- ----- ----- ----- ----- ----- | |
n# zpool detach testpool /tmp/disk0.img | |
n# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
n# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 146K 95.4M 0% 1.00x ONLINE - | |
/tmp/disk1.img 95.5M 146K 95.4M - | |
n# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 146K 95.4M 0 45 8.00K 719K | |
/tmp/disk1.img 146K 95.4M 0 45 8.00K 719K | |
---------------- ----- ----- ----- ----- ----- ----- | |
n# zdb -C testpool | |
MOS Configuration: | |
version: 5000 | |
name: 'testpool' | |
state: 0 | |
txg: 5 | |
pool_guid: 945875318086749329 | |
hostid: 4266313884 | |
hostname: 'b128' | |
vdev_children: 1 | |
vdev_tree: | |
type: 'root' | |
id: 0 | |
guid: 945875318086749329 | |
create_txg: 4 | |
children[0]: | |
type: 'file' | |
id: 0 | |
guid: 11015525965739841246 | |
path: '/tmp/disk1.img' | |
metaslab_array: 34 | |
metaslab_shift: 19 | |
ashift: 9 | |
asize: 204996608 | |
is_log: 0 | |
create_txg: 4 | |
features_for_read: | |
n# zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
cannot attach /tmp/disk0.img to /tmp/disk1.img: device is too small | |
n# zpool export testpool | |
n# zpool import -d /tmp testpool | |
n# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 196M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
n# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 196M 226K 195M 0% 1.00x ONLINE - | |
/tmp/disk1.img 196M 226K 195M - | |
n# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 226K 195M 46 79 535K 484K | |
/tmp/disk1.img 226K 195M 46 79 535K 484K | |
---------------- ----- ----- ----- ----- ----- ----- | |
n# rm /tmp/disk0.img | |
n# rm /tmp/disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
100+0 records in | |
100+0 records out | |
104857600 bytes (105 MB) copied, 0.19202 s, 546 MB/s | |
# dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
200+0 records in | |
200+0 records out | |
209715200 bytes (210 MB) copied, 4.26921 s, 49.1 MB/s | |
# zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 94K 95.4M 0% 1.00x ONLINE - | |
mirror 95.5M 94K 95.4M - | |
/tmp/disk0.img - - - - | |
/tmp/disk1.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 94K 95.4M 3 39 3.20K 32.3K | |
mirror 94K 95.4M 3 39 3.20K 32.3K | |
/tmp/disk0.img - - 2 29 7.99K 393K | |
/tmp/disk1.img - - 1 27 7.00K 393K | |
------------------ ----- ----- ----- ----- ----- ----- | |
# zpool detach testpool /tmp/disk0.img | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 100M - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 132K 95.4M 0% 1.00x ONLINE - | |
/tmp/disk1.img 95.5M 132K 95.4M 100M | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 132K 95.4M 1 36 6.71K 505K | |
/tmp/disk1.img 132K 95.4M 1 36 6.71K 505K | |
---------------- ----- ----- ----- ----- ----- ----- | |
# zdb -C testpool | |
MOS Configuration: | |
version: 5000 | |
name: 'testpool' | |
state: 0 | |
txg: 5 | |
pool_guid: 3256692784367082335 | |
errata: 0 | |
hostid: 811808865 | |
hostname: 'b15' | |
vdev_children: 1 | |
vdev_tree: | |
type: 'root' | |
id: 0 | |
guid: 3256692784367082335 | |
create_txg: 4 | |
children[0]: | |
type: 'file' | |
id: 0 | |
guid: 10592881425914885316 | |
path: '/tmp/disk1.img' | |
metaslab_array: 34 | |
metaslab_shift: 19 | |
ashift: 9 | |
asize: 100139008 | |
is_log: 0 | |
create_txg: 4 | |
features_for_read: | |
# zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
# zpool export testpool | |
# zpool import -d /tmp testpool | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 232K 95.3M 0% 1.00x ONLINE - | |
mirror 95.5M 232K 95.3M - | |
/tmp/disk1.img - - - - | |
/tmp/disk0.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 232K 95.3M 72 397 78.7K 461K | |
mirror 232K 95.3M 72 397 78.7K 461K | |
/tmp/disk1.img - - 92 308 1.23M 1.59M | |
/tmp/disk0.img - - 72 319 691K 1.59M | |
------------------ ----- ----- ----- ----- ----- ----- | |
# rm /tmp/disk0.img | |
# rm /tmp/disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
100+0 records in | |
100+0 records out | |
104857600 bytes (105 MB) copied, 0.220252 s, 476 MB/s | |
# dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
200+0 records in | |
200+0 records out | |
209715200 bytes (210 MB) copied, 2.62054 s, 80.0 MB/s | |
# zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 94K 95.4M 0% 1.00x ONLINE - | |
mirror 95.5M 94K 95.4M - | |
/tmp/disk0.img - - - - | |
/tmp/disk1.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 94K 95.4M 6 74 6.09K 61.6K | |
mirror 94K 95.4M 6 74 6.09K 61.6K | |
/tmp/disk0.img - - 2 42 13.1K 750K | |
/tmp/disk1.img - - 6 45 15.5K 750K | |
------------------ ----- ----- ----- ----- ----- ----- | |
# zpool detach testpool /tmp/disk0.img | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 100M - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 132K 95.4M 0% 1.00x ONLINE - | |
/tmp/disk1.img 95.5M 132K 95.4M 100M | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 132K 95.4M 5 61 14.7K 958K | |
/tmp/disk1.img 132K 95.4M 5 61 14.7K 958K | |
---------------- ----- ----- ----- ----- ----- ----- | |
# zdb -C testpool | |
MOS Configuration: | |
version: 5000 | |
name: 'testpool' | |
state: 0 | |
txg: 5 | |
pool_guid: 3842628794123118842 | |
errata: 0 | |
hostid: 811808865 | |
hostname: 'b15' | |
vdev_children: 1 | |
vdev_tree: | |
type: 'root' | |
id: 0 | |
guid: 3842628794123118842 | |
create_txg: 4 | |
children[0]: | |
type: 'file' | |
id: 0 | |
guid: 14782448015729639620 | |
path: '/tmp/disk1.img' | |
metaslab_array: 34 | |
metaslab_shift: 19 | |
ashift: 9 | |
asize: 100139008 | |
is_log: 0 | |
create_txg: 4 | |
features_for_read: | |
# zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
# zpool export testpool | |
# zpool import -d /tmp testpool | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 232K 95.3M 0% 1.00x ONLINE - | |
mirror 95.5M 232K 95.3M - | |
/tmp/disk1.img - - - - | |
/tmp/disk0.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 232K 95.3M 105 576 114K 668K | |
mirror 232K 95.3M 105 576 114K 668K | |
/tmp/disk1.img - - 132 460 1.79M 2.31M | |
/tmp/disk0.img - - 128 456 1014K 2.31M | |
------------------ ----- ----- ----- ----- ----- ----- | |
# rm /tmp/disk0.img | |
# rm /tmp/disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
100+0 records in | |
100+0 records out | |
104857600 bytes (105 MB) copied, 0.0831649 s, 1.3 GB/s | |
# dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
200+0 records in | |
200+0 records out | |
209715200 bytes (210 MB) copied, 0.161863 s, 1.3 GB/s | |
# zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 136K 95.4M 0% 1.00x ONLINE - | |
mirror 95.5M 136K 95.4M - | |
/tmp/disk0.img - - - - | |
/tmp/disk1.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 136K 95.4M 2 36 2.58K 33.1K | |
mirror 136K 95.4M 2 36 2.58K 33.1K | |
/tmp/disk0.img - - 3 19 6.46K 271K | |
/tmp/disk1.img - - 0 20 3.88K 271K | |
------------------ ----- ----- ----- ----- ----- ----- | |
# zpool detach testpool /tmp/disk0.img | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 172K 95.3M 0% 1.00x ONLINE - | |
/tmp/disk1.img 95.5M 172K 95.3M - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 172K 95.3M 0 30 3.84K 356K | |
/tmp/disk1.img 172K 95.3M 0 30 3.84K 356K | |
---------------- ----- ----- ----- ----- ----- ----- | |
# zdb -C testpool | |
MOS Configuration: | |
version: 5000 | |
name: 'testpool' | |
state: 0 | |
txg: 6 | |
pool_guid: 15451571592932472266 | |
errata: 0 | |
hostid: 811808865 | |
hostname: 'b1' | |
vdev_children: 1 | |
vdev_tree: | |
type: 'root' | |
id: 0 | |
guid: 15451571592932472266 | |
create_txg: 4 | |
children[0]: | |
type: 'file' | |
id: 0 | |
guid: 11218347111503734635 | |
path: '/tmp/disk1.img' | |
metaslab_array: 34 | |
metaslab_shift: 19 | |
ashift: 9 | |
asize: 204996608 | |
is_log: 0 | |
create_txg: 4 | |
features_for_read: | |
# zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
cannot attach /tmp/disk0.img to /tmp/disk1.img: device is too small | |
# zpool export testpool | |
# zpool import -d /tmp testpool | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 196M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT | |
testpool 196M 224K 195M 0% 1.00x ONLINE - | |
/tmp/disk1.img 196M 224K 195M - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 224K 195M 33 74 337K 434K | |
/tmp/disk1.img 224K 195M 33 74 337K 434K | |
---------------- ----- ----- ----- ----- ----- ----- | |
# rm /tmp/disk0.img | |
# rm /tmp/disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dd if=/dev/zero of=/tmp/disk0.img bs=1024k count=100 | |
100+0 records in | |
100+0 records out | |
104857600 bytes (105 MB) copied, 0.229782 s, 456 MB/s | |
# dd if=/dev/zero of=/tmp/disk1.img bs=1024k count=200 | |
200+0 records in | |
200+0 records out | |
209715200 bytes (210 MB) copied, 0.447176 s, 469 MB/s | |
# zpool create -o autoexpand=off -f testpool mirror /tmp/disk0.img /tmp/disk1.img | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 98K 95.4M - 0% 1.00x ONLINE - | |
mirror 95.5M 98K 95.4M - | |
/tmp/disk0.img - - - - | |
/tmp/disk1.img - - - - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
------------------ ----- ----- ----- ----- ----- ----- | |
testpool 98K 95.4M 126 1.58K 126K 1.30M | |
mirror 98K 95.4M 126 1.58K 126K 1.30M | |
/tmp/disk0.img - - 155 1.21K 359K 15.2M | |
/tmp/disk1.img - - 29 1.18K 233K 15.2M | |
------------------ ----- ----- ----- ----- ----- ----- | |
# zpool detach testpool /tmp/disk0.img | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 95.5M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT | |
testpool 95.5M 127K 95.4M - 0% 1.00x ONLINE - | |
/tmp/disk1.img 95.5M 127K 95.4M - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 127K 95.4M 0 9 1.24K 111K | |
/tmp/disk1.img 127K 95.4M 0 9 1.24K 111K | |
---------------- ----- ----- ----- ----- ----- ----- | |
# zdb -C testpool | |
MOS Configuration: | |
version: 5000 | |
name: 'testpool' | |
state: 0 | |
txg: 5 | |
pool_guid: 7233223188389232776 | |
hostid: 671258575 | |
hostname: 'b34' | |
vdev_children: 1 | |
vdev_tree: | |
type: 'root' | |
id: 0 | |
guid: 7233223188389232776 | |
create_txg: 4 | |
children[0]: | |
type: 'file' | |
id: 0 | |
guid: 6091055817467263486 | |
path: '/tmp/disk1.img' | |
metaslab_array: 35 | |
metaslab_shift: 19 | |
ashift: 9 | |
asize: 204996608 | |
is_log: 0 | |
create_txg: 4 | |
features_for_read: | |
com.delphix:hole_birth | |
# zpool attach testpool /tmp/disk1.img /tmp/disk0.img | |
cannot attach /tmp/disk0.img to /tmp/disk1.img: device is too small | |
# zpool export testpool | |
# zpool import -d /tmp testpool | |
# zpool get size,autoexpand,expandsize testpool | |
NAME PROPERTY VALUE SOURCE | |
testpool size 196M - | |
testpool autoexpand off default | |
testpool expandsize 0 - | |
# zpool list -v testpool | |
NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT | |
testpool 196M 205K 195M - 0% 1.00x ONLINE - | |
/tmp/disk1.img 196M 205K 195M - | |
# zpool iostat -v testpool | |
capacity operations bandwidth | |
pool alloc free read write read write | |
---------------- ----- ----- ----- ----- ----- ----- | |
testpool 205K 195M 626 1.61K 8.54M 10.9M | |
/tmp/disk1.img 205K 195M 626 1.61K 8.54M 10.9M | |
---------------- ----- ----- ----- ----- ----- ----- | |
# rm /tmp/disk0.img | |
# rm /tmp/disk1.img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment