svn commit: r229666 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Martin Matuska mm at FreeBSD.org
Thu Jan 5 22:31:25 UTC 2012


Author: mm
Date: Thu Jan  5 22:31:25 2012
New Revision: 229666
URL: http://svn.freebsd.org/changeset/base/229666

Log:
  MFC r226617 (pjd):
  
  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.
  
  Submitted by:	avg

Modified:
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Thu Jan  5 22:29:11 2012	(r229665)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Thu Jan  5 22:31:25 2012	(r229666)
@@ -153,17 +153,19 @@ static int
 vdev_file_io_start(zio_t *zio)
 {
 	vdev_t *vd = zio->io_vd;
-	vdev_file_t *vf = vd->vdev_tsd;
-	vnode_t *vp = vf->vf_vnode;
+	vdev_file_t *vf;
+	vnode_t *vp;
 	ssize_t resid;
 
-	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;
+	vp = vf->vf_vnode;
 
+	if (zio->io_type == ZIO_TYPE_IOCTL) {
 		switch (zio->io_cmd) {
 		case DKIOCFLUSHWRITECACHE:
 			zio->io_error = VOP_FSYNC(vp, FSYNC | FDSYNC,


More information about the svn-src-all mailing list