]> 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 41f818be2f7ec8c4c737acaa16ecfeddc94f42b4..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
@@ -1003,7 +1007,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
         * Enough people have their dip switches set backwards to
         * warrant a loud message for this special case.
         */
-       aoemajor = be16_to_cpu(get_unaligned(&h->major));
+       aoemajor = get_unaligned_be16(&h->major);
        if (aoemajor == 0xfff) {
                printk(KERN_ERR "aoe: Warning: shelf address is all ones.  "
                        "Check shelf dip switches.\n");