From: "yukuai (C)" <yukuai3@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>, <axboe@kernel.dk>,
<josef@toxicpanda.com>, <ming.lei@redhat.com>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<nbd@other.debian.org>, <yi.zhang@huawei.com>
Subject: Re: [PATCH 1/2] blk-mq: add two interfaces to lock/unlock blk_mq_tags->lock
Date: Mon, 9 Aug 2021 09:11:04 +0800 [thread overview]
Message-ID: <115d97bf-8c7f-44e5-7665-9f7f2c8c3c2b@huawei.com> (raw)
In-Reply-To: <1e6b1a1e-eb45-f6c7-a8ce-e534b8cda710@acm.org>
On 2021/08/09 0:44, Bart Van Assche wrote:
> On 8/7/21 8:17 PM, Yu Kuai wrote:
>> +void blk_mq_tags_lock(struct blk_mq_tags *tags, unsigned long *flags)
>> +{
>> + spin_lock_irqsave(&tags->lock, *flags);
>> +}
>> +EXPORT_SYMBOL(blk_mq_tags_lock);
>> +
>> +void blk_mq_tags_unlock(struct blk_mq_tags *tags, unsigned long *flags)
>> +{
>> + spin_unlock_irqrestore(&tags->lock, *flags);
>> +}
>> +EXPORT_SYMBOL(blk_mq_tags_unlock);
>
> The tag map lock is an implementation detail and hence this lock must
> not be used directly by block drivers. I propose to introduce and export
> a new function to block drivers that does the following:
> * Lock tags->lock.
> * Call blk_mq_tag_to_rq().
> * Check whether the request is in the started state. If so, increment
> its reference count.
> * Unlock tags->lock.
Hi, Bart
Thanks for your advice, will do this in next iteration.
Best regards
Kuai
next prev parent reply other threads:[~2021-08-09 1:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 3:17 [PATCH 0/2] fix request uaf in nbd_read_stat() Yu Kuai
2021-08-08 3:17 ` [PATCH 1/2] blk-mq: add two interfaces to lock/unlock blk_mq_tags->lock Yu Kuai
2021-08-08 16:44 ` Bart Van Assche
2021-08-09 1:11 ` yukuai (C) [this message]
2021-08-08 3:17 ` [PATCH 2/2] nbd: hold tags->lock to prevent access freed request through blk_mq_tag_to_rq() Yu Kuai
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=115d97bf-8c7f-44e5-7665-9f7f2c8c3c2b@huawei.com \
--to=yukuai3@huawei.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=nbd@other.debian.org \
--cc=yi.zhang@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
all inboxes | Powered by JetHome®