]> git.proxmox.com Git - mirror_zfs.git/commit
vs_alloc can underflow in L2ARC vdevs
authorSerapheim Dimitropoulos <serapheimd@gmail.com>
Thu, 31 Jan 2019 17:16:39 +0000 (09:16 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 31 Jan 2019 17:16:39 +0000 (09:16 -0800)
commit7558997d2f808368867ca7e5234e5793446e8f3f
tree614b9c030c4bd3542a0a97051b515d17789b49bc
parent2747f599ff322ddafbfef79813e63624d04fb7aa
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
module/zfs/arc.c
module/zfs/vdev.c