diff options
author | Andriy Gapon <[email protected]> | 2012-04-09 13:01:46 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-04-11 11:23:18 -0700 |
commit | 3adfc400f5f6c8b24b825cbe91c14b7d58f3c7fc (patch) | |
tree | 06a674c3a2a41a9ea794ebe76c41a69327360fbd /module/zfs/vdev_file.c | |
parent | 109491a8976ec6f3fef74ee16bc16f64c34332af (diff) |
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #655
Diffstat (limited to 'module/zfs/vdev_file.c')
-rw-r--r-- | module/zfs/vdev_file.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c index bbc85e733..ce49fe08f 100644 --- a/module/zfs/vdev_file.c +++ b/module/zfs/vdev_file.c @@ -141,16 +141,17 @@ static int vdev_file_io_start(zio_t *zio) { vdev_t *vd = zio->io_vd; - vdev_file_t *vf = vd->vdev_tsd; + vdev_file_t *vf; ssize_t resid = 0; - if (zio->io_type == ZIO_TYPE_IOCTL) { - /* XXPOLICY */ - if (!vdev_readable(vd)) { - zio->io_error = ENXIO; - return (ZIO_PIPELINE_CONTINUE); - } + if (!vdev_readable(vd)) { + zio->io_error = ENXIO; + return (ZIO_PIPELINE_CONTINUE); + } + vf = vd->vdev_tsd; + + if (zio->io_type == ZIO_TYPE_IOCTL) { switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, |