Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1466123rdb; Wed, 6 Dec 2023 22:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNbm/lD8R/GPJO0SL2giQ4PwWqxMBlKol0BOqilrG0GZ3+zrqkFHo0nXDWX7z0wsCXHs77 X-Received: by 2002:a05:6a20:72a2:b0:18f:97c:975a with SMTP id o34-20020a056a2072a200b0018f097c975amr2564018pzk.66.1701931362970; Wed, 06 Dec 2023 22:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701931362; cv=none; d=google.com; s=arc-20160816; b=HDqrXu978lotxu/kgKy5CEFHKPUecZbfQfYs0gYXcPPnFG7Mb3Jp4XFuXDcqxx5EAm T1c01ZyLjOLJdt1pMoUXBy4lYfnoRCwbh7gsAJHt53o7IBZiaEbl7c/+aeOzH438khZ4 QmlNo8F8Jb9SJv1lDKKef59hvt9j41+pYMffMD/8glXL7njgxViUcDqymElEpJxdMyOv AbAu8kO8IvpQ5S6lHxQJsMvN8/D39Tpa7HJ8N5dtQ3hnm6P8spL1F3urGgtbkv5UaW9H MHRQwtTDHyxIIzQZ1jMSvm9AS+9pBXqinERAqsMfWxrsW28O4jalvD/k5Dzpk4dN2ZMm 5sZg== 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 :dkim-signature; bh=1QgoyT0tgQXYPReqLUaAyvop4QBCwrIs7+A2t8zzCtQ=; fh=OvCUO7VSi2qhFSf1pAk0DSxAfqIFciTB3JbkL+4/94M=; b=I/dUNqtyXnnY+7+4gkW6E/jTuYRmyg0awgway3bQysoSgjrnwGLAYQBklH1UmqBbcl F9DgvYWiRJ/QDe6CFvqjzdYgqKojmRATmHZ0FHlO9Exmhq3YiCrJxnEaqcDMLcAsZVKd HsP8kOgVCjNw8Vt15Vc/Y1RaQBowMuP5nJC7yftjjLaex3H9XkHoAOgY4mmwvqXb13yV tW409/WRFagqzWkpNmqPzNvkQjzhqsmv4G0LIbvLv3vb5BGlNsFHrKeXzCVRO09tlLlS 0+64qqmiFPfoY7fk35F760t1gNInmXmwvztTSh9iQVYa+GPptlonJ7nqXYb8htvMI0Cx QN0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ZqyASLyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id s24-20020a63f058000000b005c682e0ced3si678295pgj.97.2023.12.06.22.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 22:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=ZqyASLyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AACD38032369; Wed, 6 Dec 2023 22:42:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjLGGl7 (ORCPT + 99 others); Thu, 7 Dec 2023 01:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbjLGGl5 (ORCPT ); Thu, 7 Dec 2023 01:41:57 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A93D59; Wed, 6 Dec 2023 22:42:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1QgoyT0tgQXYPReqLUaAyvop4QBCwrIs7+A2t8zzCtQ=; b=ZqyASLydyd37Ejn7vrHKf1q6jD lmVSyysCizw3w+6wnVcD4+VaiIAvv8IRgLzBgLsp81Qyh4tHemn4ztiShuZO5A1l2q68FUl37JjLJ ZHbMObLpkTr85VoFq+qg3CvhMbXr9cn/wqIVmNfuvUbQ6NnbD06BWm9iDMxYumAqkFu4KqvWj20m7 rlqWS18Q1ruFemUBBzJJ4+zXJ4q9sPc2MON6XUH1NoP0/39DAuMbHiO2aCAYUoFXX6K2DVQCmP3s+ pe5Yo/AKz/B8PUaBsGI7M/0nXdO6Rvdf96HBrDQhTJZUDajjKsgZzVv+k0CULnyzK5sTZCbPSRt40 vDkDeJRA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rB85A-0087jv-0f; Thu, 07 Dec 2023 06:42:00 +0000 Date: Thu, 7 Dec 2023 06:42:00 +0000 From: Al Viro To: Dave Chinner Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-cachefs@redhat.com, dhowells@redhat.com, gfs2@lists.linux.dev, dm-devel@lists.linux.dev, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/11] vfs: inode cache conversion to hash-bl Message-ID: <20231207064200.GY1674809@ZenIV> References: <20231206060629.2827226-1-david@fromorbit.com> <20231206060629.2827226-9-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231206060629.2827226-9-david@fromorbit.com> Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 06 Dec 2023 22:42:18 -0800 (PST) On Wed, Dec 06, 2023 at 05:05:37PM +1100, Dave Chinner wrote: > + /* > + * There are some callers that come through here without synchronisation > + * and potentially with multiple references to the inode. Hence we have > + * to handle the case that we might race with a remove and insert to a > + * different list. Coda, in particular, seems to have a userspace API > + * that can directly trigger "unhash/rehash to different list" behaviour > + * without any serialisation at all. > + * > + * Hence we have to handle the situation where the inode->i_hash_head > + * might point to a different list than what we expect, indicating that > + * we raced with another unhash and potentially a new insertion. This > + * means we have to retest the head once we have everything locked up > + * and loop again if it doesn't match. > + */ coda_replace_fid() is an old headache, but it's thankfully unique - nobody else does that kind of shit (just rechecked). Note that coda_replace_fid() is not going to have the sucker racing with removal from another source, and I'm 100% sure that they really want some serialization for handling those requests. remove_inode_hash() is misused there - "in the middle of hash key change" is not the same state as "unhashed". Any races between insert and unhash are bugs, not something to support.