Skip to content
Browse files

Illumos #1680: zfs vdev_file_io_start: validate vdev before using vde…

…v_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
  • Loading branch information...
1 parent 109491a commit 3adfc400f5f6c8b24b825cbe91c14b7d58f3c7fc @avg-I avg-I committed with Apr 9, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 module/zfs/vdev_file.c
View
15 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,

0 comments on commit 3adfc40

Please sign in to comment.
Something went wrong with that request. Please try again.