From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XYBEK-0004Ck-JF for linux-mtd@lists.infradead.org; Sun, 28 Sep 2014 09:57:25 +0000 Date: Sun, 28 Sep 2014 02:56:50 -0700 From: Josh Triplett To: Fabian Frederick Subject: Re: [PATCH 1/1] jffs2: fix sparse warning: unexpected unlock Message-ID: <20140928095650.GA24178@thin> References: <1411065976-20386-1-git-send-email-fabf@skynet.be> <20140922181250.GN1193@ld-irv-0074> <20140926231727.GD20917@cloud> <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> Content-Transfer-Encoding: quoted-printable Cc: David Woodhouse , linux-sparse@vger.kernel.org, Brian Norris , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, Sep 27, 2014 at 10:41:55AM +0200, Fabian Frederick wrote: >=20 >=20 > > On 27 September 2014 at 01:17 josh@joshtriplett.org wrote: > > > > > > On Mon, Sep 22, 2014 at 11:12:50AM -0700, Brian Norris wrote: > > > + linux-sparse > > > > > > On Thu, Sep 18, 2014 at 08:46:16PM +0200, Fabian Frederick wrote: > > > > fs/jffs2/summary.c:846:5: warning: context imbalance in > > > > 'jffs2_sum_write_sumnode' - unexpected unlock > > > > > > > > Signed-off-by: Fabian Frederick > > > > --- > > > >=A0 fs/jffs2/summary.c | 2 ++ > > > >=A0 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c > > > > index c522d09..a0bac7b 100644 > > > > --- a/fs/jffs2/summary.c > > > > +++ b/fs/jffs2/summary.c > > > > @@ -844,6 +844,8 @@ static int jffs2_sum_write_data(struct jffs2_= sb_info > > > > *c, struct jffs2_eraseblock > > > >=A0 /* Write out summary information - called from jffs2_do_reserv= e_space */ > > > >=A0 > > > >=A0 int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) > > > > + __releases(&c->erase_completion_lock) > > > > + __acquires(&c->erase_completion_lock) > > > > > > I'm not too familiar with sparse notations, but Documentation/spars= e.txt > > > suggests the above is wrong, and the following is more accurate: > > > > > >=A0 =A0 =A0__must_hold(&c->erase_completion_lock) > > > > > > But it looks like there are several other examples which do this. > > > Anyway, here's the relevant doc text, in case someone wants to clar= ify > > > it for me, or else tell me the documentation is wrong: > > > > > >=A0 =A0 =A0__must_hold - The specified lock is held on function entr= y and exit. > > > > > >=A0 =A0 =A0__acquires - The specified lock is held on function exit,= but not entry. > > > > > >=A0 =A0 =A0__releases - The specified lock is held on function entry= , but not exit. > > > > > > So __acquires and __releases look mutually exclusive, but it's not = clear > > > if __must_hold will actually cover what we want. (I haven't tested = it.) > > > > __must_hold is indeed the correct annotation.=A0 (There isn't current= ly > > anything enforcing that, though.) > > > > - Josh Triplett >=20 > There are 137 __releases && __acquires annotated functions in stable. >=20 > AFAICS those are based on lock held on function entry / lock held on ex= it >=20 > See > fs/fuse/file.c:1527 > fs/kernfs/dir.c:341 > drivers/block/nbd.c:564 >=20 > Does it mean that all of these should be updated to __must_hold ? Not really worth changing yet until something actually pays closer attention to those annotations. - Josh Triplett From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Triplett Subject: Re: [PATCH 1/1] jffs2: fix sparse warning: unexpected unlock Date: Sun, 28 Sep 2014 02:56:50 -0700 Message-ID: <20140928095650.GA24178@thin> References: <1411065976-20386-1-git-send-email-fabf@skynet.be> <20140922181250.GN1193@ld-irv-0074> <20140926231727.GD20917@cloud> <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from relay6-d.mail.gandi.net ([217.70.183.198]:37428 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbaI1J5C convert rfc822-to-8bit (ORCPT ); Sun, 28 Sep 2014 05:57:02 -0400 Content-Disposition: inline In-Reply-To: <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Fabian Frederick Cc: Brian Norris , linux-mtd@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org On Sat, Sep 27, 2014 at 10:41:55AM +0200, Fabian Frederick wrote: >=20 >=20 > > On 27 September 2014 at 01:17 josh@joshtriplett.org wrote: > > > > > > On Mon, Sep 22, 2014 at 11:12:50AM -0700, Brian Norris wrote: > > > + linux-sparse > > > > > > On Thu, Sep 18, 2014 at 08:46:16PM +0200, Fabian Frederick wrote: > > > > fs/jffs2/summary.c:846:5: warning: context imbalance in > > > > 'jffs2_sum_write_sumnode' - unexpected unlock > > > > > > > > Signed-off-by: Fabian Frederick > > > > --- > > > >=A0 fs/jffs2/summary.c | 2 ++ > > > >=A0 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c > > > > index c522d09..a0bac7b 100644 > > > > --- a/fs/jffs2/summary.c > > > > +++ b/fs/jffs2/summary.c > > > > @@ -844,6 +844,8 @@ static int jffs2_sum_write_data(struct jffs= 2_sb_info > > > > *c, struct jffs2_eraseblock > > > >=A0 /* Write out summary information - called from jffs2_do_rese= rve_space */ > > > >=A0 > > > >=A0 int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) > > > > + __releases(&c->erase_completion_lock) > > > > + __acquires(&c->erase_completion_lock) > > > > > > I'm not too familiar with sparse notations, but Documentation/spa= rse.txt > > > suggests the above is wrong, and the following is more accurate: > > > > > >=A0 =A0 =A0__must_hold(&c->erase_completion_lock) > > > > > > But it looks like there are several other examples which do this. > > > Anyway, here's the relevant doc text, in case someone wants to cl= arify > > > it for me, or else tell me the documentation is wrong: > > > > > >=A0 =A0 =A0__must_hold - The specified lock is held on function en= try and exit. > > > > > >=A0 =A0 =A0__acquires - The specified lock is held on function exi= t, but not entry. > > > > > >=A0 =A0 =A0__releases - The specified lock is held on function ent= ry, but not exit. > > > > > > So __acquires and __releases look mutually exclusive, but it's no= t clear > > > if __must_hold will actually cover what we want. (I haven't teste= d it.) > > > > __must_hold is indeed the correct annotation.=A0 (There isn't curre= ntly > > anything enforcing that, though.) > > > > - Josh Triplett >=20 > There are 137 __releases && __acquires annotated functions in stable. >=20 > AFAICS those are based on lock held on function entry / lock held on = exit >=20 > See > fs/fuse/file.c:1527 > fs/kernfs/dir.c:341 > drivers/block/nbd.c:564 >=20 > Does it mean that all of these should be updated to __must_hold ? Not really worth changing yet until something actually pays closer attention to those annotations. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-sparse"= in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753641AbaI1J5F (ORCPT ); Sun, 28 Sep 2014 05:57:05 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:37428 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbaI1J5C convert rfc822-to-8bit (ORCPT ); Sun, 28 Sep 2014 05:57:02 -0400 X-Originating-IP: 50.43.15.134 Date: Sun, 28 Sep 2014 02:56:50 -0700 From: Josh Triplett To: Fabian Frederick Cc: Brian Norris , linux-mtd@lists.infradead.org, David Woodhouse , linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org Subject: Re: [PATCH 1/1] jffs2: fix sparse warning: unexpected unlock Message-ID: <20140928095650.GA24178@thin> References: <1411065976-20386-1-git-send-email-fabf@skynet.be> <20140922181250.GN1193@ld-irv-0074> <20140926231727.GD20917@cloud> <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1745266822.710655.1411807315752.open-xchange@webmail.nmp.skynet.be> User-Agent: Mutt/1.5.23 (2014-03-12) Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 27, 2014 at 10:41:55AM +0200, Fabian Frederick wrote: > > > > On 27 September 2014 at 01:17 josh@joshtriplett.org wrote: > > > > > > On Mon, Sep 22, 2014 at 11:12:50AM -0700, Brian Norris wrote: > > > + linux-sparse > > > > > > On Thu, Sep 18, 2014 at 08:46:16PM +0200, Fabian Frederick wrote: > > > > fs/jffs2/summary.c:846:5: warning: context imbalance in > > > > 'jffs2_sum_write_sumnode' - unexpected unlock > > > > > > > > Signed-off-by: Fabian Frederick > > > > --- > > > >  fs/jffs2/summary.c | 2 ++ > > > >  1 file changed, 2 insertions(+) > > > > > > > > diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c > > > > index c522d09..a0bac7b 100644 > > > > --- a/fs/jffs2/summary.c > > > > +++ b/fs/jffs2/summary.c > > > > @@ -844,6 +844,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info > > > > *c, struct jffs2_eraseblock > > > >  /* Write out summary information - called from jffs2_do_reserve_space */ > > > >  > > > >  int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) > > > > + __releases(&c->erase_completion_lock) > > > > + __acquires(&c->erase_completion_lock) > > > > > > I'm not too familiar with sparse notations, but Documentation/sparse.txt > > > suggests the above is wrong, and the following is more accurate: > > > > > >     __must_hold(&c->erase_completion_lock) > > > > > > But it looks like there are several other examples which do this. > > > Anyway, here's the relevant doc text, in case someone wants to clarify > > > it for me, or else tell me the documentation is wrong: > > > > > >     __must_hold - The specified lock is held on function entry and exit. > > > > > >     __acquires - The specified lock is held on function exit, but not entry. > > > > > >     __releases - The specified lock is held on function entry, but not exit. > > > > > > So __acquires and __releases look mutually exclusive, but it's not clear > > > if __must_hold will actually cover what we want. (I haven't tested it.) > > > > __must_hold is indeed the correct annotation.  (There isn't currently > > anything enforcing that, though.) > > > > - Josh Triplett > > There are 137 __releases && __acquires annotated functions in stable. > > AFAICS those are based on lock held on function entry / lock held on exit > > See > fs/fuse/file.c:1527 > fs/kernfs/dir.c:341 > drivers/block/nbd.c:564 > > Does it mean that all of these should be updated to __must_hold ? Not really worth changing yet until something actually pays closer attention to those annotations. - Josh Triplett