Commit 9c0c4d24 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'block-5.15-2021-10-22' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "Fix for the cgroup code not ussing irq safe stats updates, and one fix
  for an error handling condition in add_partition()"

* tag 'block-5.15-2021-10-22' of git://git.kernel.dk/linux-block:
  block: fix incorrect references to disk objects
  blk-cgroup: blk_cgroup_bio_start() should use irq-safe operations on blkg->iostat_cpu
parents da4d34b6 9fbfabfd
...@@ -1897,10 +1897,11 @@ void blk_cgroup_bio_start(struct bio *bio) ...@@ -1897,10 +1897,11 @@ void blk_cgroup_bio_start(struct bio *bio)
{ {
int rwd = blk_cgroup_io_type(bio), cpu; int rwd = blk_cgroup_io_type(bio), cpu;
struct blkg_iostat_set *bis; struct blkg_iostat_set *bis;
unsigned long flags;
cpu = get_cpu(); cpu = get_cpu();
bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu); bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu);
u64_stats_update_begin(&bis->sync); flags = u64_stats_update_begin_irqsave(&bis->sync);
/* /*
* If the bio is flagged with BIO_CGROUP_ACCT it means this is a split * If the bio is flagged with BIO_CGROUP_ACCT it means this is a split
...@@ -1912,7 +1913,7 @@ void blk_cgroup_bio_start(struct bio *bio) ...@@ -1912,7 +1913,7 @@ void blk_cgroup_bio_start(struct bio *bio)
} }
bis->cur.ios[rwd]++; bis->cur.ios[rwd]++;
u64_stats_update_end(&bis->sync); u64_stats_update_end_irqrestore(&bis->sync, flags);
if (cgroup_subsys_on_dfl(io_cgrp_subsys)) if (cgroup_subsys_on_dfl(io_cgrp_subsys))
cgroup_rstat_updated(bio->bi_blkg->blkcg->css.cgroup, cpu); cgroup_rstat_updated(bio->bi_blkg->blkcg->css.cgroup, cpu);
put_cpu(); put_cpu();
......
...@@ -423,6 +423,7 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, ...@@ -423,6 +423,7 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
device_del(pdev); device_del(pdev);
out_put: out_put:
put_device(pdev); put_device(pdev);
return ERR_PTR(err);
out_put_disk: out_put_disk:
put_disk(disk); put_disk(disk);
return ERR_PTR(err); return ERR_PTR(err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment