From mboxrd@z Thu Jan 1 00:00:00 1970 From: Davide Libenzi Subject: Re: [patch]anon_inodes.c: fix error check in anon_inode_getfd Date: Thu, 27 Sep 2007 09:41:25 -0700 (PDT) Message-ID: References: <3d0408630709261930l730f5081n2391b236dd0efb71@mail.gmail.com> <20070926205957.54f49465.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Yan Zheng , linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from x35.xmailserver.org ([64.71.152.41]:34425 "EHLO x35.xmailserver.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756957AbXI0Qtn (ORCPT ); Thu, 27 Sep 2007 12:49:43 -0400 Received: from alien.or.mcafeemobile.com by x35.xmailserver.org with [XMail 1.25 ESMTP Server] id for from ; Thu, 27 Sep 2007 12:41:29 -0400 In-Reply-To: <20070926205957.54f49465.akpm@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, 26 Sep 2007, Andrew Morton wrote: > On Thu, 27 Sep 2007 10:30:50 +0800 "Yan Zheng" wrote: > > > Hello, > > > > igrab return NULL on error. > > > > Signed-off-by: Yan Zheng > > --- > > 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. Funny, I noticed the non-ERR_PTR return code of igrab() just yesterday, and I was going to port a patch today. Signed-off-by: Davide Libenzi - Davide