Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1769276pxp; Mon, 21 Mar 2022 04:52:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyyRvuwzbWxTJw16viw6z/u9x+0SRul2mEkZjgHjKX6hsR3sjmfn4TRUVtGF0lL+VIPEEN X-Received: by 2002:a17:902:ce91:b0:154:16c2:63b3 with SMTP id f17-20020a170902ce9100b0015416c263b3mr12807232plg.22.1647863548755; Mon, 21 Mar 2022 04:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647863548; cv=none; d=google.com; s=arc-20160816; b=wwu0LgzybvYkabFB5o8zM9tp6YymavqJQpYlCGWNvvx6L+MXdnNOx225FCTwNCCym8 hvOAM2/b5nC9oyUHaG/fqw8iQvjz0gCT39OxKO1YdIHK5wIr/e1rKFgTPfVlpwa/s1Cy vXtaqlnQmolxbrhbkVG6WrV44SFsBxAmCqBXKnXQttBryW+0ltkgJ1VMOi4F3H+CEkdZ A6G3bE7V9TrV2LTMS9MLcS7G6ss+t6rr18Ee8iCQrY2s1dYQgSyJhZ3HUwPsNyBliI49 LT+H1Ow1tGJEMJMwnWDrnDj12WlMzoeZMeeN6ZWTE3HUmw1cfFo8lx+GsY7oY+VGXLb7 NI6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eyCspKdED5FyIPP1WitxZ2sJkCGLxA9+/sQzLz5E/+U=; b=nlfJydb28M0Bce5YqbmWr96lrW78ai0gGGQFpn2CfipnK0io3GbrZ8n08/JXPeRvze wzgiYVRCw62uix2DsN9leX8v6vLj8J7GqdeYwToKLAeiduk8WYydQOc4T3I7ZY/NxGsS NeKTlAI8XI76Y/pB9sJPWuvgI6QS0OotZArFyB8gXfus6IuGi2BB7A/jroH8TlQQEni1 4tRESKCjJ/I4tTO1m+kIEu0JtLrV4+eBvyzzWbEX/FoNhWeMr7aOwQwcTDKnTAbL2j3s dwdbrKIYtAqtXsfP6Es9Iidb4AXV1PQQkTpy5oU94X2y6OYC+Gf2ibUiZ2t2HORY2Gkq Szeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a63f609000000b00382773de76csi3471288pgh.9.2022.03.21.04.52.03; Mon, 21 Mar 2022 04:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344909AbiCUHbR (ORCPT + 99 others); Mon, 21 Mar 2022 03:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244518AbiCUHbQ (ORCPT ); Mon, 21 Mar 2022 03:31:16 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02767DE07 for ; Mon, 21 Mar 2022 00:29:50 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWCU5-00Ebay-SS; Mon, 21 Mar 2022 07:29:46 +0000 Date: Mon, 21 Mar 2022 07:29:45 +0000 From: Al Viro To: Imran Khan Cc: tj@kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH v7 7/8] kernfs: Replace per-fs rwsem with hashed rwsems. Message-ID: References: <20220317072612.163143-1-imran.f.khan@oracle.com> <20220317072612.163143-8-imran.f.khan@oracle.com> <536f2392-45d2-2f43-5e9d-01ef50e33126@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <536f2392-45d2-2f43-5e9d-01ef50e33126@oracle.com> Sender: Al Viro X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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-kernel@vger.kernel.org On Mon, Mar 21, 2022 at 12:57:07PM +1100, Imran Khan wrote: > Yes. My earlier approach is wrong. > > This patch set has also introduced a per-fs mutex (kernfs_rm_mutex) > which should fix the problem of inconsistent tree view as far as > kernfs_get_path is concerned. > Acquiring kernfs_rm_mutex before invoking kernfs_get_path in > kernfs_getlink will ensure that kernfs_get_path will get a consistent > view of ->parent of nodes from root to target. This is because acquiring > kernfs_rm_mutex will ensure that __kernfs_remove does not remove any > kernfs_node(or parent of kernfs_node). Further it ensures that > kernfs_rename_ns does not move any kernfs_node. So far I have not used > per-fs mutex in kernfs_rename_ns but I can make this change in next > version. So following change on top of current patch set should fix > this issue of ->parent change in the middle of kernfs_get_path. I think it's a massive overkill. Look at kernfs_get_target_path() - nothing in it is blocking. And you already have kernfs_rename_lock, stabilizing the tree topology. Turn it into rwlock if you wish, with that thing being a reader and existing users - writers. And don't bother with further scaling, until and unless you see a real contention on it.