From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: [PATCH 09/31] IGET: Stop BFS from using iget() and read_inode() [try #3] Date: Thu, 11 Oct 2007 08:39:40 +0100 Message-ID: <30783.1192088380@redhat.com> References: <470D7443.6030206@tiscali.nl> <20071010214308.17535.5406.stgit@warthog.procyon.org.uk> <20071010214354.17535.22412.stgit@warthog.procyon.org.uk> Cc: dhowells@redhat.com, hch@infradead.org, viro@ftp.linux.org.uk, torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Roel Kluin <12o3l@tiscali.nl> Return-path: Received: from mx1.redhat.com ([66.187.233.31]:52930 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756045AbXJKHkC (ORCPT ); Thu, 11 Oct 2007 03:40:02 -0400 In-Reply-To: <470D7443.6030206@tiscali.nl> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Roel Kluin <12o3l@tiscali.nl> wrote: > > + if (IS_ERR(inode)) > > + return ERR_PTR(-ENOMEM); > > + if (!(inode->i_state & I_NEW)) > > + return inode; > > Don't you have to unlock_new_inode(inode) before returning? In the first case, no because an OOM error was returned rather than an inode, and in the second case, no because an extant non-locked inode was returned. The inode is only returned locked by iget_locked() if it is also new - in which case we don't return in either of the above two statements. > > +error: > > and also here? > > > + iget_failed(inode); > > + return ERR_PTR(-EIO); Take a look at what iget_failed() does (patch #3): void iget_failed(struct inode *inode) { make_bad_inode(inode); unlock_new_inode(inode); iput(inode); } David