diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-mpath.c | 8 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 32 | ||||
-rw-r--r-- | drivers/md/dm-snap.h | 2 | ||||
-rw-r--r-- | drivers/md/dm-stripe.c | 4 | ||||
-rw-r--r-- | drivers/md/dm.c | 34 | ||||
-rw-r--r-- | drivers/md/linear.c | 2 | ||||
-rw-r--r-- | drivers/md/md.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 2 |
9 files changed, 63 insertions, 26 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 4840733cd903..3d7f4923cd13 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -441,13 +441,13 @@ static void process_queued_ios(struct work_struct *work) | |||
441 | __choose_pgpath(m); | 441 | __choose_pgpath(m); |
442 | 442 | ||
443 | pgpath = m->current_pgpath; | 443 | pgpath = m->current_pgpath; |
444 | m->pgpath_to_activate = m->current_pgpath; | ||
445 | 444 | ||
446 | if ((pgpath && !m->queue_io) || | 445 | if ((pgpath && !m->queue_io) || |
447 | (!pgpath && !m->queue_if_no_path)) | 446 | (!pgpath && !m->queue_if_no_path)) |
448 | must_queue = 0; | 447 | must_queue = 0; |
449 | 448 | ||
450 | if (m->pg_init_required && !m->pg_init_in_progress) { | 449 | if (m->pg_init_required && !m->pg_init_in_progress && pgpath) { |
450 | m->pgpath_to_activate = pgpath; | ||
451 | m->pg_init_count++; | 451 | m->pg_init_count++; |
452 | m->pg_init_required = 0; | 452 | m->pg_init_required = 0; |
453 | m->pg_init_in_progress = 1; | 453 | m->pg_init_in_progress = 1; |
@@ -708,6 +708,10 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m) | |||
708 | m->hw_handler_name = NULL; | 708 | m->hw_handler_name = NULL; |
709 | return -EINVAL; | 709 | return -EINVAL; |
710 | } | 710 | } |
711 | |||
712 | if (hw_argc > 1) | ||
713 | DMWARN("Ignoring user-specified arguments for " | ||
714 | "hardware handler \"%s\"", m->hw_handler_name); | ||
711 | consume(as, hw_argc - 1); | 715 | consume(as, hw_argc - 1); |
712 | 716 | ||
713 | return 0; | 717 | return 0; |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 92dcc06832a4..ec43f9fa4b2a 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -656,9 +656,10 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures) | |||
656 | return; | 656 | return; |
657 | 657 | ||
658 | if (!ms->log_failure) { | 658 | if (!ms->log_failure) { |
659 | while ((bio = bio_list_pop(failures))) | 659 | while ((bio = bio_list_pop(failures))) { |
660 | ms->in_sync = 0; | 660 | ms->in_sync = 0; |
661 | dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); | 661 | dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); |
662 | } | ||
662 | return; | 663 | return; |
663 | } | 664 | } |
664 | 665 | ||
@@ -1031,6 +1032,7 @@ static void mirror_dtr(struct dm_target *ti) | |||
1031 | 1032 | ||
1032 | del_timer_sync(&ms->timer); | 1033 | del_timer_sync(&ms->timer); |
1033 | flush_workqueue(ms->kmirrord_wq); | 1034 | flush_workqueue(ms->kmirrord_wq); |
1035 | flush_scheduled_work(); | ||
1034 | dm_kcopyd_client_destroy(ms->kcopyd_client); | 1036 | dm_kcopyd_client_destroy(ms->kcopyd_client); |
1035 | destroy_workqueue(ms->kmirrord_wq); | 1037 | destroy_workqueue(ms->kmirrord_wq); |
1036 | free_context(ms, ti, ms->nr_mirrors); | 1038 | free_context(ms, ti, ms->nr_mirrors); |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index b2d9d1ac28ad..6c96db26b87c 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -229,19 +229,21 @@ static void __insert_origin(struct origin *o) | |||
229 | */ | 229 | */ |
230 | static int register_snapshot(struct dm_snapshot *snap) | 230 | static int register_snapshot(struct dm_snapshot *snap) |
231 | { | 231 | { |
232 | struct origin *o; | 232 | struct origin *o, *new_o; |
233 | struct block_device *bdev = snap->origin->bdev; | 233 | struct block_device *bdev = snap->origin->bdev; |
234 | 234 | ||
235 | new_o = kmalloc(sizeof(*new_o), GFP_KERNEL); | ||
236 | if (!new_o) | ||
237 | return -ENOMEM; | ||
238 | |||
235 | down_write(&_origins_lock); | 239 | down_write(&_origins_lock); |
236 | o = __lookup_origin(bdev); | 240 | o = __lookup_origin(bdev); |
237 | 241 | ||
238 | if (!o) { | 242 | if (o) |
243 | kfree(new_o); | ||
244 | else { | ||
239 | /* New origin */ | 245 | /* New origin */ |
240 | o = kmalloc(sizeof(*o), GFP_KERNEL); | 246 | o = new_o; |
241 | if (!o) { | ||
242 | up_write(&_origins_lock); | ||
243 | return -ENOMEM; | ||
244 | } | ||
245 | 247 | ||
246 | /* Initialise the struct */ | 248 | /* Initialise the struct */ |
247 | INIT_LIST_HEAD(&o->snapshots); | 249 | INIT_LIST_HEAD(&o->snapshots); |
@@ -368,6 +370,7 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps | |||
368 | struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool, | 370 | struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool, |
369 | GFP_NOIO); | 371 | GFP_NOIO); |
370 | 372 | ||
373 | atomic_inc(&s->pending_exceptions_count); | ||
371 | pe->snap = s; | 374 | pe->snap = s; |
372 | 375 | ||
373 | return pe; | 376 | return pe; |
@@ -375,7 +378,11 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps | |||
375 | 378 | ||
376 | static void free_pending_exception(struct dm_snap_pending_exception *pe) | 379 | static void free_pending_exception(struct dm_snap_pending_exception *pe) |
377 | { | 380 | { |
378 | mempool_free(pe, pe->snap->pending_pool); | 381 | struct dm_snapshot *s = pe->snap; |
382 | |||
383 | mempool_free(pe, s->pending_pool); | ||
384 | smp_mb__before_atomic_dec(); | ||
385 | atomic_dec(&s->pending_exceptions_count); | ||
379 | } | 386 | } |
380 | 387 | ||
381 | static void insert_completed_exception(struct dm_snapshot *s, | 388 | static void insert_completed_exception(struct dm_snapshot *s, |
@@ -600,6 +607,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
600 | 607 | ||
601 | s->valid = 1; | 608 | s->valid = 1; |
602 | s->active = 0; | 609 | s->active = 0; |
610 | atomic_set(&s->pending_exceptions_count, 0); | ||
603 | init_rwsem(&s->lock); | 611 | init_rwsem(&s->lock); |
604 | spin_lock_init(&s->pe_lock); | 612 | spin_lock_init(&s->pe_lock); |
605 | s->ti = ti; | 613 | s->ti = ti; |
@@ -726,6 +734,14 @@ static void snapshot_dtr(struct dm_target *ti) | |||
726 | /* After this returns there can be no new kcopyd jobs. */ | 734 | /* After this returns there can be no new kcopyd jobs. */ |
727 | unregister_snapshot(s); | 735 | unregister_snapshot(s); |
728 | 736 | ||
737 | while (atomic_read(&s->pending_exceptions_count)) | ||
738 | yield(); | ||
739 | /* | ||
740 | * Ensure instructions in mempool_destroy aren't reordered | ||
741 | * before atomic_read. | ||
742 | */ | ||
743 | smp_mb(); | ||
744 | |||
729 | #ifdef CONFIG_DM_DEBUG | 745 | #ifdef CONFIG_DM_DEBUG |
730 | for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++) | 746 | for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++) |
731 | BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i])); | 747 | BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i])); |
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h index f07315fe2362..99c0106ede2d 100644 --- a/drivers/md/dm-snap.h +++ b/drivers/md/dm-snap.h | |||
@@ -160,6 +160,8 @@ struct dm_snapshot { | |||
160 | 160 | ||
161 | mempool_t *pending_pool; | 161 | mempool_t *pending_pool; |
162 | 162 | ||
163 | atomic_t pending_exceptions_count; | ||
164 | |||
163 | struct exception_table pending; | 165 | struct exception_table pending; |
164 | struct exception_table complete; | 166 | struct exception_table complete; |
165 | 167 | ||
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index a2d068dbe9e2..9e4ef88d421e 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -320,8 +320,10 @@ int __init dm_stripe_init(void) | |||
320 | int r; | 320 | int r; |
321 | 321 | ||
322 | r = dm_register_target(&stripe_target); | 322 | r = dm_register_target(&stripe_target); |
323 | if (r < 0) | 323 | if (r < 0) { |
324 | DMWARN("target registration failed"); | 324 | DMWARN("target registration failed"); |
325 | return r; | ||
326 | } | ||
325 | 327 | ||
326 | kstriped = create_singlethread_workqueue("kstriped"); | 328 | kstriped = create_singlethread_workqueue("kstriped"); |
327 | if (!kstriped) { | 329 | if (!kstriped) { |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6963ad148408..c99e4728ff41 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -375,7 +375,7 @@ static void start_io_acct(struct dm_io *io) | |||
375 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); | 375 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); |
376 | } | 376 | } |
377 | 377 | ||
378 | static int end_io_acct(struct dm_io *io) | 378 | static void end_io_acct(struct dm_io *io) |
379 | { | 379 | { |
380 | struct mapped_device *md = io->md; | 380 | struct mapped_device *md = io->md; |
381 | struct bio *bio = io->bio; | 381 | struct bio *bio = io->bio; |
@@ -391,7 +391,9 @@ static int end_io_acct(struct dm_io *io) | |||
391 | dm_disk(md)->part0.in_flight = pending = | 391 | dm_disk(md)->part0.in_flight = pending = |
392 | atomic_dec_return(&md->pending); | 392 | atomic_dec_return(&md->pending); |
393 | 393 | ||
394 | return !pending; | 394 | /* nudge anyone waiting on suspend queue */ |
395 | if (!pending) | ||
396 | wake_up(&md->wait); | ||
395 | } | 397 | } |
396 | 398 | ||
397 | /* | 399 | /* |
@@ -499,9 +501,7 @@ static void dec_pending(struct dm_io *io, int error) | |||
499 | spin_unlock_irqrestore(&io->md->pushback_lock, flags); | 501 | spin_unlock_irqrestore(&io->md->pushback_lock, flags); |
500 | } | 502 | } |
501 | 503 | ||
502 | if (end_io_acct(io)) | 504 | end_io_acct(io); |
503 | /* nudge anyone waiting on suspend queue */ | ||
504 | wake_up(&io->md->wait); | ||
505 | 505 | ||
506 | if (io->error != DM_ENDIO_REQUEUE) { | 506 | if (io->error != DM_ENDIO_REQUEUE) { |
507 | blk_add_trace_bio(io->md->queue, io->bio, | 507 | blk_add_trace_bio(io->md->queue, io->bio, |
@@ -937,16 +937,24 @@ static void dm_unplug_all(struct request_queue *q) | |||
937 | 937 | ||
938 | static int dm_any_congested(void *congested_data, int bdi_bits) | 938 | static int dm_any_congested(void *congested_data, int bdi_bits) |
939 | { | 939 | { |
940 | int r; | 940 | int r = bdi_bits; |
941 | struct mapped_device *md = (struct mapped_device *) congested_data; | 941 | struct mapped_device *md = congested_data; |
942 | struct dm_table *map = dm_get_table(md); | 942 | struct dm_table *map; |
943 | 943 | ||
944 | if (!map || test_bit(DMF_BLOCK_IO, &md->flags)) | 944 | atomic_inc(&md->pending); |
945 | r = bdi_bits; | 945 | |
946 | else | 946 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { |
947 | r = dm_table_any_congested(map, bdi_bits); | 947 | map = dm_get_table(md); |
948 | if (map) { | ||
949 | r = dm_table_any_congested(map, bdi_bits); | ||
950 | dm_table_put(map); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | if (!atomic_dec_return(&md->pending)) | ||
955 | /* nudge anyone waiting on suspend queue */ | ||
956 | wake_up(&md->wait); | ||
948 | 957 | ||
949 | dm_table_put(map); | ||
950 | return r; | 958 | return r; |
951 | } | 959 | } |
952 | 960 | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 190147c79e79..3b90c5c924ec 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -148,6 +148,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
148 | 148 | ||
149 | min_sectors = conf->array_sectors; | 149 | min_sectors = conf->array_sectors; |
150 | sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); | 150 | sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); |
151 | if (min_sectors == 0) | ||
152 | min_sectors = 1; | ||
151 | 153 | ||
152 | /* min_sectors is the minimum spacing that will fit the hash | 154 | /* min_sectors is the minimum spacing that will fit the hash |
153 | * table in one PAGE. This may be much smaller than needed. | 155 | * table in one PAGE. This may be much smaller than needed. |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b4162f6f1b79..1b1d32694f6f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3940,6 +3940,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
3940 | mddev->degraded = 0; | 3940 | mddev->degraded = 0; |
3941 | mddev->barriers_work = 0; | 3941 | mddev->barriers_work = 0; |
3942 | mddev->safemode = 0; | 3942 | mddev->safemode = 0; |
3943 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | ||
3943 | 3944 | ||
3944 | } else if (mddev->pers) | 3945 | } else if (mddev->pers) |
3945 | printk(KERN_INFO "md: %s switched to read-only mode.\n", | 3946 | printk(KERN_INFO "md: %s switched to read-only mode.\n", |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index da5129a24b18..970a96ef9b18 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1137,7 +1137,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1137 | if (!enough(conf)) | 1137 | if (!enough(conf)) |
1138 | return -EINVAL; | 1138 | return -EINVAL; |
1139 | 1139 | ||
1140 | if (rdev->raid_disk) | 1140 | if (rdev->raid_disk >= 0) |
1141 | first = last = rdev->raid_disk; | 1141 | first = last = rdev->raid_disk; |
1142 | 1142 | ||
1143 | if (rdev->saved_raid_disk >= 0 && | 1143 | if (rdev->saved_raid_disk >= 0 && |