DMU: Fix lock leak on dbuf_hold() error

dmu_assign_arcbuf_by_dnode() should drop dn_struct_rwlock lock in
case dbuf_hold() failed.  I don't have reproduction for this, but
it looks inconsistent with dmu_buf_hold_noread_by_dnode() and co.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15644
This commit is contained in:
Alexander Motin 2023-12-08 19:43:39 -05:00 committed by Brian Behlendorf
parent e09356fa05
commit b13c91bb29
1 changed files with 1 additions and 1 deletions

View File

@ -1482,9 +1482,9 @@ dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset, arc_buf_t *buf,
rw_enter(&dn->dn_struct_rwlock, RW_READER); rw_enter(&dn->dn_struct_rwlock, RW_READER);
blkid = dbuf_whichblock(dn, 0, offset); blkid = dbuf_whichblock(dn, 0, offset);
db = dbuf_hold(dn, blkid, FTAG); db = dbuf_hold(dn, blkid, FTAG);
rw_exit(&dn->dn_struct_rwlock);
if (db == NULL) if (db == NULL)
return (SET_ERROR(EIO)); return (SET_ERROR(EIO));
rw_exit(&dn->dn_struct_rwlock);
/* /*
* We can only assign if the offset is aligned and the arc buf is the * We can only assign if the offset is aligned and the arc buf is the