| 5656 | } |
| 5657 | |
| 5658 | static void |
| 5659 | arc_read_done(zio_t *zio) |
| 5660 | { |
| 5661 | blkptr_t *bp = zio->io_bp; |
| 5662 | arc_buf_hdr_t *hdr = zio->io_private; |
| 5663 | kmutex_t *hash_lock = NULL; |
| 5664 | arc_callback_t *callback_list; |
| 5665 | arc_callback_t *acb; |
| 5666 | boolean_t freeable = B_FALSE; |
| 5667 | |
| 5668 | /* |
| 5669 | * The hdr was inserted into hash-table and removed from lists |
| 5670 | * prior to starting I/O. We should find this header, since |
| 5671 | * it's in the hash table, and it should be legit since it's |
| 5672 | * not possible to evict it during the I/O. The only possible |
| 5673 | * reason for it not to be found is if we were freed during the |
| 5674 | * read. |
| 5675 | */ |
| 5676 | if (HDR_IN_HASH_TABLE(hdr)) { |
| 5677 | arc_buf_hdr_t *found; |
| 5678 | |
| 5679 | ASSERT3U(hdr->b_birth, ==, BP_PHYSICAL_BIRTH(zio->io_bp)); |
| 5680 | ASSERT3U(hdr->b_dva.dva_word[0], ==, |
| 5681 | BP_IDENTITY(zio->io_bp)->dva_word[0]); |
| 5682 | ASSERT3U(hdr->b_dva.dva_word[1], ==, |
| 5683 | BP_IDENTITY(zio->io_bp)->dva_word[1]); |
| 5684 | |
| 5685 | found = buf_hash_find(hdr->b_spa, zio->io_bp, &hash_lock); |
| 5686 | |
| 5687 | ASSERT((found == hdr && |
| 5688 | DVA_EQUAL(&hdr->b_dva, BP_IDENTITY(zio->io_bp))) || |
| 5689 | (found == hdr && HDR_L2_READING(hdr))); |
| 5690 | ASSERT3P(hash_lock, !=, NULL); |
| 5691 | } |
| 5692 | |
| 5693 | if (BP_IS_PROTECTED(bp)) { |
| 5694 | hdr->b_crypt_hdr.b_ot = BP_GET_TYPE(bp); |
| 5695 | hdr->b_crypt_hdr.b_dsobj = zio->io_bookmark.zb_objset; |
| 5696 | zio_crypt_decode_params_bp(bp, hdr->b_crypt_hdr.b_salt, |
| 5697 | hdr->b_crypt_hdr.b_iv); |
| 5698 | |
| 5699 | if (BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) { |
| 5700 | void *tmpbuf; |
| 5701 | |
| 5702 | tmpbuf = abd_borrow_buf_copy(zio->io_abd, |
| 5703 | sizeof (zil_chain_t)); |
| 5704 | zio_crypt_decode_mac_zil(tmpbuf, |
| 5705 | hdr->b_crypt_hdr.b_mac); |
| 5706 | abd_return_buf(zio->io_abd, tmpbuf, |
| 5707 | sizeof (zil_chain_t)); |
| 5708 | } else { |
| 5709 | zio_crypt_decode_mac_bp(bp, hdr->b_crypt_hdr.b_mac); |
| 5710 | } |
| 5711 | } |
| 5712 | |
| 5713 | if (zio->io_error == 0) { |
| 5714 | /* byteswap if necessary */ |
| 5715 | if (BP_SHOULD_BYTESWAP(zio->io_bp)) { |
no test coverage detected