]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/block/aoe/aoecmd.c
block: fix disk->part[] dereferencing race
[net-next-2.6.git] / drivers / block / aoe / aoecmd.c
index 2f1746295d06fc438ac4b1ba923c2aeb1d634dd8..84c03d65dcc5e5fb930200e091656fe0fb08df41 100644 (file)
@@ -757,11 +757,15 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector
        const int rw = bio_data_dir(bio);
        struct hd_struct *part;
 
-       part = get_part(disk, sector);
+       rcu_read_lock();
+
+       part = disk_map_sector_rcu(disk, sector);
        all_stat_inc(disk, part, ios[rw], sector);
        all_stat_add(disk, part, ticks[rw], duration, sector);
        all_stat_add(disk, part, sectors[rw], n_sect, sector);
        all_stat_add(disk, part, io_ticks, duration, sector);
+
+       rcu_read_unlock();
 }
 
 void