HomeFreeBSD

vs_alloc can underflow in L2ARC vdevs

Description

vs_alloc can underflow in L2ARC vdevs

The current L2 ARC device code consistently uses psize to
increment vs_alloc but varies between psize and lsize when
decrementing it. The result of this behavior is that
vs_alloc can be decremented more that it is incremented
and underflow. This patch changes the code so asize is
used anywhere.

In addition, it ensures that vs_alloc gets incremented by
the L2 ARC device code as buffers are written and not at
the end of the l2arc_write_buffers() routine. The latter
(and old) way would temporarily underflow vs_alloc as
buffers that were just written, would be destroyed while
l2arc_write_buffers() was still looping.

Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #8298

Details

Provenance
Serapheim Dimitropoulos <serapheimd@gmail.com>Authored on Jan 31 2019, 5:16 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 31 2019, 5:16 PM
Parents
rG2747f599ff32: Don't acquire zthr_request_lock in zthr_wakeup
Branches
Unknown
Tags
Unknown