From patchwork Thu Feb 26 19:30:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 23781 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id C9AA0DDDA1 for ; Fri, 27 Feb 2009 06:30:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752415AbZBZTag (ORCPT ); Thu, 26 Feb 2009 14:30:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751704AbZBZTaf (ORCPT ); Thu, 26 Feb 2009 14:30:35 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:43211 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752415AbZBZTaf (ORCPT ); Thu, 26 Feb 2009 14:30:35 -0500 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n1QJUVhn022472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 26 Feb 2009 11:30:32 -0800 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id n1QJUVYU014434; Thu, 26 Feb 2009 11:30:31 -0800 Message-Id: <200902261930.n1QJUVYU014434@imap1.linux-foundation.org> Subject: [merged] ext4-return-eio-not-estale-on-directory-traversal-through-deleted-inode.patch removed from -mm tree To: bdonlan@gmail.com, linux-ext4@vger.kernel.org, mm-commits@vger.kernel.org From: akpm@linux-foundation.org Date: Thu, 26 Feb 2009 11:30:31 -0800 X-Spam-Status: No, hits=-3.448 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The patch titled ext4: return -EIO not -ESTALE on directory traversal through deleted inode has been removed from the -mm tree. Its filename was ext4-return-eio-not-estale-on-directory-traversal-through-deleted-inode.patch This patch was dropped because it was merged into mainline or a subsystem tree The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ext4: return -EIO not -ESTALE on directory traversal through deleted inode From: Bryan Donlan ext4_iget() returns -ESTALE if invoked on a deleted inode, in order to report errors to NFS properly. However, in ext[234]_lookup(), this -ESTALE can be propagated to userspace if the filesystem is corrupted such that a directory entry references a deleted inode. This leads to a misleading error message - "Stale NFS file handle" - and confusion on the part of the admin. The bug can be easily reproduced by creating a new filesystem, making a link to an unused inode using debugfs, then mounting and attempting to ls -l said link. This patch thus changes ext4_lookup to return -EIO if it receives -ESTALE from ext4_iget(), as ext4 does for other filesystem metadata corruption; and also invokes the appropriate ext*_error functions when this case is detected. Signed-off-by: Bryan Donlan Cc: Signed-off-by: Andrew Morton --- fs/ext4/namei.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff -puN fs/ext4/namei.c~ext4-return-eio-not-estale-on-directory-traversal-through-deleted-inode fs/ext4/namei.c --- a/fs/ext4/namei.c~ext4-return-eio-not-estale-on-directory-traversal-through-deleted-inode +++ a/fs/ext4/namei.c @@ -1051,8 +1051,16 @@ static struct dentry *ext4_lookup(struct return ERR_PTR(-EIO); } inode = ext4_iget(dir->i_sb, ino); - if (IS_ERR(inode)) - return ERR_CAST(inode); + if (unlikely(IS_ERR(inode))) { + if (PTR_ERR(inode) == -ESTALE) { + ext4_error(dir->i_sb, __func__, + "deleted inode referenced: %u", + ino); + return ERR_PTR(-EIO); + } else { + return ERR_CAST(inode); + } + } } return d_splice_alias(inode, dentry); }