diff options
-rw-r--r-- | block/blk-map.c | 6 | ||||
-rw-r--r-- | block/genhd.c | 2 | ||||
-rw-r--r-- | block/ioctl.c | 7 | ||||
-rw-r--r-- | drivers/block/xen-blkfront.c | 8 | ||||
-rw-r--r-- | fs/partitions/check.c | 31 | ||||
-rw-r--r-- | include/linux/genhd.h | 4 | ||||
-rw-r--r-- | kernel/relay.c | 9 |
7 files changed, 42 insertions, 25 deletions
diff --git a/block/blk-map.c b/block/blk-map.c index 4849fa36161e..0f4b4b881811 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -217,6 +217,12 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | |||
217 | return PTR_ERR(bio); | 217 | return PTR_ERR(bio); |
218 | 218 | ||
219 | if (bio->bi_size != len) { | 219 | if (bio->bi_size != len) { |
220 | /* | ||
221 | * Grab an extra reference to this bio, as bio_unmap_user() | ||
222 | * expects to be able to drop it twice as it happens on the | ||
223 | * normal IO completion path | ||
224 | */ | ||
225 | bio_get(bio); | ||
220 | bio_endio(bio, 0); | 226 | bio_endio(bio, 0); |
221 | bio_unmap_user(bio); | 227 | bio_unmap_user(bio); |
222 | return -EINVAL; | 228 | return -EINVAL; |
diff --git a/block/genhd.c b/block/genhd.c index 4e5e7493f676..27549e470da5 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -768,6 +768,8 @@ static int __init genhd_device_init(void) | |||
768 | bdev_map = kobj_map_init(base_probe, &block_class_lock); | 768 | bdev_map = kobj_map_init(base_probe, &block_class_lock); |
769 | blk_dev_init(); | 769 | blk_dev_init(); |
770 | 770 | ||
771 | register_blkdev(BLOCK_EXT_MAJOR, "blkext"); | ||
772 | |||
771 | #ifndef CONFIG_SYSFS_DEPRECATED | 773 | #ifndef CONFIG_SYSFS_DEPRECATED |
772 | /* create top-level block dir */ | 774 | /* create top-level block dir */ |
773 | block_depr = kobject_create_and_add("block", NULL); | 775 | block_depr = kobject_create_and_add("block", NULL); |
diff --git a/block/ioctl.c b/block/ioctl.c index c832d639b6e2..d03985b04d67 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -18,7 +18,6 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
18 | struct disk_part_iter piter; | 18 | struct disk_part_iter piter; |
19 | long long start, length; | 19 | long long start, length; |
20 | int partno; | 20 | int partno; |
21 | int err; | ||
22 | 21 | ||
23 | if (!capable(CAP_SYS_ADMIN)) | 22 | if (!capable(CAP_SYS_ADMIN)) |
24 | return -EACCES; | 23 | return -EACCES; |
@@ -61,10 +60,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
61 | disk_part_iter_exit(&piter); | 60 | disk_part_iter_exit(&piter); |
62 | 61 | ||
63 | /* all seems OK */ | 62 | /* all seems OK */ |
64 | err = add_partition(disk, partno, start, length, | 63 | part = add_partition(disk, partno, start, length, |
65 | ADDPART_FLAG_NONE); | 64 | ADDPART_FLAG_NONE); |
66 | mutex_unlock(&bdev->bd_mutex); | 65 | mutex_unlock(&bdev->bd_mutex); |
67 | return err; | 66 | return IS_ERR(part) ? PTR_ERR(part) : 0; |
68 | case BLKPG_DEL_PARTITION: | 67 | case BLKPG_DEL_PARTITION: |
69 | part = disk_get_part(disk, partno); | 68 | part = disk_get_part(disk, partno); |
70 | if (!part) | 69 | if (!part) |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index b220c686089d..2d19f0cc47f2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -338,12 +338,18 @@ wait: | |||
338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | 338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) |
339 | { | 339 | { |
340 | struct request_queue *rq; | 340 | struct request_queue *rq; |
341 | elevator_t *old_e; | ||
341 | 342 | ||
342 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); | 343 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); |
343 | if (rq == NULL) | 344 | if (rq == NULL) |
344 | return -1; | 345 | return -1; |
345 | 346 | ||
346 | elevator_init(rq, "noop"); | 347 | old_e = rq->elevator; |
348 | if (IS_ERR_VALUE(elevator_init(rq, "noop"))) | ||
349 | printk(KERN_WARNING | ||
350 | "blkfront: Switch elevator failed, use default\n"); | ||
351 | else | ||
352 | elevator_exit(old_e); | ||
347 | 353 | ||
348 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | 354 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ |
349 | blk_queue_hardsect_size(rq, sector_size); | 355 | blk_queue_hardsect_size(rq, sector_size); |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 633f7a0ebb2c..6d5b213b8a9b 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -348,8 +348,8 @@ static ssize_t whole_disk_show(struct device *dev, | |||
348 | static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, | 348 | static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, |
349 | whole_disk_show, NULL); | 349 | whole_disk_show, NULL); |
350 | 350 | ||
351 | int add_partition(struct gendisk *disk, int partno, | 351 | struct hd_struct *add_partition(struct gendisk *disk, int partno, |
352 | sector_t start, sector_t len, int flags) | 352 | sector_t start, sector_t len, int flags) |
353 | { | 353 | { |
354 | struct hd_struct *p; | 354 | struct hd_struct *p; |
355 | dev_t devt = MKDEV(0, 0); | 355 | dev_t devt = MKDEV(0, 0); |
@@ -361,15 +361,15 @@ int add_partition(struct gendisk *disk, int partno, | |||
361 | 361 | ||
362 | err = disk_expand_part_tbl(disk, partno); | 362 | err = disk_expand_part_tbl(disk, partno); |
363 | if (err) | 363 | if (err) |
364 | return err; | 364 | return ERR_PTR(err); |
365 | ptbl = disk->part_tbl; | 365 | ptbl = disk->part_tbl; |
366 | 366 | ||
367 | if (ptbl->part[partno]) | 367 | if (ptbl->part[partno]) |
368 | return -EBUSY; | 368 | return ERR_PTR(-EBUSY); |
369 | 369 | ||
370 | p = kzalloc(sizeof(*p), GFP_KERNEL); | 370 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
371 | if (!p) | 371 | if (!p) |
372 | return -ENOMEM; | 372 | return ERR_PTR(-EBUSY); |
373 | 373 | ||
374 | if (!init_part_stats(p)) { | 374 | if (!init_part_stats(p)) { |
375 | err = -ENOMEM; | 375 | err = -ENOMEM; |
@@ -395,7 +395,7 @@ int add_partition(struct gendisk *disk, int partno, | |||
395 | 395 | ||
396 | err = blk_alloc_devt(p, &devt); | 396 | err = blk_alloc_devt(p, &devt); |
397 | if (err) | 397 | if (err) |
398 | goto out_free; | 398 | goto out_free_stats; |
399 | pdev->devt = devt; | 399 | pdev->devt = devt; |
400 | 400 | ||
401 | /* delay uevent until 'holders' subdir is created */ | 401 | /* delay uevent until 'holders' subdir is created */ |
@@ -424,18 +424,20 @@ int add_partition(struct gendisk *disk, int partno, | |||
424 | if (!ddev->uevent_suppress) | 424 | if (!ddev->uevent_suppress) |
425 | kobject_uevent(&pdev->kobj, KOBJ_ADD); | 425 | kobject_uevent(&pdev->kobj, KOBJ_ADD); |
426 | 426 | ||
427 | return 0; | 427 | return p; |
428 | 428 | ||
429 | out_free_stats: | ||
430 | free_part_stats(p); | ||
429 | out_free: | 431 | out_free: |
430 | kfree(p); | 432 | kfree(p); |
431 | return err; | 433 | return ERR_PTR(err); |
432 | out_del: | 434 | out_del: |
433 | kobject_put(p->holder_dir); | 435 | kobject_put(p->holder_dir); |
434 | device_del(pdev); | 436 | device_del(pdev); |
435 | out_put: | 437 | out_put: |
436 | put_device(pdev); | 438 | put_device(pdev); |
437 | blk_free_devt(devt); | 439 | blk_free_devt(devt); |
438 | return err; | 440 | return ERR_PTR(err); |
439 | } | 441 | } |
440 | 442 | ||
441 | /* Not exported, helper to add_disk(). */ | 443 | /* Not exported, helper to add_disk(). */ |
@@ -566,15 +568,16 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | |||
566 | disk->disk_name, p, (unsigned long long) size); | 568 | disk->disk_name, p, (unsigned long long) size); |
567 | size = get_capacity(disk) - from; | 569 | size = get_capacity(disk) - from; |
568 | } | 570 | } |
569 | res = add_partition(disk, p, from, size, state->parts[p].flags); | 571 | part = add_partition(disk, p, from, size, |
570 | if (res) { | 572 | state->parts[p].flags); |
571 | printk(KERN_ERR " %s: p%d could not be added: %d\n", | 573 | if (IS_ERR(part)) { |
572 | disk->disk_name, p, -res); | 574 | printk(KERN_ERR " %s: p%d could not be added: %ld\n", |
575 | disk->disk_name, p, -PTR_ERR(part)); | ||
573 | continue; | 576 | continue; |
574 | } | 577 | } |
575 | #ifdef CONFIG_BLK_DEV_MD | 578 | #ifdef CONFIG_BLK_DEV_MD |
576 | if (state->parts[p].flags & ADDPART_FLAG_RAID) | 579 | if (state->parts[p].flags & ADDPART_FLAG_RAID) |
577 | md_autodetect_dev(bdev->bd_dev+p); | 580 | md_autodetect_dev(part_to_dev(part)->devt); |
578 | #endif | 581 | #endif |
579 | } | 582 | } |
580 | kfree(state); | 583 | kfree(state); |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index e439e6aed832..3df7742ce246 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -522,7 +522,9 @@ extern char *disk_name (struct gendisk *hd, int partno, char *buf); | |||
522 | 522 | ||
523 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | 523 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); |
524 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 524 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
525 | extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); | 525 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
526 | int partno, sector_t start, | ||
527 | sector_t len, int flags); | ||
526 | extern void delete_partition(struct gendisk *, int); | 528 | extern void delete_partition(struct gendisk *, int); |
527 | extern void printk_all_partitions(void); | 529 | extern void printk_all_partitions(void); |
528 | 530 | ||
diff --git a/kernel/relay.c b/kernel/relay.c index 8d13a7855c08..32b0befdcb6a 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -400,7 +400,7 @@ void relay_reset(struct rchan *chan) | |||
400 | } | 400 | } |
401 | 401 | ||
402 | mutex_lock(&relay_channels_mutex); | 402 | mutex_lock(&relay_channels_mutex); |
403 | for_each_online_cpu(i) | 403 | for_each_possible_cpu(i) |
404 | if (chan->buf[i]) | 404 | if (chan->buf[i]) |
405 | __relay_reset(chan->buf[i], 0); | 405 | __relay_reset(chan->buf[i], 0); |
406 | mutex_unlock(&relay_channels_mutex); | 406 | mutex_unlock(&relay_channels_mutex); |
@@ -611,10 +611,9 @@ struct rchan *relay_open(const char *base_filename, | |||
611 | return chan; | 611 | return chan; |
612 | 612 | ||
613 | free_bufs: | 613 | free_bufs: |
614 | for_each_online_cpu(i) { | 614 | for_each_possible_cpu(i) { |
615 | if (!chan->buf[i]) | 615 | if (chan->buf[i]) |
616 | break; | 616 | relay_close_buf(chan->buf[i]); |
617 | relay_close_buf(chan->buf[i]); | ||
618 | } | 617 | } |
619 | 618 | ||
620 | kref_put(&chan->kref, relay_destroy_channel); | 619 | kref_put(&chan->kref, relay_destroy_channel); |