Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1565589rdb; Sun, 8 Oct 2023 14:05:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIg15TzJrLwahcuD1/Xcet9/GM51+lTXnIiynhcd2TbkFRrkZVPM7B7k7sd6AorIRI1YR9 X-Received: by 2002:a05:6a20:da8c:b0:16c:b5ce:50f with SMTP id iy12-20020a056a20da8c00b0016cb5ce050fmr4859456pzb.32.1696799153264; Sun, 08 Oct 2023 14:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696799153; cv=none; d=google.com; s=arc-20160816; b=VgFeOQwtcd53p8lVEB9QneV78w6QCfvUpIZ2YEamLJNGPxjzkgR8DCrWGFMgeLDQGX Tg6X7ezgWeGj/rEmDTJ6mMCh2H69dBuhre4aBjFNn+L5zbPBTLlgZ4Xe/53VOyfX8Bur KjwkUQvbEq1V729V+DjM5Ph5I10HoxTbxExWSSMz762Hsq1HVlpoNk9KLedQpI1P50h+ CKeuzoDMJGAbkTJHyOX78ZEbsaPchFxQddHV6A3F7EiUcZCmNCxxywu2bvDDHGF2cxaP qKvx6//rD13o6yaUk5B2sGGFBeldovOylQU3Ypa7Z9Ov4yk+H7/5KLkQHkk91ojNvYRa yE9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uZ6fRJpfdZ02bjnVpPGf7vgCC45VnPxsA0G8Tp1ZP8w=; fh=o0DJvL4N1Y01a/R2lcdpWKyQ1BS3rESqFF6rLU718ss=; b=Wr8VF8xVQhyTCWxKU3dQn9Mx5m+vkCcpD5Khed6kB64/0o2GggUwg873o4RUc3m0j9 iPMzkCDQw8fX6/Sh/Ya/7QmzBoQPj+4aGKS7jJABiRlmZqc0Kxs8KldvSr0QU1EE6ARU 7vXqxrvgW74Can/9MRmxovc0bcB93VPhyXVb2uUo9LgSfdD0fJHs+XJJMKKLWIe+ECjw 06zpgDic2vbKXqb3kdEf8UnjSnnY3wejrMdgW+yONl1FkEOZ/cnDPWYVvTLnB4HGjYEC ET47ENFvs86kKK58eIl1D5IRg4ckWu+lgddllz1fgJdlQNXPZBeFIYLiXzYBnGO01QRt M41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=modRTFHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id s25-20020a656919000000b005859b1c086fsi7988662pgq.532.2023.10.08.14.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 14:05:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=modRTFHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9D96180965A7; Sun, 8 Oct 2023 14:05:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjJHVFj (ORCPT + 99 others); Sun, 8 Oct 2023 17:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbjJHVFi (ORCPT ); Sun, 8 Oct 2023 17:05:38 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 442A7B6; Sun, 8 Oct 2023 14:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uZ6fRJpfdZ02bjnVpPGf7vgCC45VnPxsA0G8Tp1ZP8w=; b=modRTFHngoZgMNIpdoKNI8Xi3i 1xPnPtKOiLrYfgswU01yZiXdqDCP4FvGOLtsKzoT5hVs2MuEj/3sBvxgLFCCRBYI+brDec62Z3WnM OLVQx/uFF0HUcCWzxgZsUGVPSRoIMp+QxHaG0LC32F99y8fRj8LWTcW5ROHCS8tzqTNxJUnAHY2+5 1UEgC7Nqyh8wvdxRREjmGSCua168vsa7oQopUXTI++4gW96NdFhsYy9Ekn+hQf26ANxqCMic/XmEZ LB3x94IzGdpPFfBieT/P4hIxX5eNSRIJROOvpQCdF/x1i5W86erIdxCWK9f9kLYcuyXO5Lt+2o2tj AqTxam6A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qpaxm-00Bw97-7g; Sun, 08 Oct 2023 21:05:22 +0000 Date: Sun, 8 Oct 2023 22:05:22 +0100 From: Matthew Wilcox To: Mateusz Guzik Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Chandan Babu R , "Darrick J . Wong" , linux-xfs@vger.kernel.org Subject: Re: [PATCH v2 5/5] fs: Add inode_assert_locked() and inode_assert_locked_excl() Message-ID: References: <20231007203543.1377452-1-willy@infradead.org> <20231007203543.1377452-6-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Sun, 08 Oct 2023 14:05:50 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 08, 2023 at 10:26:40PM +0200, Mateusz Guzik wrote: > On 10/7/23, Matthew Wilcox (Oracle) wrote: > > +static inline void inode_assert_locked_excl(const struct inode *inode) > > +{ > > + rwsem_assert_held_write(&inode->i_rwsem); > > +} > > + > > static inline void inode_lock_nested(struct inode *inode, unsigned > > subclass) > > { > > down_write_nested(&inode->i_rwsem, subclass); > > Why "excl" instead of "write"? Apart from looking weird, it is > inconsistent with "prior art" in the file: i_mmap_assert_write_locked. Yes, but that pairs with i_mmap_lock_write() / i_mmap_lock_read(). The problem is that we have inode_lock() / inode_lock_shared() inode_assert_locked_read/write doesn't make sense with them. But inode_assert_locked() doesn't make sense as the assertion for inode_lock() because you'd expect it to assert whether the inode lock is held at all. So I went with inode_assert_locked_excl(). I wouldn't mind if we converted all the inode_lock()/shared to inode_lock_read() / inode_lock_write(), and then added inode_assert_read_locked() / inode_assert_write_locked(). That's a bit of a bigger job than I want to take on today.