diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index d6a9f813c2..9b8fc7e49b 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -357,8 +357,10 @@ int dmu_bonus_hold_by_dnode(dnode_t *dn, const void *tag, dmu_buf_t **dbp, rw_enter(&dn->dn_struct_rwlock, RW_READER); if (dn->dn_bonus == NULL) { - rw_exit(&dn->dn_struct_rwlock); - rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + if (!rw_tryupgrade(&dn->dn_struct_rwlock)) { + rw_exit(&dn->dn_struct_rwlock); + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + } if (dn->dn_bonus == NULL) dbuf_create_bonus(dn); }