cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: QiuLaibin <qiulaibin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH -next] blk-throttle: Set BIO_THROTTLED when bio has been throttled
Date: Mon, 13 Dec 2021 10:12:30 -1000	[thread overview]
Message-ID: <YbepLpyMPqP2ao3J@slm.duckdns.org> (raw)
In-Reply-To: <03964258-10ff-7f19-10cb-ca4eccf72848-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

On Mon, Dec 13, 2021 at 05:24:00PM +0800, QiuLaibin wrote:
> > * This function is called synchronously on the issue path. The bio isn't
> >    seen by the queue and device driver yet and nothing can race to issue it
> >    before this function returns.
> > 
> 
> The bio is under throttle here, this submit_bio return directly. And
> current process will queue a dispatch work by
> throtl_schedule_pending_timer() to submit this bio before BIO_THROTTLED flag
> set. If the bio is completed quickly after the dispatch work is queued, UAF
> of bio will happen.

You are right, the timer can get to it. Can't it be solved by just
reordering spin_unlock and setting BIO_THROTTLED?

> > * Now we're not setting BIO_THROTTLED when we're taking a different return
> >    path through the out_unlock label and risks calling back into blk_throtl
> >    again on the same bio.
> > 
> 
> In my opinion, This flag can prevent the request from being throttled
> multiple times. If the request itself does not need to be throttled, the
> result of repeated entry will be the same.
> If necessary, I think we can use other methods to achieve this effect for
> request does not need to be throttled.

So that we don't change anything regarding this?

Thanks.

-- 
tejun

  parent reply	other threads:[~2021-12-13 20:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 13:15 [PATCH -next] blk-throttle: Set BIO_THROTTLED when bio has been throttled Laibin Qiu
     [not found] ` <20211118131551.810931-1-qiulaibin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2021-11-29 18:16   ` Tejun Heo
     [not found]     ` <YaUZExR6v8IdZUeM-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2021-12-13  9:24       ` QiuLaibin
     [not found]         ` <03964258-10ff-7f19-10cb-ca4eccf72848-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2021-12-13 20:12           ` Tejun Heo [this message]
     [not found]             ` <YbepLpyMPqP2ao3J-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2021-12-14  9:12               ` QiuLaibin
2022-01-06 19:52                 ` Tejun Heo

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=YbepLpyMPqP2ao3J@slm.duckdns.org \
    --to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=qiulaibin-hv44wF8Li93QT0dZR+AlfA@public.gmane.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).