]> granicus.if.org Git - zfs/commit
Illumos #1661: Fix flaw in sa_find_sizes() calculation
authorXin Li <delphij@FreeBSD.org>
Fri, 21 Oct 2011 23:39:53 +0000 (16:39 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 24 Oct 2011 16:57:52 +0000 (09:57 -0700)
commitc47516762758c989a443c0a6a9e38ae8fb46e6f1
tree322102432cc80e701000ed47668d3857e5250b00
parent3cee2262a6efd06031a2ff511f66e6a51f743e6a
Illumos #1661: Fix flaw in sa_find_sizes() calculation

When calculating space needed for SA_BONUS buffers, hdrsize is
always rounded up to next 8-aligned boundary. However, in two places
the round up was done against sum of 'total' plus hdrsize. On the
other hand, hdrsize increments by 4 each time, which means in certain
conditions, we would end up returning with will_spill == 0 and
(total + hdrsize) larger than full_space, leading to a failed
assertion because it's invalid for dmu_set_bonus.

Reviewed by: Matthew Ahrens <matt@delphix.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Approved by: Gordon Ross <gwr@nexenta.com>

References to Illumos issue:
  https://www.illumos.org/issues/1661

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #426
module/zfs/sa.c