1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-31 16:57:10 +00:00

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
This commit is contained in:
Pawel Jakub Dawidek 2011-10-21 14:00:48 +00:00
parent 2128d22f17
commit b39ba076ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226617

View File

@ -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,