On Mon, Nov 25, 2013 at 07:50:49PM +1100, Dave Chinner wrote:
> Yeah, you can't use the freelist structure like that - it's a
> linked, which you copy the freelist structure when logging the
> EFI/EFD, and then free the items on the linked list. Then when
> formatting the structure, you walk the list attached to the copy of
> the freelist structure, which has alreayd been freed.
> Basically, we've got a bunch of nasty life cycle issues around the
> EFI/EFD that need to be fixed. Firstly, the EFD code assumes that
> the EFI always outlives it, but we don't take a reference when we
> connect the EFD to the EFI - the EFI is created with the reference
> for the EFD already added to it. Then in abort cases we simply free
> the EFI, even though there may be an EFD that still references it...
> So I think that this needs to be fixed up before you can even
> consider sharing something like a reference counted freelist
> structure between the EFI/EFD structures....
In fact I was pondering having just a single refcounted structured for
the EFI and EFD, and have two xfs_log_item structures embedded into it,
with the ops modifying the common refcount. This isn't quite ready
yet but looks feasible.