Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2227804ioo; Mon, 23 May 2022 13:14:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOGCdmkV6Dl6zj8QgD9FA66SjY0Z8SsmMPKJ/GiUJGlkai6kxu6lIBtAI1Ljmo8VVgf7R+ X-Received: by 2002:a63:6886:0:b0:3c5:11f4:f055 with SMTP id d128-20020a636886000000b003c511f4f055mr21851230pgc.44.1653336859543; Mon, 23 May 2022 13:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653336859; cv=none; d=google.com; s=arc-20160816; b=Db+M/KqFt64a6lr7QLqxboGAivpSc0yBG+/6tifj1Xivcy5gtnISrvKE2g2wI42Awf E8gAMCQqjLS5GohFU1v0kKFZoNE8c3zcbt2t2pI2gfOmT+Y5SIoA2Qiy57EhXot6aT4V 8SsgO1x3HDmbCSfdMp/KsE18L78FuBiqfKyYueP5qi+qpvexwShnAWyrRdlM/tv5zhbF ZO1DKtZhfeu3O96JuvnHqA45WUC0a4ii5kosiM5NkqA73X2mmWc3smvAeRTGP9u8Wb5r SyO2Mrvv91hfxFWvx+HH6ecs1O6Ic6Fomss1u3a6nWHOLFijv6F6p7sFurQQ6fpm6N9B 4npQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=Gj4iYIKjxE8wse1bNogJ3UWSpe3xOtS4OCTCLwjl8bI=; b=dSsXPSb8CCh07D5zXQzy2ZjFhjKytJlv3EIjDCo4vqikiw2okSO1mwGz6nQ2lWoNfz hcenC92vCDqw7ghmcWinpuIcGljLpz/D3+LQBw2eAcYaBayJCcTfWd4UgrSZF9qzTS97 RoVJek9uAcnoL62PkB7d7ZCAQiN6oObgQ3WxH7SjCDCUlnR4H/ovxwmg292Br7IX/DnG BeuHS0LeDCVtXUm3BZ4hTDZE8e6cLcMs3aZ7OutWxESgHn5OZNXL0nx+SfowekQ31/mH wXwZZaUw5co3geOrJVjOUb4LCsM5ATXZ0Z9n7XEkOUpXWdPgEWIeKbZDiCRTzsHeNkM8 vfqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cMIl1qvU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170902cf0900b001589bc37b1asi11253236plg.332.2022.05.23.13.14.07; Mon, 23 May 2022 13:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cMIl1qvU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiEWTok (ORCPT + 99 others); Mon, 23 May 2022 15:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbiEWToD (ORCPT ); Mon, 23 May 2022 15:44:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890D0F2E for ; Mon, 23 May 2022 12:43:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B88BC61382 for ; Mon, 23 May 2022 19:43:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0EF5C385A9; Mon, 23 May 2022 19:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653335010; bh=Gj4iYIKjxE8wse1bNogJ3UWSpe3xOtS4OCTCLwjl8bI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cMIl1qvUxjtdugWzZf9k56oqD9Ij5C8KI5tqbqPz1aNanOYe06t1iqh44g+9ZyT71 /3wlDe+IeFKwdafgFTNSH26Xcyi4gfQ3iORIJbJ2ZdqcL8/k/MP3OElRRESg92c9vc 0P2sEc+t/HES0uiiCp62jHMDG6DpXG12xk5Z7uYCquUlu5c66LIYEtqCYjYerhezlQ w8MhGUFE/utaZyWsZtWbe5q5XDjR6B2ZtCwUuzyzfytxN8Ni/NIrhu+GluZymT/hTE kSTVaxIm32aetoeQspnOLRNUuxP919ruIvOFCV644gnyAKOoiLijj5CmpsuUfXZQ3+ igcz9sAf1P+5Q== Message-ID: Subject: Re: [PATCH RFC] NFSD: Fix possible sleep during nfsd4_release_lockowner() From: Jeff Layton To: Chuck Lever III Cc: Linux NFS Mailing List Date: Mon, 23 May 2022 15:43:28 -0400 In-Reply-To: <9D7CE6C9-579D-4DF3-9425-4CE0099E75E0@oracle.com> References: <165323344948.2381.7808135229977810927.stgit@bazille.1015granger.net> <510282CB-38D3-438A-AF8A-9AC2519FCEF7@oracle.com> <1A37E2B5-8113-48D6-AF7C-5381F364D99E@oracle.com> <9D7CE6C9-579D-4DF3-9425-4CE0099E75E0@oracle.com> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.1 (3.44.1-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, 2022-05-23 at 19:35 +0000, Chuck Lever III wrote: >=20 > > On May 23, 2022, at 1:38 PM, Jeff Layton wrote: > >=20 > > On Mon, 2022-05-23 at 17:25 +0000, Chuck Lever III wrote: > > >=20 > > > > On May 23, 2022, at 12:37 PM, Jeff Layton wrot= e: > > > >=20 > > > > His suggestion was just to keep a counter in the lockowner of how m= any > > > > locks are associated with it. That seems like a good suggestion, th= ough > > > > you'd probably need to add a parameter to lm_get_owner to indicate > > > > whether you were adding a new lock or just doing a conflock copy. > > >=20 > > > locks_copy_conflock() would need to take a boolean parameter > > > that callers would set when they actually manipulate a lock. > > >=20 > >=20 > > Yep. You'd also have to add a bool arg to lm_put_owner so that you know > > whether you need to decrement the counter. >=20 > It's the lm_put_owner() side that looks less than straightforward. > Suggestions and advice welcome there. >=20 Maybe add a new fl_flags value that indicates that a particular lock is a conflock and not a lock record? Then locks_release_private could use that to pass the appropriate argument to lm_put_owner. That's probably simpler overall than trying to audit all of the locks_free_lock callers. --=20 Jeff Layton