Print this page
6220 memleak in l2arc on debug build


1284                 ASSERT0(hdr->b_l1hdr.b_datacnt);
1285 
1286                 /*
1287                  * If we've reached here, We must have been called from
1288                  * arc_evict_hdr(), as such we should have already been
1289                  * removed from any ghost list we were previously on
1290                  * (which protects us from racing with arc_evict_state),
1291                  * thus no locking is needed during this check.
1292                  */
1293                 ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node));
1294 
1295                 /*
1296                  * A buffer must not be moved into the arc_l2c_only
1297                  * state if it's not finished being written out to the
1298                  * l2arc device. Otherwise, the b_l1hdr.b_tmp_cdata field
1299                  * might try to be accessed, even though it was removed.
1300                  */
1301                 VERIFY(!HDR_L2_WRITING(hdr));
1302                 VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL);
1303 







1304                 nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR;
1305         }
1306         /*
1307          * The header has been reallocated so we need to re-insert it into any
1308          * lists it was on.
1309          */
1310         (void) buf_hash_insert(nhdr, NULL);
1311 
1312         ASSERT(list_link_active(&hdr->b_l2hdr.b_l2node));
1313 
1314         mutex_enter(&dev->l2ad_mtx);
1315 
1316         /*
1317          * We must place the realloc'ed header back into the list at
1318          * the same spot. Otherwise, if it's placed earlier in the list,
1319          * l2arc_write_buffers() could find it during the function's
1320          * write phase, and try to write it out to the l2arc.
1321          */
1322         list_insert_after(&dev->l2ad_buflist, hdr, nhdr);
1323         list_remove(&dev->l2ad_buflist, hdr);




1284                 ASSERT0(hdr->b_l1hdr.b_datacnt);
1285 
1286                 /*
1287                  * If we've reached here, We must have been called from
1288                  * arc_evict_hdr(), as such we should have already been
1289                  * removed from any ghost list we were previously on
1290                  * (which protects us from racing with arc_evict_state),
1291                  * thus no locking is needed during this check.
1292                  */
1293                 ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node));
1294 
1295                 /*
1296                  * A buffer must not be moved into the arc_l2c_only
1297                  * state if it's not finished being written out to the
1298                  * l2arc device. Otherwise, the b_l1hdr.b_tmp_cdata field
1299                  * might try to be accessed, even though it was removed.
1300                  */
1301                 VERIFY(!HDR_L2_WRITING(hdr));
1302                 VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL);
1303 
1304 #ifdef ZFS_DEBUG
1305                 if (hdr->b_l1hdr.b_thawed != NULL) {
1306                         kmem_free(hdr->b_l1hdr.b_thawed, 1);
1307                         hdr->b_l1hdr.b_thawed = NULL;
1308                 }
1309 #endif
1310 
1311                 nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR;
1312         }
1313         /*
1314          * The header has been reallocated so we need to re-insert it into any
1315          * lists it was on.
1316          */
1317         (void) buf_hash_insert(nhdr, NULL);
1318 
1319         ASSERT(list_link_active(&hdr->b_l2hdr.b_l2node));
1320 
1321         mutex_enter(&dev->l2ad_mtx);
1322 
1323         /*
1324          * We must place the realloc'ed header back into the list at
1325          * the same spot. Otherwise, if it's placed earlier in the list,
1326          * l2arc_write_buffers() could find it during the function's
1327          * write phase, and try to write it out to the l2arc.
1328          */
1329         list_insert_after(&dev->l2ad_buflist, hdr, nhdr);
1330         list_remove(&dev->l2ad_buflist, hdr);