Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932328Ab1EKWeA (ORCPT ); Wed, 11 May 2011 18:34:00 -0400 Received: from mx2.netapp.com ([216.240.18.37]:47086 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932074Ab1EKWd6 convert rfc822-to-8bit (ORCPT ); Wed, 11 May 2011 18:33:58 -0400 X-IronPort-AV: E=Sophos;i="4.64,354,1301900400"; d="scan'208";a="547296228" Subject: Re: [PATCH] nfs: check a crash in nfs_lookup_revalidate From: Trond Myklebust To: Tyler Hicks Cc: Peng Huang , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20110511221750.GA9776@boyd.l.tihix.com> References: <1305147805-5756-1-git-send-email-shawn.p.huang@gmail.com> <1305148125.21868.2.camel@lade.trondhjem.org> <20110511221750.GA9776@boyd.l.tihix.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Organization: NetApp Inc Date: Wed, 11 May 2011 18:33:57 -0400 Message-ID: <1305153237.26971.4.camel@lade.trondhjem.org> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) X-OriginalArrivalTime: 11 May 2011 22:33:58.0522 (UTC) FILETIME=[84D6F5A0:01CC102B] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3233 Lines: 79 On Wed, 2011-05-11 at 17:17 -0500, Tyler Hicks wrote: > On Wed May 11, 2011 at 05:08:45PM -0400, Trond Myklebust wrote: > > On Wed, 2011-05-11 at 17:03 -0400, Peng Huang wrote: > > > lookup_one_len() may call nfs_loopup_revalidate() with nd == NULL > > > indirectly, that causes the kernel crash. > > > > > > RIP: 0010:[] [] > > > nfs_lookup_revalidate+0x21/0x4a0 [nfs] > > > RSP: 0018:ffff88018f00fae8 EFLAGS: 00010286 > > > > > > Call Trace: > > > [] do_revalidate+0x17/0x60 > > > [] __lookup_hash+0xcb/0x140 > > > [] lookup_one_len+0x94/0xe0 > > > [] ecryptfs_lookup+0x91/0x1d0 > > > [] d_alloc_and_lookup+0x45/0x90 > > > [] ? d_lookup+0x35/0x60 > > > [] do_lookup+0x192/0x2d0 > > > [] ? vfsmount_lock_local_unlock+0x1e/0x30 > > > [] ? security_inode_permission+0x1c/0x30 > > > [] link_path_walk+0x597/0xae0 > > > [] ? vfsmount_lock_local_lock+0x1e/0x30 > > > [] ? path_init_rcu+0xa5/0x210 > > > [] do_path_lookup+0x5b/0x140 > > > [] user_path_at+0x57/0xa0 > > > [] ? do_page_fault+0x1e8/0x4e0 > > > [] vfs_fstatat+0x46/0x80 > > > [] ? filldir+0x0/0xe0 > > > [] vfs_lstat+0x1e/0x20 > > > [] sys_newlstat+0x24/0x50 > > > [] ? page_fault+0x25/0x30 > > > [] system_call_fastpath+0x16/0x1b > > > > > > Signed-off-by: Peng Huang > > > --- > > > fs/nfs/dir.c | 2 +- > > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > > > index 2c3eb33..9452aa5 100644 > > > --- a/fs/nfs/dir.c > > > +++ b/fs/nfs/dir.c > > > @@ -1028,7 +1028,7 @@ static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) > > > struct nfs_fattr *fattr = NULL; > > > int error; > > > > > > - if (nd->flags & LOOKUP_RCU) > > > + if (nd != NULL && nd->flags & LOOKUP_RCU) > > > return -ECHILD; > > > > > > parent = dget_parent(dentry); > > > > That's exactly what Tyler Hicks proposed last week and which was NACKed. > > We simply won't support layered filesystems that don't do intents. > > But you _did_ support it up until > 34286d66 "fs: rcu-walk aware d_revalidate method" > > I see why you wouldn't want NULL nameidata in the NFSv4 specific > functions, but don't quite understand the opposition against it in NFSv3 > (nfs_lookup_revalidate). The one-liner above would allow users to begin > using eCryptfs on top of NFSv3 clients immediately, with no side effects > to NFS. Because even on NFSv3 it breaks exclusive creates. -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@netapp.com www.netapp.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/