linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jeff Harris <jefftharris@gmail.com>
Cc: linux-mtd@lists.infradead.org,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org, Jeff Harris <jharris@westell.com>
Subject: Re: [PATCH] jffs2: Re-enable write-buffering after filesystem sync
Date: Fri, 1 Aug 2014 17:56:07 +0100	[thread overview]
Message-ID: <20140801165607.GM18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1406909172-7219-1-git-send-email-jharris@westell.com>

On Fri, Aug 01, 2014 at 12:06:12PM -0400, Jeff Harris wrote:

> +	spin_lock(&c->wbuf_dwork_lock);
>  	cancel_delayed_work_sync(&c->wbuf_dwork);

Umm...  Usually ..._sync in function name is a sign of potential sleeper,
and calling those under a spinlock is a bad idea.

And looking at the definition of cancel_delayed_work_sync() turns up the
following call chain: cancel_delayed_work_sync() -> __cancel_work_timer() ->
flush_work() -> wait_for_completion(), which definitely isn't something
you should ever do under a spinlock.

While we are at it, you follow that with
> +	c->wbuf_queued = 0;
> +	spin_lock(&c->wbuf_dwork_lock);
which would be broken even if cancel_delayed_work_sync() hadn't blocked.
That's easily fixed, of course, (s/lock/unlock/).  cancel_delayed_work_sync()
under a spinlock is more serious...

  reply	other threads:[~2014-08-01 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 16:06 [PATCH] jffs2: Re-enable write-buffering after filesystem sync Jeff Harris
2014-08-01 16:56 ` Al Viro [this message]
2014-08-01 17:15   ` Jeff Harris
2014-08-01 19:13     ` Al Viro
2014-08-04 18:02       ` Jeff Harris

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=20140801165607.GM18016@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=jefftharris@gmail.com \
    --cc=jharris@westell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.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;
as well as URLs for NNTP newsgroup(s).