Illumos #1680: zfs vdev_file_io_start: validate vdev before using vdev_tsd
vdev_tsd can be NULL for certain vdev states. At least in userland testing with ztest. References to Illumos issue: https://www.illumos.org/issues/1680 Ported-by: Richard Yao <ryao@cs.stonybrook.edu> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #655
This commit is contained in:
parent
109491a897
commit
3adfc400f5
|
@ -141,16 +141,17 @@ static int
|
||||||
vdev_file_io_start(zio_t *zio)
|
vdev_file_io_start(zio_t *zio)
|
||||||
{
|
{
|
||||||
vdev_t *vd = zio->io_vd;
|
vdev_t *vd = zio->io_vd;
|
||||||
vdev_file_t *vf = vd->vdev_tsd;
|
vdev_file_t *vf;
|
||||||
ssize_t resid = 0;
|
ssize_t resid = 0;
|
||||||
|
|
||||||
if (zio->io_type == ZIO_TYPE_IOCTL) {
|
if (!vdev_readable(vd)) {
|
||||||
/* XXPOLICY */
|
zio->io_error = ENXIO;
|
||||||
if (!vdev_readable(vd)) {
|
return (ZIO_PIPELINE_CONTINUE);
|
||||||
zio->io_error = ENXIO;
|
}
|
||||||
return (ZIO_PIPELINE_CONTINUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vf = vd->vdev_tsd;
|
||||||
|
|
||||||
|
if (zio->io_type == ZIO_TYPE_IOCTL) {
|
||||||
switch (zio->io_cmd) {
|
switch (zio->io_cmd) {
|
||||||
case DKIOCFLUSHWRITECACHE:
|
case DKIOCFLUSHWRITECACHE:
|
||||||
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
|
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
|
||||||
|
|
Loading…
Reference in New Issue