]> granicus.if.org Git - zfs/commit
Fix l2arc_evict() destroy race
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 15 Mar 2019 21:17:38 +0000 (14:17 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Mar 2019 21:17:38 +0000 (14:17 -0700)
commitca6c7a94c994b9979824f8fccf1c6ddb00ee5598
tree76d92999e29eb08b94f4a4c04f5efff742b6ccfc
parentab7615d92c9bf4bdbbc6a675724b763d16f05280
Fix l2arc_evict() destroy race

When destroying an arc_buf_hdr_t its identity cannot be discarded
until it is entirely undiscoverable.  This not only includes being
unhashed, but also being removed from the l2arc header list.
Discarding the header's identify prematurely renders the hash
lock useless because it will always hash to bucket zero.

This change resolves a race with l2arc_evict() by discarding the
identity after it has been removed from the l2arc header list.
This ensures either the header is not on the list or contains
the correct identify.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7688
Closes #8144
module/zfs/arc.c