aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c3
-rw-r--r--drivers/md/bitmap.h3
-rw-r--r--drivers/md/dm-log-userspace-transfer.c2
-rw-r--r--drivers/md/dm-mpath.c4
-rw-r--r--drivers/md/dm-raid.c4
-rw-r--r--drivers/md/dm-thin.c16
-rw-r--r--drivers/md/md.c7
7 files changed, 22 insertions, 17 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 97e73e555d11..17e2b472e16d 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1727,8 +1727,7 @@ int bitmap_create(struct mddev *mddev)
1727 bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) 1727 bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize)
1728 - BITMAP_BLOCK_SHIFT); 1728 - BITMAP_BLOCK_SHIFT);
1729 1729
1730 /* now that chunksize and chunkshift are set, we can use these macros */ 1730 chunks = (blocks + (1 << bitmap->chunkshift) - 1) >>
1731 chunks = (blocks + bitmap->chunkshift - 1) >>
1732 bitmap->chunkshift; 1731 bitmap->chunkshift;
1733 pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; 1732 pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
1734 1733
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
index 55ca5aec84e4..b44b0aba2d47 100644
--- a/drivers/md/bitmap.h
+++ b/drivers/md/bitmap.h
@@ -101,9 +101,6 @@ typedef __u16 bitmap_counter_t;
101 101
102#define BITMAP_BLOCK_SHIFT 9 102#define BITMAP_BLOCK_SHIFT 9
103 103
104/* how many blocks per chunk? (this is variable) */
105#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT)
106
107#endif 104#endif
108 105
109/* 106/*
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index 1f23e048f077..08d9a207259a 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
134{ 134{
135 struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); 135 struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
136 136
137 if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) 137 if (!capable(CAP_SYS_ADMIN))
138 return; 138 return;
139 139
140 spin_lock(&receiving_list_lock); 140 spin_lock(&receiving_list_lock);
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 922a3385eead..754f38f8a692 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -718,8 +718,8 @@ static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m)
718 return 0; 718 return 0;
719 719
720 m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); 720 m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL);
721 request_module("scsi_dh_%s", m->hw_handler_name); 721 if (!try_then_request_module(scsi_dh_handler_exist(m->hw_handler_name),
722 if (scsi_dh_handler_exist(m->hw_handler_name) == 0) { 722 "scsi_dh_%s", m->hw_handler_name)) {
723 ti->error = "unknown hardware handler type"; 723 ti->error = "unknown hardware handler type";
724 ret = -EINVAL; 724 ret = -EINVAL;
725 goto fail; 725 goto fail;
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index b0ba52459ed7..68965e663248 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
859 int ret; 859 int ret;
860 unsigned redundancy = 0; 860 unsigned redundancy = 0;
861 struct raid_dev *dev; 861 struct raid_dev *dev;
862 struct md_rdev *rdev, *freshest; 862 struct md_rdev *rdev, *tmp, *freshest;
863 struct mddev *mddev = &rs->md; 863 struct mddev *mddev = &rs->md;
864 864
865 switch (rs->raid_type->level) { 865 switch (rs->raid_type->level) {
@@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
877 } 877 }
878 878
879 freshest = NULL; 879 freshest = NULL;
880 rdev_for_each(rdev, mddev) { 880 rdev_for_each_safe(rdev, tmp, mddev) {
881 if (!rdev->meta_bdev) 881 if (!rdev->meta_bdev)
882 continue; 882 continue;
883 883
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 213ae32a0fc4..2fd87b544a93 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -279,8 +279,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates)
279 279
280 hlist_del(&cell->list); 280 hlist_del(&cell->list);
281 281
282 bio_list_add(inmates, cell->holder); 282 if (inmates) {
283 bio_list_merge(inmates, &cell->bios); 283 bio_list_add(inmates, cell->holder);
284 bio_list_merge(inmates, &cell->bios);
285 }
284 286
285 mempool_free(cell, prison->cell_pool); 287 mempool_free(cell, prison->cell_pool);
286} 288}
@@ -303,9 +305,10 @@ static void cell_release(struct cell *cell, struct bio_list *bios)
303 */ 305 */
304static void __cell_release_singleton(struct cell *cell, struct bio *bio) 306static void __cell_release_singleton(struct cell *cell, struct bio *bio)
305{ 307{
306 hlist_del(&cell->list);
307 BUG_ON(cell->holder != bio); 308 BUG_ON(cell->holder != bio);
308 BUG_ON(!bio_list_empty(&cell->bios)); 309 BUG_ON(!bio_list_empty(&cell->bios));
310
311 __cell_release(cell, NULL);
309} 312}
310 313
311static void cell_release_singleton(struct cell *cell, struct bio *bio) 314static void cell_release_singleton(struct cell *cell, struct bio *bio)
@@ -1177,6 +1180,7 @@ static void no_space(struct cell *cell)
1177static void process_discard(struct thin_c *tc, struct bio *bio) 1180static void process_discard(struct thin_c *tc, struct bio *bio)
1178{ 1181{
1179 int r; 1182 int r;
1183 unsigned long flags;
1180 struct pool *pool = tc->pool; 1184 struct pool *pool = tc->pool;
1181 struct cell *cell, *cell2; 1185 struct cell *cell, *cell2;
1182 struct cell_key key, key2; 1186 struct cell_key key, key2;
@@ -1218,7 +1222,9 @@ static void process_discard(struct thin_c *tc, struct bio *bio)
1218 m->bio = bio; 1222 m->bio = bio;
1219 1223
1220 if (!ds_add_work(&pool->all_io_ds, &m->list)) { 1224 if (!ds_add_work(&pool->all_io_ds, &m->list)) {
1225 spin_lock_irqsave(&pool->lock, flags);
1221 list_add(&m->list, &pool->prepared_discards); 1226 list_add(&m->list, &pool->prepared_discards);
1227 spin_unlock_irqrestore(&pool->lock, flags);
1222 wake_worker(pool); 1228 wake_worker(pool);
1223 } 1229 }
1224 } else { 1230 } else {
@@ -2626,8 +2632,10 @@ static int thin_endio(struct dm_target *ti,
2626 if (h->all_io_entry) { 2632 if (h->all_io_entry) {
2627 INIT_LIST_HEAD(&work); 2633 INIT_LIST_HEAD(&work);
2628 ds_dec(h->all_io_entry, &work); 2634 ds_dec(h->all_io_entry, &work);
2635 spin_lock_irqsave(&pool->lock, flags);
2629 list_for_each_entry_safe(m, tmp, &work, list) 2636 list_for_each_entry_safe(m, tmp, &work, list)
2630 list_add(&m->list, &pool->prepared_discards); 2637 list_add(&m->list, &pool->prepared_discards);
2638 spin_unlock_irqrestore(&pool->lock, flags);
2631 } 2639 }
2632 2640
2633 mempool_free(h, pool->endio_hook_pool); 2641 mempool_free(h, pool->endio_hook_pool);
@@ -2759,6 +2767,6 @@ static void dm_thin_exit(void)
2759module_init(dm_thin_init); 2767module_init(dm_thin_init);
2760module_exit(dm_thin_exit); 2768module_exit(dm_thin_exit);
2761 2769
2762MODULE_DESCRIPTION(DM_NAME "device-mapper thin provisioning target"); 2770MODULE_DESCRIPTION(DM_NAME " thin provisioning target");
2763MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); 2771MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
2764MODULE_LICENSE("GPL"); 2772MODULE_LICENSE("GPL");
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b572e1e386ce..477eb2e180c0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev)
7560 * any transients in the value of "sync_action". 7560 * any transients in the value of "sync_action".
7561 */ 7561 */
7562 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); 7562 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
7563 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
7564 /* Clear some bits that don't mean anything, but 7563 /* Clear some bits that don't mean anything, but
7565 * might be left set 7564 * might be left set
7566 */ 7565 */
7567 clear_bit(MD_RECOVERY_INTR, &mddev->recovery); 7566 clear_bit(MD_RECOVERY_INTR, &mddev->recovery);
7568 clear_bit(MD_RECOVERY_DONE, &mddev->recovery); 7567 clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
7569 7568
7570 if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) 7569 if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
7570 test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
7571 goto unlock; 7571 goto unlock;
7572 /* no recovery is running. 7572 /* no recovery is running.
7573 * remove any failed drives, then 7573 * remove any failed drives, then
@@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this,
8140 8140
8141 for_each_mddev(mddev, tmp) { 8141 for_each_mddev(mddev, tmp) {
8142 if (mddev_trylock(mddev)) { 8142 if (mddev_trylock(mddev)) {
8143 __md_stop_writes(mddev); 8143 if (mddev->pers)
8144 __md_stop_writes(mddev);
8144 mddev->safemode = 2; 8145 mddev->safemode = 2;
8145 mddev_unlock(mddev); 8146 mddev_unlock(mddev);
8146 } 8147 }