On Thu, Jan 30, 2014 at 11:44 PM, Andriy Gapon <a...@freebsd.org> wrote:
> on 31/01/2014 07:57 Matthew Ahrens said the following: > > On Thu, Jan 30, 2014 at 2:02 AM, Andriy Gapon <a...@freebsd.org > > <mailto:a...@freebsd.org>> wrote: > > > > > > I can not figure out how the following code actually works. > > Probably I am missing something in the big picture (again). > > > > if (HDR_L2_WRITE_HEAD(ab)) { > > /* > > * We hit a write head node. Leave it for > > * l2arc_write_done(). > > */ > > list_remove(buflist, ab); > > mutex_exit(hash_lock); > > continue; > > } > > > > So, the write head is left in memory, but it is still removed from > l2ad_buflist. > > Supposing there is a corresponding L2 write zio in progress there > will be a call > > to l2arc_write_done() with l2wcb_head pointing to the head. > > Wouldn't > > list_prev(buflist, head) > > result in an illegal memory access if head is not on buflist? > > > > > > Yes, it would. Thankfully, we don't call list_prev() after removing it. > The > > loop in l2arc_evict() begins with: > > > > for (ab = list_tail(buflist); ab; ab = ab_prev) { > > ab_prev = list_prev(buflist, ab); > > Apologies for not being clear, I actually meant the loop in > l2arc_write_done(). > > l2arc_buflist_mtx should prevent that. --matt
_______________________________________________ developer mailing list developer@open-zfs.org http://lists.open-zfs.org/mailman/listinfo/developer