Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2012 22:31:25 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229666 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201201052231.q05MVP9J059308@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201052231.q05MVP9J059308>