RE: [PATCH 02/10] zcache: fix refcount leak

From: Dan Magenheimer
Date: Wed Jun 20 2012 - 18:26:20 EST


> From: Xiao Guangrong [mailto:xiaoguangrong@xxxxxxxxxxxxxxxxxx]
> Subject: Re: [PATCH 02/10] zcache: fix refcount leak
>
> On 06/20/2012 10:54 AM, Xiao Guangrong wrote:
>
> > On 06/20/2012 04:06 AM, Seth Jennings wrote:
> >
> >> On 06/19/2012 02:49 PM, Dan Magenheimer wrote:
> >>
> >>> My preference would be to fix it the opposite way, by
> >>> checking and ignoring zcache_host in zcache_put_pool.
> >>> The ref-counting is to ensure that a client isn't
> >>> accidentally destroyed while in use (for multiple-client
> >>> users such as ramster and kvm) and since zcache_host is a static
> >>> struct, it should never be deleted so need not be ref-counted.
> >>
> >>
> >> If we do that, we'll need to comment it. If we don't, it won't be
> >> obvious why we are refcounting every zcache client except one. It'll
> >> look like a bug.
> >
> >
> > Okay, i will fix it like Dan's way and comment it.
>
> Hmm...But i notice that zcache_host is the same as other clients, all
> of them are static struct:
>
> | static struct zcache_client zcache_host;
> | static struct zcache_client zcache_clients[MAX_CLIENTS];
>
> And all of them are not destroyed.

Yes, the code currently in zcache was a first step towards
supporting multiple clients. Ramster goes one step further
and kvm will require even a tiny bit more work.

FYI, I'm working on a unification version of zcache that can support
all of these cleanly as well as better support for eviction
that will make standalone zcache more suitable for promotion from
staging and enterprise-ready. Due to various summer commitments,
it will probably be a few weeks before it is ready for posting.

Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/