linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	Dave Chinner <dchinner@redhat.com>,
	 kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	 Chandan Babu R <chandanrlinux@gmail.com>,
	 Allison Henderson <allison.henderson@oracle.com>
Subject: Re: [kbuild-all] [linux-next:master 6373/10489] fs/xfs/xfs_log_cil.c:897:1-10: second lock on line 900 (fwd)
Date: Thu, 17 Jun 2021 21:40:18 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2106172114590.13503@hadrien> (raw)
In-Reply-To: <20210617190849.GE158232@locust>



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


  reply	other threads:[~2021-06-17 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 18:28 Julia Lawall
2021-06-17 18:50 ` [kbuild-all] " Darrick J. Wong
2021-06-17 18:59   ` Matthew Wilcox
2021-06-17 19:08     ` Darrick J. Wong
2021-06-17 19:40       ` Julia Lawall [this message]
2021-06-17 19:14     ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2106172114590.13503@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=allison.henderson@oracle.com \
    --cc=chandanrlinux@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox