lkml.org 
[lkml]   [2024]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC v2 2/6] blk-throttle: delay initialization until configuration
Hello,

On Sat, Apr 06, 2024 at 04:00:55PM +0800, Yu Kuai wrote:
> @@ -1480,6 +1547,9 @@ void blk_throtl_cancel_bios(struct gendisk *disk)
> struct cgroup_subsys_state *pos_css;
> struct blkcg_gq *blkg;
>
> + if (!q->td)
> + return;

So, this naked test is safe because the interface functions are shut down by
the time this function is called.

> static inline bool blk_should_throtl(struct bio *bio)
> {
> - struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg);
> + struct throtl_grp *tg;
> int rw = bio_data_dir(bio);
>
> + if (!bio->bi_bdev->bd_queue->td)
> + return false;

and this one because ->td is set while the queue is frozen and this path
shouldn't be running while it gets set, right?

Can you please add comments explaining why those are safe? Otherwise, the
patch looks generally sane to me on the first glance. Can you please also
add how you tested the change?

Thanks.

--
tejun

\
 
 \ /
  Last update: 2024-04-12 19:59    [W:0.150 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site