diff options
author | Ned Bass <[email protected]> | 2010-10-04 13:08:24 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-10-04 13:53:18 -0700 |
commit | 3a7381e531f55929f894fa2e81b79e1980de6f22 (patch) | |
tree | 39f5e359b145641e5025fc8ad859c41c5255030d /lib | |
parent | 0151834d65bb05f02a43c7f1b6128030aa3e76c4 (diff) |
Use stored whole_disk property when opening a vdev
This commit fixes a bug in vdev_disk_open() in which the whole_disk property
was getting set to 0 for disk devices, even when it was stored as a 1 when the
zpool was created. The whole_disk property lets us detect when the partition
suffix should be stripped from the device name in CLI output. It is also used
to determine how writeback cache should be set for a device.
When an existing zpool is imported its configuration is read from the vdev
label by user space in zpool_read_label(). The whole_disk property is saved in
the nvlist which gets passed into the kernel, where it in turn gets saved in
the vdev struct in vdev_alloc(). Therefore, this value is available in
vdev_disk_open() and should not be overridden by checking the provided device
path, since that path will likely point to a partition and the check will
return the wrong result.
We also add an ASSERT that the whole_disk property is set. We are not aware of
any cases where vdev_disk_open() should be called with a config that doesn't
have this property set. The ASSERT is there so that when debugging is enabled
we can identify any legitimate cases that we are missing. If we never hit the
ASSERT, we can at some point remove it along with the conditional whole_disk
check.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions