]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/arc.c
Avoid panic in case of pool errors and missing L2ARC
authorGeorge Amanakis <gamanakis@gmail.com>
Thu, 16 Sep 2021 16:40:15 +0000 (18:40 +0200)
committerGitHub <noreply@github.com>
Thu, 16 Sep 2021 16:40:15 +0000 (09:40 -0700)
commit2a49ebbb4dd0799ffa4fcb4043220a0f992aa68c
tree77d3e0df1a34c25d3e3b66593c3d52bf19a4a16b
parent6065740811896f47277580820f4276b6d847d6f9
Avoid panic in case of pool errors and missing L2ARC

In case an ARC buffer is allocated only on L2ARC, and there are
underlying errors in a pool with the cache device in faulty state, a
panic can occur in arc_read_done()->arc_hdr_destroy()->
arc_hdr_l2arc_destroy()->arc_hdr_clear_flags() when trying to free
the ARC buffer.

Fix this by discarding the buffer's identity in arc_hdr_destroy(), in
case the buffer is not empty, before calling arc_hdr_l2hdr_destroy().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #12392
module/zfs/arc.c