Linux block layer
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Ming Lei <ming.lei@redhat.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 16:16:40 +0800	[thread overview]
Message-ID: <4b2ac159-a42b-b410-e0ba-19ec86681f48@oracle.com> (raw)
In-Reply-To: <20190319075815.GA28327@ming.t460p>

Hi Ming

On 3/19/19 3:58 PM, Ming Lei wrote:
> 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().

Yes, thanks for your pointing out.
Would you perhaps detail this in the comment ?

Thanks
Jianchao
> 
>>
>>> +	 */
>>> +	smp_mb();
>>
>> smp_mb_before_atomic should be enough.
> 
> Right, will change to it in V2.
> 
> Thanks,
> Ming
> 

      reply	other threads:[~2019-03-19  8:13 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
2019-03-19  8:16     ` jianchao.wang [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=4b2ac159-a42b-b410-e0ba-19ec86681f48@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --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