summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2017-09-19 09:02:26 +0000
committeravg <avg@FreeBSD.org>2017-09-19 09:02:26 +0000
commit07f548a13f029bdc62304e7b089daaf02f14a101 (patch)
tree5ee7ee00156fad6166639fd545bd66b0f0665ba5
parente81e575e6915023101275fe7c3aac07ae4e0e9d9 (diff)
downloadFreeBSD-src-07f548a13f029bdc62304e7b089daaf02f14a101.zip
FreeBSD-src-07f548a13f029bdc62304e7b089daaf02f14a101.tar.gz
MFC r322239: MFV r322238: 7915 checks in l2arc_evict could use some cleaning up
illumos/illumos-gate@267ae6c3a88d2fc39276af66caafa978b0935b82 https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82 https://www.illumos.org/issues/7915 l2arc_evict() is strictly serialized with respect to l2arc_write_buffers() and l2arc_write_done(). Normally, l2arc_evict() and l2arc_write_buffers() are called from the same thread, so they can not be concurrent. Also, l2arc_write_buffers() uses zio_wait() on the parent zio of all cache zio-s. That ensures that l2arc_write_done() is completed before l2arc_write_buffers() returns. Finally, if a cache device is removed, then l2arc_evict() is called under SCL_ALL in the exclusive mode. That ensures that it can not be concurrent with the normal L2ARC accesses to the device (including writing and evicting buffers). Given the above, some checks and actions in l2arc_evict() do not make sense. For instance, it must never encounter the write head header let alone remove it from the buffer list. Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Prakash Surya <prakash.surya@delphix.com> Approved by: Matthew Ahrens <mahrens@delphix.com> Author: Andriy Gapon <avg@FreeBSD.org>
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index daa3f26..2909032 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -7314,18 +7314,16 @@ top:
goto top;
}
- if (HDR_L2_WRITE_HEAD(hdr)) {
- /*
- * We hit a write head node. Leave it for
- * l2arc_write_done().
- */
- list_remove(buflist, hdr);
- mutex_exit(hash_lock);
- continue;
- }
+ /*
+ * A header can't be on this list if it doesn't have L2 header.
+ */
+ ASSERT(HDR_HAS_L2HDR(hdr));
- if (!all && HDR_HAS_L2HDR(hdr) &&
- (hdr->b_l2hdr.b_daddr >= taddr ||
+ /* Ensure this header has finished being written. */
+ ASSERT(!HDR_L2_WRITING(hdr));
+ ASSERT(!HDR_L2_WRITE_HEAD(hdr));
+
+ if (!all && (hdr->b_l2hdr.b_daddr >= taddr ||
hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
/*
* We've evicted to the target address,
@@ -7335,7 +7333,6 @@ top:
break;
}
- ASSERT(HDR_HAS_L2HDR(hdr));
if (!HDR_HAS_L1HDR(hdr)) {
ASSERT(!HDR_L2_READING(hdr));
/*
@@ -7358,9 +7355,6 @@ top:
arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED);
}
- /* Ensure this header has finished being written */
- ASSERT(!HDR_L2_WRITING(hdr));
-
arc_hdr_l2hdr_destroy(hdr);
}
mutex_exit(hash_lock);
OpenPOWER on IntegriCloud