From patchwork Sat Oct 13 04:42:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1588941 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 52D0A3FE80 for ; Sat, 13 Oct 2012 04:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751405Ab2JMEmK (ORCPT ); Sat, 13 Oct 2012 00:42:10 -0400 Received: from mx2.netapp.com ([216.240.18.37]:56212 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400Ab2JMEmJ (ORCPT ); Sat, 13 Oct 2012 00:42:09 -0400 X-IronPort-AV: E=Sophos;i="4.80,580,1344236400"; d="scan'208,223";a="700403007" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 12 Oct 2012 21:42:07 -0700 Received: from vmwexceht04-prd.hq.netapp.com (vmwexceht04-prd.hq.netapp.com [10.106.77.34]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q9D4g68Q022590; Fri, 12 Oct 2012 21:42:06 -0700 (PDT) Received: from SACEXCMBX04-PRD.hq.netapp.com ([169.254.6.102]) by vmwexceht04-prd.hq.netapp.com ([10.106.77.34]) with mapi id 14.02.0318.001; Fri, 12 Oct 2012 21:42:06 -0700 From: "Myklebust, Trond" To: Larry McVoy CC: Linus Torvalds , Bruce Fields , Linux NFS Mailing List Subject: Re: kernel BUG at /build/buildd/linux-3.2.0/fs/lockd/clntxdr.c:226! Thread-Topic: kernel BUG at /build/buildd/linux-3.2.0/fs/lockd/clntxdr.c:226! Thread-Index: AQHNqNS8DPgd2SNgnkO2Ap0UzORItZe21O0AgAALtwD//6N9+YAABsUzgACS+AA= Date: Sat, 13 Oct 2012 04:42:05 +0000 Message-ID: <4FA345DA4F4AE44899BD2B03EEEC2FA9091FFA38@SACEXCMBX04-PRD.hq.netapp.com> References: <20121012211701.GA8301@bitmover.com> <20121013002100.GB23247@bitmover.com> <4FA345DA4F4AE44899BD2B03EEEC2FA9091FDED5@SACEXCMBX04-PRD.hq.netapp.com> <20121013023147.GJ23247@bitmover.com> <4FA345DA4F4AE44899BD2B03EEEC2FA9091FE478@SACEXCMBX04-PRD.hq.netapp.com> <20121013025600.GL23247@bitmover.com> In-Reply-To: <20121013025600.GL23247@bitmover.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.104.60.116] MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, 2012-10-12 at 19:56 -0700, Larry McVoy wrote: > On Sat, Oct 13, 2012 at 02:52:51AM +0000, Myklebust, Trond wrote: > > On Fri, 2012-10-12 at 19:31 -0700, Larry McVoy wrote: > > > As I've said, debugging this is going to be hard, it means stopping my > > > company. We can do one more crash, you guys can tell me what to do, > > > but that's about it. > > > > Do you have a reproducer? > > Oh yeah, it happens every time. Run skype on a mac w/ your home dir NFS > mounted. Skype tries to do some lock operation and the machine panics. > > We've done it 4 times in a row to be sure we weren't smoking crack. No > crack. Just panics. OK. I think I can see what is happening. We need to filter the return values from nlm_lookup_file() when dealing with NLMv1 and NLMv3. Can you please try the attached patch? Cheers Trond PS: you are presumably running NFSv2 on your Macs. Odd that they should default to that... -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@netapp.com www.netapp.com From 1f0d4d1bb77fa0216dd2fb2041cc9b44db4697e0 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sat, 13 Oct 2012 00:30:28 -0400 Subject: [PATCH] NLM: nlm_lookup_file() may return NLMv4-specific error codes If the filehandle is stale, or open access is denied for some reason, nlm_fopen() may return one of the NLMv4-specific error codes nlm4_stale_fh or nlm4_failed. These get passed right through nlm_lookup_file(), and so when nlmsvc_retrieve_args() calls the latter, it needs to filter the result through the cast_status() machinery. Failure to do so, will trigger the BUG_ON() in encode_nlm_stat... Signed-off-by: Trond Myklebust --- fs/lockd/clntxdr.c | 2 +- fs/lockd/svcproc.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 180ac34..cf04cda 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c @@ -223,7 +223,7 @@ static void encode_nlm_stat(struct xdr_stream *xdr, { __be32 *p; - BUG_ON(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD); + WARN_ON_ONCE(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD); p = xdr_reserve_space(xdr, 4); *p = stat; } diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index d27aab1..d413af3 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -67,7 +67,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain file pointer. Not used by FREE_ALL call. */ if (filp != NULL) { - if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0) + error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh)); + if (error != 0) goto no_locks; *filp = file; -- 1.7.11.7