Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: artem.bityutskiy@linux.intel.com, stable@vger.kernel.org,
	linux-mtd@lists.infradead.org, andy.wangguoli@huawei.com,
	genghui 00204690 <hui.geng@huawei.com>,
	akpm@linux-foundation.org, dwmw2@infradead.org
Subject: Re: [patch 1/4] jffs2: unlock f->sem on error in jffs2_new_inode()
Date: Wed, 5 Mar 2014 23:41:54 -0800	[thread overview]
Message-ID: <20140306074154.GV13420@norris-Latitude-E6410> (raw)
In-Reply-To: <530EF850.4030202@huawei.com>

On Thu, Feb 27, 2014 at 04:33:20PM +0800, Wang Nan wrote:
> On 2014/2/27 14:55, Brian Norris wrote:
> > On Thu, Feb 27, 2014 at 08:53:37AM +0800, Wang Nan wrote:
> >> On 2014/2/26 10:03, Brian Norris wrote:
> >>> On Wed, Feb 12, 2014 at 12:44:54PM -0800, Andrew Morton wrote:
> >>>> From: Wang Guoli <andy.wangguoli@huawei.com>
> >>>> Subject: jffs2: unlock f->sem on error in jffs2_new_inode()
> >>>>
> >>>> If jffs2_new_inode() succeeds, it returns with f->sem held, and the caller
> >>>> is responsible for releasing the lock.  If it fails, it still returns with
> >>>> the lock held, but the caller won't release the lock, which will lead to
> >>>> deadlock.
> >>>
> >>> Have you actually seen a deadlock for this? AFAICT, the error cases for
> >>> jffs2_new_inode() all occur before anyone else actually has a reference
> >>> to the inode, so I don't expect that we should see the deadlock.
> >>>
> >>
> >> We found this bug by reading code. There's no deadlock have been actually seen.
> > 
> > Hmm, then I think maybe we should drop the stable tag. I'm not sure it's
> > a practical issue, and it also has unrelated indentation changes. That
> > means it breaks two of the rules in
> > Documentation/stable_kernel_rules.txt. I'm dropping the stable tag
> > unless someone shouts.
> 
> Thank you for your review, but it is still an obvious bug, isn't it?

Maybe. I'm not really an expert in file systems, but it looks like you
won't ever hit a deadlock, because no one will ever get a reference to
this inode in the error path, and therefore no one will ever try to
re-lock the lock. So while it looks like an inconsistent error path, it
may be benign, and therefore this patch is not really a necessary
bugfix.

Again, I'm not really sure, and I'm not willing to stake a "stable"
patch on code reading by two non-experts with no test case. As I see it,
Documentation/stable_kernel_rules.txt is written for a reason.

> We will work for test case, and will let you know if we successfully
> trigger deadlock.

Yes, please do let me know if you can identify one in practice. Or if
you can convince me how the inode may leak out to cause a deadlock on
the error paths in question.

Brian

      reply	other threads:[~2014-03-06  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140212204454.8FA415A40F6@corp2gmr1-2.hot.corp.google.com>
     [not found] ` <20140226020331.GB4194@ld-irv-0074>
2014-02-26  2:25   ` [patch 1/4] jffs2: unlock f->sem on error in jffs2_new_inode() Brian Norris
     [not found]   ` <530E8C91.4060703@huawei.com>
2014-02-27  6:55     ` Brian Norris
2014-02-27  8:33       ` Wang Nan
2014-03-06  7:41         ` Brian Norris [this message]

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=20140306074154.GV13420@norris-Latitude-E6410 \
    --to=computersforpeace@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy.wangguoli@huawei.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hui.geng@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=wangnan0@huawei.com \
    /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