linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-fsdevel@vger.kernel.org, xiang@kernel.org,
	linux-erofs@lists.ozlabs.org
Subject: Re: [bug report] staging: erofs: tidy up decompression frontend
Date: Thu, 14 Nov 2019 14:00:15 -0800	[thread overview]
Message-ID: <20191114220015.GA20752@bombadil.infradead.org> (raw)
In-Reply-To: <20191114190848.f6tlqpnybagez76g@kili.mountain>

On Thu, Nov 14, 2019 at 10:10:03PM +0300, Dan Carpenter wrote:
> 	fs/erofs/zdata.c:443 z_erofs_register_collection()
> 	error: double unlocked 'cl->lock' (orig line 439)
> 
> fs/erofs/zdata.c
>    432          cl = z_erofs_primarycollection(pcl);
>    433          cl->pageofs = map->m_la & ~PAGE_MASK;
>    434  
>    435          /*
>    436           * lock all primary followed works before visible to others
>    437           * and mutex_trylock *never* fails for a new pcluster.
>    438           */
>    439          mutex_trylock(&cl->lock);
>                 ^^^^^^^^^^^^^^^^^^^^^^^^
>    440  
>    441          err = erofs_register_workgroup(inode->i_sb, &pcl->obj, 0);
>    442          if (err) {
>    443                  mutex_unlock(&cl->lock);
>                         ^^^^^^^^^^^^^^^^^^^^^^^
> How can we unlock if we don't know that the trylock succeeded?

The comment says it'll always succeed.  That said, this is an uncommon
pattern -- usually we just mutex_lock().  If there's a good reason to use
mutex_trylock() instead, then I'd prefer it to be guarded with a BUG_ON.


  reply	other threads:[~2019-11-14 22:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 19:10 [bug report] staging: erofs: tidy up decompression frontend Dan Carpenter
2019-11-14 22:00 ` Matthew Wilcox [this message]
2019-11-15  0:45   ` Gao Xiang via Linux-erofs
2019-11-15  0:45     ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2019-08-27  9:03 Dan Carpenter
2019-08-27  9:36 ` Gao Xiang
2019-08-27  9:53   ` Dan Carpenter
2019-08-27 10:05     ` Gao Xiang
2019-08-27 10:42     ` Dan Carpenter
2019-08-27 10:46       ` Gao Xiang

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=20191114220015.GA20752@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xiang@kernel.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;
as well as URLs for NNTP newsgroup(s).