mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 18:34:22 +03:00
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. Reviewed-by: Matt Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #8267
This commit is contained in:
parent
7b02fae7a6
commit
5e7f3ace58
@ -1565,8 +1565,17 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags)
|
|||||||
DB_DNODE_EXIT(db);
|
DB_DNODE_EXIT(db);
|
||||||
DBUF_STAT_BUMP(hash_misses);
|
DBUF_STAT_BUMP(hash_misses);
|
||||||
|
|
||||||
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 isn't attached to any work due
|
||||||
|
* to an error in dbuf_read_impl().
|
||||||
|
*/
|
||||||
|
if (need_wait) {
|
||||||
|
if (err == 0)
|
||||||
|
err = zio_wait(zio);
|
||||||
|
else
|
||||||
|
VERIFY0(zio_wait(zio));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Another reader came in while the dbuf was in flight
|
* Another reader came in while the dbuf was in flight
|
||||||
|
Loading…
Reference in New Issue
Block a user