From: Josef Bacik <jbacik@fb.com>
To: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] btrfs: fix waitqueue_active without memory barrier in btrfs
Date: Thu, 8 Oct 2015 21:32:49 -0700 [thread overview]
Message-ID: <56174371.8080107@fb.com> (raw)
In-Reply-To: <17EC94B0A072C34B8DCF0D30AD16044A02874794@BPXM09GP.gisp.nec.co.jp>
On 10/08/2015 05:35 PM, Kosuke Tatsukawa wrote:
> btrfs_bio_counter_sub() seems to be missing a memory barrier which might
> cause the waker to not notice the waiter and miss sending a wake_up as
> in the following figure.
>
> btrfs_bio_counter_sub btrfs_rm_dev_replace_blocked
> ------------------------------------------------------------------------
> if (waitqueue_active(&fs_info->replace_wait))
> /* The CPU might reorder the test for
> the waitqueue up here, before
> prior writes complete */
> /* wait_event */
> /* __wait_event */
> /* ___wait_event */
> long __int = prepare_to_wait_event(&wq,
> &__wait, state);
> if (!percpu_counter_sum(&fs_info->bio_counter))
> percpu_counter_sub(&fs_info->bio_counter,
> amount);
> schedule()
percpu_counter_sub can't be reordered, in its most basic form it does
preempt_disable/enable which in its most basic form does barrier(). Thanks,
Josef
next prev parent reply other threads:[~2015-10-09 4:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 0:35 [PATCH] btrfs: fix waitqueue_active without memory barrier in btrfs Kosuke Tatsukawa
2015-10-09 4:32 ` Josef Bacik [this message]
2015-10-09 4:50 ` Kosuke Tatsukawa
2015-10-09 14:21 ` David Sterba
2015-10-10 5:03 ` Kosuke Tatsukawa
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=56174371.8080107@fb.com \
--to=jbacik@fb.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tatsu@ab.jp.nec.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.