Print this page
5047 don't use atomic_*_nv if you discard the return value

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dmu.c
          +++ new/usr/src/uts/common/fs/zfs/dmu.c
↓ open down ↓ 276 lines elided ↑ open up ↑
 277  277                  rw_exit(&dn->dn_struct_rwlock);
 278  278                  rw_enter(&dn->dn_struct_rwlock, RW_WRITER);
 279  279                  if (dn->dn_bonus == NULL)
 280  280                          dbuf_create_bonus(dn);
 281  281          }
 282  282          db = dn->dn_bonus;
 283  283  
 284  284          /* as long as the bonus buf is held, the dnode will be held */
 285  285          if (refcount_add(&db->db_holds, tag) == 1) {
 286  286                  VERIFY(dnode_add_ref(dn, db));
 287      -                (void) atomic_inc_32_nv(&dn->dn_dbufs_count);
      287 +                atomic_inc_32(&dn->dn_dbufs_count);
 288  288          }
 289  289  
 290  290          /*
 291  291           * Wait to drop dn_struct_rwlock until after adding the bonus dbuf's
 292  292           * hold and incrementing the dbuf count to ensure that dnode_move() sees
 293  293           * a dnode hold for every dbuf.
 294  294           */
 295  295          rw_exit(&dn->dn_struct_rwlock);
 296  296  
 297  297          dnode_rele(dn, FTAG);
↓ open down ↓ 1616 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX