[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090224070745.GB5162@x200.localdomain>
Date: Tue, 24 Feb 2009 10:07:45 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Krzysztof Sachanowicz <analyzer1@...il.com>,
linux-kernel@...r.kernel.org, marcin.pilipczuk@...il.com,
torvalds@...ux-foundation.org
Subject: Re: [PATCH] proc: proc_get_inode should de_put when inode already
initialized
On Mon, Feb 23, 2009 at 03:25:55PM -0800, Andrew Morton wrote:
> On Mon, 23 Feb 2009 22:21:55 +0100
> Krzysztof Sachanowicz <analyzer1@...il.com> wrote:
>
> > de_get is called before every proc_get_inode, but corresponding de_put is
> > called only when dropping last reference to an inode. This might cause
> > something like
> > remove_proc_entry: /proc/stats busy, count=14496
> > to be printed to the syslog.
> >
> > The fix is to call de_put in case of an already initialized inode in
> > proc_get_inode.
> >
> > Signed-off-by: Krzysztof Sachanowicz <analyzer1@...il.com>
> > Tested-by: Marcin Pilipczuk <marcin.pilipczuk@...il.com>
> > ---
> > --- linux-2.6.29-rc6.orig/fs/proc/inode.c 2009-02-23 20:43:32.000000000 +0100
> > +++ linux-2.6.29-rc6/fs/proc/inode.c 2009-02-23 20:46:37.000000000 +0100
> > @@ -485,8 +485,10 @@ struct inode *proc_get_inode(struct supe
> > }
> > }
> > unlock_new_inode(inode);
> > - } else
> > + } else {
> > module_put(de->owner);
> > + de_put(de);
> > + }
> > return inode;
> >
> > out_ino:
>
> This code area looks quite different in linux-next, although the
> changes there are removing proc_dir_entry.owner altogether and aren't
> obviously targetted at fixing this bug.
->owner issue is independent of this leak, I'll rebase/edit patches as
needed.
> Also...
>
> It's unpleasing to have the de_get() inside the caller and the de_put()
> inside the callee - it is better to have them both happening at the
> same level. If it is the case that "de_get is called before every
> proc_get_inode", then perhaps that operation should simply be moved
> into proc_get_inode().
Well, yes, this sucks. But unlock_new_inode() will clear I_NEW state,
so after function returns, there is no way to distinguish.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists