Beispiel #1
0
static int
vdev_file_io_done(zio_t *zio)
{
	vdev_t *vd = zio->io_vd;

	if (zio_injection_enabled && zio->io_error == 0)
		zio->io_error = zio_handle_device_injection(vd, EIO);

	/*
	 * If an error has been encountered then attempt to probe the device
	 * to determine if it's still accessible.
	 */
	if (zio->io_error == EIO && vdev_probe(vd) != 0) {
		if (!vd->vdev_is_failing) {
			vd->vdev_is_failing = B_TRUE;
			zfs_ereport_post(FM_EREPORT_ZFS_PROBE_FAILURE,
			    vd->vdev_spa, vd, zio, 0, 0);
		}
	}

	vdev_queue_io_done(zio);

	if (zio->io_type == ZIO_TYPE_WRITE)
		vdev_cache_write(zio);

	return (ZIO_PIPELINE_CONTINUE);
}
Beispiel #2
0
static void
vdev_file_io_done(zio_t *zio)
{
	vdev_queue_io_done(zio);

#ifndef _KERNEL
	if (zio->io_type == ZIO_TYPE_WRITE)
		vdev_cache_write(zio);
#endif

	if (zio_injection_enabled && zio->io_error == 0)
		zio->io_error = zio_handle_device_injection(zio->io_vd, EIO);

	zio_next_stage(zio);
}
Beispiel #3
0
static int
vdev_file_probe_io(vdev_t *vd, caddr_t data, size_t size, uint64_t offset,
    enum uio_rw rw)
{
	vdev_file_t *vf = vd ? vd->vdev_tsd : NULL;
	ssize_t resid;
	int error = 0;

	if (vd == NULL || vf == NULL || vf->vf_vnode == NULL)
		return (EINVAL);

	ASSERT(rw == UIO_READ || rw ==  UIO_WRITE);

	error = vn_rdwr(rw, vf->vf_vnode, data, size, offset, UIO_SYSSPACE,
	    0, RLIM64_INFINITY, kcred, &resid);

	if (error || resid != 0)
		return (EIO);

	if (zio_injection_enabled)
		error = zio_handle_device_injection(vd, EIO);

	return (error);
}