aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-05-26 11:30:55 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-05-26 11:30:55 +0000
commit9c2a3c861fc2cd6372d911d62e1fedd298f4cd03 (patch)
treeb76223f499af6c78e1020e70bd706121d890703f
parentebaf416f9518ac02adbd54a517ea96b74a9b932c (diff)
parent1c42c71f38d4748c7ad459b304c1f2f761527891 (diff)
Notes
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
index 06ecd3cc254e..ac70c1f565f5 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
@@ -1088,7 +1088,6 @@ int
dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
{
int err = 0;
- boolean_t havepzio = (zio != NULL);
boolean_t prefetch;
dnode_t *dn;
@@ -1132,9 +1131,13 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
DB_DNODE_EXIT(db);
} else if (db->db_state == DB_UNCACHED) {
spa_t *spa = dn->dn_objset->os_spa;
+ boolean_t need_wait = B_FALSE;
- if (zio == NULL)
+ if (zio == NULL &&
+ db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) {
zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL);
+ need_wait = B_TRUE;
+ }
dbuf_read_impl(db, zio, flags);
/* dbuf_read_impl has dropped db_mtx for us */
@@ -1146,7 +1149,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
rw_exit(&dn->dn_struct_rwlock);
DB_DNODE_EXIT(db);
- if (!havepzio)
+ if (need_wait)
err = zio_wait(zio);
} else {
/*
@@ -1181,7 +1184,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
mutex_exit(&db->db_mtx);
}
- ASSERT(err || havepzio || db->db_state == DB_CACHED);
return (err);
}