linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Yan Zheng <yanzheng@21cn.com>, linux-fsdevel@vger.kernel.org
Subject: Re: [patch]anon_inodes.c: fix error check in anon_inode_getfd
Date: Thu, 27 Sep 2007 10:40:44 -0700	[thread overview]
Message-ID: <20070927104044.b12c1072.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0709270953370.763@alien.or.mcafeemobile.com>

On Thu, 27 Sep 2007 09:54:47 -0700 (PDT) Davide Libenzi <davidel@xmailserver.org> wrote:

> On Thu, 27 Sep 2007, Davide Libenzi wrote:
> 
> > On Wed, 26 Sep 2007, Andrew Morton wrote:
> > 
> > > On Thu, 27 Sep 2007 10:30:50 +0800 "Yan Zheng" <yanzheng@21cn.com> wrote:
> > > 
> > > > Hello,
> > > > 
> > > > igrab return NULL on error.
> > > > 
> > > > Signed-off-by: Yan Zheng<yanzheng@21cn.com>
> > > > ---
> > > > diff -ur linux-2.6.23-rc8/fs/anon_inodes.c linux/fs/anon_inodes.c
> > > > --- linux-2.6.23-rc8/fs/anon_inodes.c	2007-09-27 10:05:07.000000000 +0800
> > > > +++ linux/fs/anon_inodes.c	2007-09-27 10:18:26.000000000 +0800
> > > > @@ -87,8 +87,8 @@
> > > >  		return -ENFILE;
> > > > 
> > > >  	inode = igrab(anon_inode_inode);
> > > > -	if (IS_ERR(inode)) {
> > > > -		error = PTR_ERR(inode);
> > > > +	if (!inode) {
> > > > +		error = -ENOENT;
> > > >  		goto err_put_filp;
> > > >  	}
> > > 
> > > hm, does that code actually need to exist?  igrab() is pretty expensive and
> > > that fs is permanently mounted anyway...
> > 
> > yes. The inode gets attached the the file*, and on its way out an iput() 
> > is done.
> 
> Wait. You mean "is it worth checking the igrab() return code at all"?

Well I was more thinking "can we just leave that inode's refcount alone all
the time".  I guess that would be tricky, but I think we can at least use
the much less expensive __iget(), or an open-coded atomic_inc.

inode_lock is a heavily-used singleton.  I remain surprised that it hasn't
bitten us in the ass yet.


  reply	other threads:[~2007-09-27 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27  2:30 [patch]anon_inodes.c: fix error check in anon_inode_getfd Yan Zheng
2007-09-27  3:59 ` Andrew Morton
2007-09-27 16:41   ` Davide Libenzi
2007-09-27 16:54     ` Davide Libenzi
2007-09-27 17:40       ` Andrew Morton [this message]
2007-09-27 17:56         ` Davide Libenzi
2007-09-27 18:20           ` Andrew Morton
2007-09-27 18:25             ` Davide Libenzi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070927104044.b12c1072.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=yanzheng@21cn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).