From: Ming Lei <ming.lei@redhat.com>
To: "jianchao.wang" <jianchao.w.wang@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Omar Sandoval <osandov@fb.com>,
Yi Zhang <yi.zhang@redhat.com>
Subject: Re: [PATCH] sbitmap: order RW on old associated instance and setting clear bit
Date: Tue, 19 Mar 2019 15:58:16 +0800 [thread overview]
Message-ID: <20190319075815.GA28327@ming.t460p> (raw)
In-Reply-To: <9e784c48-2865-a14a-d8f4-e6c74f258f48@oracle.com>
On Tue, Mar 19, 2019 at 01:17:31PM +0800, jianchao.wang wrote:
> Hi Ming
>
> On 3/19/19 12:24 PM, Ming Lei wrote:
> > @@ -591,6 +591,15 @@ EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up);
> > void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
> > unsigned int cpu)
> > {
> > + /*
> > + * Once the clear bit is set, it will be visible to allocation
> > + * side.
> > + *
> > + * This memory barrier orders any READ/WRITE on the to-be-freed
> > + * asssociated instance for avoiding potential use-after-free, and
> > + * its pair is the memory barrier implied in sbitmap_get().
> which one ?
test_and_set_bit_lock() in __sbitmap_get_word().
>
> > + */
> > + smp_mb();
>
> smp_mb_before_atomic should be enough.
Right, will change to it in V2.
Thanks,
Ming
next prev parent reply other threads:[~2019-03-19 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 4:24 [PATCH] sbitmap: order RW on old associated instance and setting clear bit Ming Lei
2019-03-19 5:17 ` jianchao.wang
2019-03-19 7:58 ` Ming Lei [this message]
2019-03-19 8:16 ` jianchao.wang
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=20190319075815.GA28327@ming.t460p \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=jianchao.w.wang@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=osandov@fb.com \
--cc=yi.zhang@redhat.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