From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0136FC433EF for ; Mon, 23 May 2022 20:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232010AbiEWUR6 (ORCPT ); Mon, 23 May 2022 16:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232782AbiEWURz (ORCPT ); Mon, 23 May 2022 16:17:55 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F864B0D17 for ; Mon, 23 May 2022 13:17:53 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id 884015BD0; Mon, 23 May 2022 16:17:52 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 884015BD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1653337072; bh=LZjNK0QJZx0VwySuAQN+c/fv9SRXsDo1siBlZtPr5Y4=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=wed4/WjBcDf9m5s0RzrNvhl5floK1KDX4fNxwijOC+84pmP+pxHHjW7IAf3z/vQpg yL8xnOXHhbFwg8CPt2fzjPKtpz5t6Hxv4Vcf1SdjM2Z0trJfOUMqMk0OoXDnlwd6ci lLfURV7hg7OT8g/0mPLAiFKEKEFmB9BrJW/vBJ40= Date: Mon, 23 May 2022 16:17:52 -0400 To: Jeff Layton Cc: Chuck Lever III , Linux NFS Mailing List Subject: Re: [PATCH RFC] NFSD: Fix possible sleep during nfsd4_release_lockowner() Message-ID: <20220523201752.GI24163@fieldses.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, May 23, 2022 at 03:43:28PM -0400, Jeff Layton wrote: > On Mon, 2022-05-23 at 19:35 +0000, Chuck Lever III wrote: > > > > > On May 23, 2022, at 1:38 PM, Jeff Layton wrote: > > > > > > On Mon, 2022-05-23 at 17:25 +0000, Chuck Lever III wrote: > > > > > > > > > On May 23, 2022, at 12:37 PM, Jeff Layton wrote: > > > > > > > > > > His suggestion was just to keep a counter in the lockowner of how many > > > > > locks are associated with it. That seems like a good suggestion, though > > > > > 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. > > > > > > > > locks_copy_conflock() would need to take a boolean parameter > > > > that callers would set when they actually manipulate a lock. > > > > > > > > > > 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. > > > > It's the lm_put_owner() side that looks less than straightforward. > > Suggestions and advice welcome there. > > > > 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. Should conflock parameters really be represented by file_lock structures at all? It always seemed a little wrong to me. But, that's a bit of derail, apologies. --b.