Content-Type: multipart/mixed; boundary="===============3836229568987506525==" MIME-Version: 1.0 From: Julia Lawall To: kbuild-all@lists.01.org Subject: Re: [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:14:29 +0200 Message-ID: In-Reply-To: List-Id: --===============3836229568987506525== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, 17 Jun 2021, 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 checkpoi= nt spans multiple iclogs, wait for all previous > > > cb1acb3f324636 Dave Chinner 2021-06-04 893 * iclogs to compl= ete before we submit the commit_iclog. In this case, > > > cb1acb3f324636 Dave Chinner 2021-06-04 894 * the commit_iclo= g write needs to issue a pre-flush so that the > > > cb1acb3f324636 Dave Chinner 2021-06-04 895 * ordering is cor= rectly 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= !=3D commit_lsn) { > > > 5fd9256ce156ef Dave Chinner 2021-06-03 899 xlog_wait_on_iclo= g(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 =3D=3D 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); > I'm not sure that the rule would detect that now, but it could be made to do that. So this could be useful. julia --===============3836229568987506525==--