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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AE86C2B9F4 for ; Thu, 17 Jun 2021 19:40:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76C90613D8 for ; Thu, 17 Jun 2021 19:40:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76C90613D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C8C326B0070; Thu, 17 Jun 2021 15:40:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3BF16B0071; Thu, 17 Jun 2021 15:40:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADCF06B0072; Thu, 17 Jun 2021 15:40:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 783416B0070 for ; Thu, 17 Jun 2021 15:40:49 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1C0EF180ACC5A for ; Thu, 17 Jun 2021 19:40:49 +0000 (UTC) X-FDA: 78264233418.30.DBB4F1B Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by imf20.hostedemail.com (Postfix) with ESMTP id 569DA13A for ; Thu, 17 Jun 2021 19:40:48 +0000 (UTC) IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A2x+3RqFLXTTh/CESpLqE78eALOsnbusQ8zAX?= =?us-ascii?q?PiFKOHhom6Oj/PxG8M5w6fawslcssRIb6LW90cu7IU80nKQdibX5f43SPzUO01?= =?us-ascii?q?HHEGgN1+ffKnHbak/D398Y5ONbf69yBMaYNzVHpMzxiTPWL+od?= X-IronPort-AV: E=Sophos;i="5.83,281,1616454000"; d="scan'208";a="385385154" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 21:40:18 +0200 Date: Thu, 17 Jun 2021 21:40:18 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "Darrick J. Wong" cc: Matthew Wilcox , Dave Chinner , kbuild-all@lists.01.org, Linux Memory Management List , Chandan Babu R , Allison Henderson Subject: Re: [kbuild-all] [linux-next:master 6373/10489] fs/xfs/xfs_log_cil.c:897:1-10: second lock on line 900 (fwd) In-Reply-To: <20210617190849.GE158232@locust> Message-ID: References: <20210617185044.GD158186@locust> <20210617190849.GE158232@locust> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of julia.lawall@inria.fr designates 192.134.164.104 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr X-Stat-Signature: gf9p55y7uxuxxzs3kfphpdazg6bdpfwt X-Rspamd-Queue-Id: 569DA13A X-Rspamd-Server: rspam06 X-HE-Tag: 1623958848-725151 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 17 Jun 2021, Darrick J. Wong wrote: > On Thu, Jun 17, 2021 at 07:59:00PM +0100, Matthew Wilcox wrote: > > On Thu, Jun 17, 2021 at 11:50:44AM -0700, Darrick J. Wong wrote: > > > On Thu, Jun 17, 2021 at 08:28:24PM +0200, Julia Lawall wrote: > > > > cocci warnings: (new ones prefixed by >>) > > > > >> fs/xfs/xfs_log_cil.c:897:1-10: second lock on line 900 > > > > > > > > 5fd9256ce156ef Dave Chinner 2021-06-03 891 /* > > > > 5fd9256ce156ef Dave Chinner 2021-06-03 892 * If the checkpoint spans multiple iclogs, wait for all previous > > > > cb1acb3f324636 Dave Chinner 2021-06-04 893 * iclogs to complete before we submit the commit_iclog. In this case, > > > > cb1acb3f324636 Dave Chinner 2021-06-04 894 * the commit_iclog write needs to issue a pre-flush so that the > > > > cb1acb3f324636 Dave Chinner 2021-06-04 895 * ordering is correctly preserved down to stable storage. > > > > 5fd9256ce156ef Dave Chinner 2021-06-03 896 */ > > > > 5fd9256ce156ef Dave Chinner 2021-06-03 @897 spin_lock(&log->l_icloglock); > > > > cb1acb3f324636 Dave Chinner 2021-06-04 898 if (ctx->start_lsn != commit_lsn) { > > > > 5fd9256ce156ef Dave Chinner 2021-06-03 899 xlog_wait_on_iclog(commit_iclog->ic_prev); > > > > cb1acb3f324636 Dave Chinner 2021-06-04 @900 spin_lock(&log->l_icloglock); > > > > > > xlog_wait_on_commit drops l_icloglock, either directly or via xlog_wait. > > > It looks odd (perhaps there should be a comment?) but at least in theory > > > the functions are annotated so I guess that means the static checking > > > doesn't know that commit_iclog->ic_log == log? > > > > I think it's hard for a tool to reach into fs/xfs/xfs_log.c and look for > > the __releases annotation on the definition of xlog_wait_on_commit(). > > Should we also annotate the prototype in fs/xfs/xfs_log_priv.h ? > > > > For example, > > > > void wbc_attach_and_unlock_inode(struct writeback_control *wbc, > > struct inode *inode) > > __releases(&inode->i_lock); > > That depends on whether or not amending the declaration in that manner > actually satisfies the checking tool? Ah, I see, __releases is a macro > that only expands to anything if __CHECKER__, which is probably why the > actual checker tool doesn't see this, and possibly why gcc can't > complain about the mismatch between declaration and definition. No, Coccinelle doesn't care about what __releases expands to. As long as it can find the header file, it will just process the prototype as it is presented. julia