Browse files

Fix zio leak in dbuf_read()

Currently, dbuf_read() may decide to create a zio_root which is
used as a parent for any child zios created in dbuf_read_impl().
However, if there is an error in dbuf_read_impl(), this zio is
never executed and ends up leaked. This patch simply ensures
that we always execute the root zio, even i it has no real work
to do.

Signed-off-by: Tom Caputi <>
  • Loading branch information...
tcaputi committed Jan 11, 2019
1 parent 8bd2a28 commit 04c37fcc12b045b4e5358c297b809992d3b9a2a3
Showing with 11 additions and 2 deletions.
  1. +11 −2 module/zfs/dbuf.c
@@ -1565,8 +1565,17 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)

if (!err && need_wait)
err = zio_wait(zio);
* If we created a zio_root we must execute it to avoid
* leaking it, even if it isnt attached to any work due
* to an error in dbuf_read_impl().
if (need_wait) {
if (err == 0)
err = zio_wait(zio);
} else {
* Another reader came in while the dbuf was in flight

0 comments on commit 04c37fc

Please sign in to comment.