svn commit: r226617 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Oct 21 14:00:49 UTC 2011


Author: pjd
Date: Fri Oct 21 14:00:48 2011
New Revision: 226617
URL: http://svn.freebsd.org/changeset/base/226617

Log:
  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
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Fri Oct 21 13:56:17 2011	(r226616)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Fri Oct 21 14:00:48 2011	(r226617)
@@ -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-head mailing list