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 31CB9C433F5 for ; Mon, 21 Mar 2022 07:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344915AbiCUHbT (ORCPT ); Mon, 21 Mar 2022 03:31:19 -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 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.