diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-16 19:38:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-16 19:38:08 -0400 |
commit | 761ab7664b30ed907f55da7f6966d4537f36d9ff (patch) | |
tree | 737df4a5abffe6d36891406e609b25142d967a4c | |
parent | f76d94def5605fbec1de61218e91fe1002fd322f (diff) | |
parent | e56f698bd0720e17f10f39e8b0b5b446ad0ab22c (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
"A collection of fixes from the last few weeks that should go into the
current series. This contains:
- Various fixes for the per-blkcg policy data, fixing regressions
since 4.1. From Arianna and Tejun
- Code cleanup for bcache closure macros from me. Really just
flushing this out, it's been sitting in another branch for months
- FIELD_SIZEOF cleanup from Maninder Singh
- bio integrity oops fix from Mike
- Timeout regression fix for blk-mq from Ming Lei"
* 'for-linus' of git://git.kernel.dk/linux-block:
blk-mq: set default timeout as 30 seconds
NVMe: Reread partitions on metadata formats
bcache: don't embed 'return' statements in closure macros
blkcg: fix blkcg_policy_data allocation bug
blkcg: implement all_blkcgs list
blkcg: blkcg_css_alloc() should grab blkcg_pol_mutex while iterating blkcg_policy[]
blkcg: allow blkcg_pol_mutex to be grabbed from cgroup [file] methods
block/blk-cgroup.c: free per-blkcg data when freeing the blkcg
block: use FIELD_SIZEOF to calculate size of a field
bio integrity: do not assume bio_integrity_pool exists if bioset exists
-rw-r--r-- | block/bio-integrity.c | 4 | ||||
-rw-r--r-- | block/blk-cgroup.c | 140 | ||||
-rw-r--r-- | block/blk-core.c | 2 | ||||
-rw-r--r-- | block/blk-mq.c | 2 | ||||
-rw-r--r-- | drivers/block/nvme-core.c | 13 | ||||
-rw-r--r-- | drivers/md/bcache/closure.h | 3 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/journal.c | 2 | ||||
-rw-r--r-- | drivers/md/bcache/request.c | 14 | ||||
-rw-r--r-- | include/linux/blk-cgroup.h | 11 |
10 files changed, 113 insertions, 79 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 0436c21db7f2..719b7152aed1 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c | |||
@@ -51,7 +51,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, | |||
51 | unsigned long idx = BIO_POOL_NONE; | 51 | unsigned long idx = BIO_POOL_NONE; |
52 | unsigned inline_vecs; | 52 | unsigned inline_vecs; |
53 | 53 | ||
54 | if (!bs) { | 54 | if (!bs || !bs->bio_integrity_pool) { |
55 | bip = kmalloc(sizeof(struct bio_integrity_payload) + | 55 | bip = kmalloc(sizeof(struct bio_integrity_payload) + |
56 | sizeof(struct bio_vec) * nr_vecs, gfp_mask); | 56 | sizeof(struct bio_vec) * nr_vecs, gfp_mask); |
57 | inline_vecs = nr_vecs; | 57 | inline_vecs = nr_vecs; |
@@ -104,7 +104,7 @@ void bio_integrity_free(struct bio *bio) | |||
104 | kfree(page_address(bip->bip_vec->bv_page) + | 104 | kfree(page_address(bip->bip_vec->bv_page) + |
105 | bip->bip_vec->bv_offset); | 105 | bip->bip_vec->bv_offset); |
106 | 106 | ||
107 | if (bs) { | 107 | if (bs && bs->bio_integrity_pool) { |
108 | if (bip->bip_slab != BIO_POOL_NONE) | 108 | if (bip->bip_slab != BIO_POOL_NONE) |
109 | bvec_free(bs->bvec_integrity_pool, bip->bip_vec, | 109 | bvec_free(bs->bvec_integrity_pool, bip->bip_vec, |
110 | bip->bip_slab); | 110 | bip->bip_slab); |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 9f97da52d006..9da02c021ebe 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -29,6 +29,14 @@ | |||
29 | 29 | ||
30 | #define MAX_KEY_LEN 100 | 30 | #define MAX_KEY_LEN 100 |
31 | 31 | ||
32 | /* | ||
33 | * blkcg_pol_mutex protects blkcg_policy[] and policy [de]activation. | ||
34 | * blkcg_pol_register_mutex nests outside of it and synchronizes entire | ||
35 | * policy [un]register operations including cgroup file additions / | ||
36 | * removals. Putting cgroup file registration outside blkcg_pol_mutex | ||
37 | * allows grabbing it from cgroup callbacks. | ||
38 | */ | ||
39 | static DEFINE_MUTEX(blkcg_pol_register_mutex); | ||
32 | static DEFINE_MUTEX(blkcg_pol_mutex); | 40 | static DEFINE_MUTEX(blkcg_pol_mutex); |
33 | 41 | ||
34 | struct blkcg blkcg_root; | 42 | struct blkcg blkcg_root; |
@@ -38,6 +46,8 @@ struct cgroup_subsys_state * const blkcg_root_css = &blkcg_root.css; | |||
38 | 46 | ||
39 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; | 47 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; |
40 | 48 | ||
49 | static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */ | ||
50 | |||
41 | static bool blkcg_policy_enabled(struct request_queue *q, | 51 | static bool blkcg_policy_enabled(struct request_queue *q, |
42 | const struct blkcg_policy *pol) | 52 | const struct blkcg_policy *pol) |
43 | { | 53 | { |
@@ -453,20 +463,7 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css, | |||
453 | struct blkcg_gq *blkg; | 463 | struct blkcg_gq *blkg; |
454 | int i; | 464 | int i; |
455 | 465 | ||
456 | /* | 466 | mutex_lock(&blkcg_pol_mutex); |
457 | * XXX: We invoke cgroup_add/rm_cftypes() under blkcg_pol_mutex | ||
458 | * which ends up putting cgroup's internal cgroup_tree_mutex under | ||
459 | * it; however, cgroup_tree_mutex is nested above cgroup file | ||
460 | * active protection and grabbing blkcg_pol_mutex from a cgroup | ||
461 | * file operation creates a possible circular dependency. cgroup | ||
462 | * internal locking is planned to go through further simplification | ||
463 | * and this issue should go away soon. For now, let's trylock | ||
464 | * blkcg_pol_mutex and restart the write on failure. | ||
465 | * | ||
466 | * http://lkml.kernel.org/g/5363C04B.4010400@oracle.com | ||
467 | */ | ||
468 | if (!mutex_trylock(&blkcg_pol_mutex)) | ||
469 | return restart_syscall(); | ||
470 | spin_lock_irq(&blkcg->lock); | 467 | spin_lock_irq(&blkcg->lock); |
471 | 468 | ||
472 | /* | 469 | /* |
@@ -822,8 +819,17 @@ static void blkcg_css_free(struct cgroup_subsys_state *css) | |||
822 | { | 819 | { |
823 | struct blkcg *blkcg = css_to_blkcg(css); | 820 | struct blkcg *blkcg = css_to_blkcg(css); |
824 | 821 | ||
825 | if (blkcg != &blkcg_root) | 822 | mutex_lock(&blkcg_pol_mutex); |
823 | list_del(&blkcg->all_blkcgs_node); | ||
824 | mutex_unlock(&blkcg_pol_mutex); | ||
825 | |||
826 | if (blkcg != &blkcg_root) { | ||
827 | int i; | ||
828 | |||
829 | for (i = 0; i < BLKCG_MAX_POLS; i++) | ||
830 | kfree(blkcg->pd[i]); | ||
826 | kfree(blkcg); | 831 | kfree(blkcg); |
832 | } | ||
827 | } | 833 | } |
828 | 834 | ||
829 | static struct cgroup_subsys_state * | 835 | static struct cgroup_subsys_state * |
@@ -833,6 +839,8 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css) | |||
833 | struct cgroup_subsys_state *ret; | 839 | struct cgroup_subsys_state *ret; |
834 | int i; | 840 | int i; |
835 | 841 | ||
842 | mutex_lock(&blkcg_pol_mutex); | ||
843 | |||
836 | if (!parent_css) { | 844 | if (!parent_css) { |
837 | blkcg = &blkcg_root; | 845 | blkcg = &blkcg_root; |
838 | goto done; | 846 | goto done; |
@@ -875,14 +883,17 @@ done: | |||
875 | #ifdef CONFIG_CGROUP_WRITEBACK | 883 | #ifdef CONFIG_CGROUP_WRITEBACK |
876 | INIT_LIST_HEAD(&blkcg->cgwb_list); | 884 | INIT_LIST_HEAD(&blkcg->cgwb_list); |
877 | #endif | 885 | #endif |
886 | list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); | ||
887 | |||
888 | mutex_unlock(&blkcg_pol_mutex); | ||
878 | return &blkcg->css; | 889 | return &blkcg->css; |
879 | 890 | ||
880 | free_pd_blkcg: | 891 | free_pd_blkcg: |
881 | for (i--; i >= 0; i--) | 892 | for (i--; i >= 0; i--) |
882 | kfree(blkcg->pd[i]); | 893 | kfree(blkcg->pd[i]); |
883 | |||
884 | free_blkcg: | 894 | free_blkcg: |
885 | kfree(blkcg); | 895 | kfree(blkcg); |
896 | mutex_unlock(&blkcg_pol_mutex); | ||
886 | return ret; | 897 | return ret; |
887 | } | 898 | } |
888 | 899 | ||
@@ -1037,10 +1048,8 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1037 | const struct blkcg_policy *pol) | 1048 | const struct blkcg_policy *pol) |
1038 | { | 1049 | { |
1039 | LIST_HEAD(pds); | 1050 | LIST_HEAD(pds); |
1040 | LIST_HEAD(cpds); | ||
1041 | struct blkcg_gq *blkg; | 1051 | struct blkcg_gq *blkg; |
1042 | struct blkg_policy_data *pd, *nd; | 1052 | struct blkg_policy_data *pd, *nd; |
1043 | struct blkcg_policy_data *cpd, *cnd; | ||
1044 | int cnt = 0, ret; | 1053 | int cnt = 0, ret; |
1045 | 1054 | ||
1046 | if (blkcg_policy_enabled(q, pol)) | 1055 | if (blkcg_policy_enabled(q, pol)) |
@@ -1053,10 +1062,7 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1053 | cnt++; | 1062 | cnt++; |
1054 | spin_unlock_irq(q->queue_lock); | 1063 | spin_unlock_irq(q->queue_lock); |
1055 | 1064 | ||
1056 | /* | 1065 | /* allocate per-blkg policy data for all existing blkgs */ |
1057 | * Allocate per-blkg and per-blkcg policy data | ||
1058 | * for all existing blkgs. | ||
1059 | */ | ||
1060 | while (cnt--) { | 1066 | while (cnt--) { |
1061 | pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node); | 1067 | pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node); |
1062 | if (!pd) { | 1068 | if (!pd) { |
@@ -1064,15 +1070,6 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1064 | goto out_free; | 1070 | goto out_free; |
1065 | } | 1071 | } |
1066 | list_add_tail(&pd->alloc_node, &pds); | 1072 | list_add_tail(&pd->alloc_node, &pds); |
1067 | |||
1068 | if (!pol->cpd_size) | ||
1069 | continue; | ||
1070 | cpd = kzalloc_node(pol->cpd_size, GFP_KERNEL, q->node); | ||
1071 | if (!cpd) { | ||
1072 | ret = -ENOMEM; | ||
1073 | goto out_free; | ||
1074 | } | ||
1075 | list_add_tail(&cpd->alloc_node, &cpds); | ||
1076 | } | 1073 | } |
1077 | 1074 | ||
1078 | /* | 1075 | /* |
@@ -1082,32 +1079,17 @@ int blkcg_activate_policy(struct request_queue *q, | |||
1082 | spin_lock_irq(q->queue_lock); | 1079 | spin_lock_irq(q->queue_lock); |
1083 | 1080 | ||
1084 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | 1081 | list_for_each_entry(blkg, &q->blkg_list, q_node) { |
1085 | if (WARN_ON(list_empty(&pds)) || | 1082 | if (WARN_ON(list_empty(&pds))) { |
1086 | WARN_ON(pol->cpd_size && list_empty(&cpds))) { | ||
1087 | /* umm... this shouldn't happen, just abort */ | 1083 | /* umm... this shouldn't happen, just abort */ |
1088 | ret = -ENOMEM; | 1084 | ret = -ENOMEM; |
1089 | goto out_unlock; | 1085 | goto out_unlock; |
1090 | } | 1086 | } |
1091 | cpd = list_first_entry(&cpds, struct blkcg_policy_data, | ||
1092 | alloc_node); | ||
1093 | list_del_init(&cpd->alloc_node); | ||
1094 | pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node); | 1087 | pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node); |
1095 | list_del_init(&pd->alloc_node); | 1088 | list_del_init(&pd->alloc_node); |
1096 | 1089 | ||
1097 | /* grab blkcg lock too while installing @pd on @blkg */ | 1090 | /* grab blkcg lock too while installing @pd on @blkg */ |
1098 | spin_lock(&blkg->blkcg->lock); | 1091 | spin_lock(&blkg->blkcg->lock); |
1099 | 1092 | ||
1100 | if (!pol->cpd_size) | ||
1101 | goto no_cpd; | ||
1102 | if (!blkg->blkcg->pd[pol->plid]) { | ||
1103 | /* Per-policy per-blkcg data */ | ||
1104 | blkg->blkcg->pd[pol->plid] = cpd; | ||
1105 | cpd->plid = pol->plid; | ||
1106 | pol->cpd_init_fn(blkg->blkcg); | ||
1107 | } else { /* must free it as it has already been extracted */ | ||
1108 | kfree(cpd); | ||
1109 | } | ||
1110 | no_cpd: | ||
1111 | blkg->pd[pol->plid] = pd; | 1093 | blkg->pd[pol->plid] = pd; |
1112 | pd->blkg = blkg; | 1094 | pd->blkg = blkg; |
1113 | pd->plid = pol->plid; | 1095 | pd->plid = pol->plid; |
@@ -1124,8 +1106,6 @@ out_free: | |||
1124 | blk_queue_bypass_end(q); | 1106 | blk_queue_bypass_end(q); |
1125 | list_for_each_entry_safe(pd, nd, &pds, alloc_node) | 1107 | list_for_each_entry_safe(pd, nd, &pds, alloc_node) |
1126 | kfree(pd); | 1108 | kfree(pd); |
1127 | list_for_each_entry_safe(cpd, cnd, &cpds, alloc_node) | ||
1128 | kfree(cpd); | ||
1129 | return ret; | 1109 | return ret; |
1130 | } | 1110 | } |
1131 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); | 1111 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); |
@@ -1162,8 +1142,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
1162 | 1142 | ||
1163 | kfree(blkg->pd[pol->plid]); | 1143 | kfree(blkg->pd[pol->plid]); |
1164 | blkg->pd[pol->plid] = NULL; | 1144 | blkg->pd[pol->plid] = NULL; |
1165 | kfree(blkg->blkcg->pd[pol->plid]); | ||
1166 | blkg->blkcg->pd[pol->plid] = NULL; | ||
1167 | 1145 | ||
1168 | spin_unlock(&blkg->blkcg->lock); | 1146 | spin_unlock(&blkg->blkcg->lock); |
1169 | } | 1147 | } |
@@ -1182,11 +1160,13 @@ EXPORT_SYMBOL_GPL(blkcg_deactivate_policy); | |||
1182 | */ | 1160 | */ |
1183 | int blkcg_policy_register(struct blkcg_policy *pol) | 1161 | int blkcg_policy_register(struct blkcg_policy *pol) |
1184 | { | 1162 | { |
1163 | struct blkcg *blkcg; | ||
1185 | int i, ret; | 1164 | int i, ret; |
1186 | 1165 | ||
1187 | if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data))) | 1166 | if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data))) |
1188 | return -EINVAL; | 1167 | return -EINVAL; |
1189 | 1168 | ||
1169 | mutex_lock(&blkcg_pol_register_mutex); | ||
1190 | mutex_lock(&blkcg_pol_mutex); | 1170 | mutex_lock(&blkcg_pol_mutex); |
1191 | 1171 | ||
1192 | /* find an empty slot */ | 1172 | /* find an empty slot */ |
@@ -1195,19 +1175,49 @@ int blkcg_policy_register(struct blkcg_policy *pol) | |||
1195 | if (!blkcg_policy[i]) | 1175 | if (!blkcg_policy[i]) |
1196 | break; | 1176 | break; |
1197 | if (i >= BLKCG_MAX_POLS) | 1177 | if (i >= BLKCG_MAX_POLS) |
1198 | goto out_unlock; | 1178 | goto err_unlock; |
1199 | 1179 | ||
1200 | /* register and update blkgs */ | 1180 | /* register @pol */ |
1201 | pol->plid = i; | 1181 | pol->plid = i; |
1202 | blkcg_policy[i] = pol; | 1182 | blkcg_policy[pol->plid] = pol; |
1183 | |||
1184 | /* allocate and install cpd's */ | ||
1185 | if (pol->cpd_size) { | ||
1186 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1187 | struct blkcg_policy_data *cpd; | ||
1188 | |||
1189 | cpd = kzalloc(pol->cpd_size, GFP_KERNEL); | ||
1190 | if (!cpd) { | ||
1191 | mutex_unlock(&blkcg_pol_mutex); | ||
1192 | goto err_free_cpds; | ||
1193 | } | ||
1194 | |||
1195 | blkcg->pd[pol->plid] = cpd; | ||
1196 | cpd->plid = pol->plid; | ||
1197 | pol->cpd_init_fn(blkcg); | ||
1198 | } | ||
1199 | } | ||
1200 | |||
1201 | mutex_unlock(&blkcg_pol_mutex); | ||
1203 | 1202 | ||
1204 | /* everything is in place, add intf files for the new policy */ | 1203 | /* everything is in place, add intf files for the new policy */ |
1205 | if (pol->cftypes) | 1204 | if (pol->cftypes) |
1206 | WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys, | 1205 | WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys, |
1207 | pol->cftypes)); | 1206 | pol->cftypes)); |
1208 | ret = 0; | 1207 | mutex_unlock(&blkcg_pol_register_mutex); |
1209 | out_unlock: | 1208 | return 0; |
1209 | |||
1210 | err_free_cpds: | ||
1211 | if (pol->cpd_size) { | ||
1212 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1213 | kfree(blkcg->pd[pol->plid]); | ||
1214 | blkcg->pd[pol->plid] = NULL; | ||
1215 | } | ||
1216 | } | ||
1217 | blkcg_policy[pol->plid] = NULL; | ||
1218 | err_unlock: | ||
1210 | mutex_unlock(&blkcg_pol_mutex); | 1219 | mutex_unlock(&blkcg_pol_mutex); |
1220 | mutex_unlock(&blkcg_pol_register_mutex); | ||
1211 | return ret; | 1221 | return ret; |
1212 | } | 1222 | } |
1213 | EXPORT_SYMBOL_GPL(blkcg_policy_register); | 1223 | EXPORT_SYMBOL_GPL(blkcg_policy_register); |
@@ -1220,7 +1230,9 @@ EXPORT_SYMBOL_GPL(blkcg_policy_register); | |||
1220 | */ | 1230 | */ |
1221 | void blkcg_policy_unregister(struct blkcg_policy *pol) | 1231 | void blkcg_policy_unregister(struct blkcg_policy *pol) |
1222 | { | 1232 | { |
1223 | mutex_lock(&blkcg_pol_mutex); | 1233 | struct blkcg *blkcg; |
1234 | |||
1235 | mutex_lock(&blkcg_pol_register_mutex); | ||
1224 | 1236 | ||
1225 | if (WARN_ON(blkcg_policy[pol->plid] != pol)) | 1237 | if (WARN_ON(blkcg_policy[pol->plid] != pol)) |
1226 | goto out_unlock; | 1238 | goto out_unlock; |
@@ -1229,9 +1241,19 @@ void blkcg_policy_unregister(struct blkcg_policy *pol) | |||
1229 | if (pol->cftypes) | 1241 | if (pol->cftypes) |
1230 | cgroup_rm_cftypes(pol->cftypes); | 1242 | cgroup_rm_cftypes(pol->cftypes); |
1231 | 1243 | ||
1232 | /* unregister and update blkgs */ | 1244 | /* remove cpds and unregister */ |
1245 | mutex_lock(&blkcg_pol_mutex); | ||
1246 | |||
1247 | if (pol->cpd_size) { | ||
1248 | list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { | ||
1249 | kfree(blkcg->pd[pol->plid]); | ||
1250 | blkcg->pd[pol->plid] = NULL; | ||
1251 | } | ||
1252 | } | ||
1233 | blkcg_policy[pol->plid] = NULL; | 1253 | blkcg_policy[pol->plid] = NULL; |
1234 | out_unlock: | 1254 | |
1235 | mutex_unlock(&blkcg_pol_mutex); | 1255 | mutex_unlock(&blkcg_pol_mutex); |
1256 | out_unlock: | ||
1257 | mutex_unlock(&blkcg_pol_register_mutex); | ||
1236 | } | 1258 | } |
1237 | EXPORT_SYMBOL_GPL(blkcg_policy_unregister); | 1259 | EXPORT_SYMBOL_GPL(blkcg_policy_unregister); |
diff --git a/block/blk-core.c b/block/blk-core.c index 82819e68f58b..627ed0c593fb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -3370,7 +3370,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume); | |||
3370 | int __init blk_dev_init(void) | 3370 | int __init blk_dev_init(void) |
3371 | { | 3371 | { |
3372 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * | 3372 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * |
3373 | sizeof(((struct request *)0)->cmd_flags)); | 3373 | FIELD_SIZEOF(struct request, cmd_flags)); |
3374 | 3374 | ||
3375 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ | 3375 | /* used for unplugging and affects IO latency/throughput - HIGHPRI */ |
3376 | kblockd_workqueue = alloc_workqueue("kblockd", | 3376 | kblockd_workqueue = alloc_workqueue("kblockd", |
diff --git a/block/blk-mq.c b/block/blk-mq.c index f53779692c77..7d842db59699 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1998,7 +1998,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, | |||
1998 | goto err_hctxs; | 1998 | goto err_hctxs; |
1999 | 1999 | ||
2000 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); | 2000 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); |
2001 | blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30000); | 2001 | blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30 * HZ); |
2002 | 2002 | ||
2003 | q->nr_queues = nr_cpu_ids; | 2003 | q->nr_queues = nr_cpu_ids; |
2004 | q->nr_hw_queues = set->nr_hw_queues; | 2004 | q->nr_hw_queues = set->nr_hw_queues; |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index d1d6141920d3..7920c2741b47 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -2108,8 +2108,17 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid) | |||
2108 | goto out_free_disk; | 2108 | goto out_free_disk; |
2109 | 2109 | ||
2110 | add_disk(ns->disk); | 2110 | add_disk(ns->disk); |
2111 | if (ns->ms) | 2111 | if (ns->ms) { |
2112 | revalidate_disk(ns->disk); | 2112 | struct block_device *bd = bdget_disk(ns->disk, 0); |
2113 | if (!bd) | ||
2114 | return; | ||
2115 | if (blkdev_get(bd, FMODE_READ, NULL)) { | ||
2116 | bdput(bd); | ||
2117 | return; | ||
2118 | } | ||
2119 | blkdev_reread_part(bd); | ||
2120 | blkdev_put(bd, FMODE_READ); | ||
2121 | } | ||
2113 | return; | 2122 | return; |
2114 | out_free_disk: | 2123 | out_free_disk: |
2115 | kfree(disk); | 2124 | kfree(disk); |
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h index a08e3eeac3c5..79a6d63e8ed3 100644 --- a/drivers/md/bcache/closure.h +++ b/drivers/md/bcache/closure.h | |||
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struct closure_waitlist *list) | |||
320 | do { \ | 320 | do { \ |
321 | set_closure_fn(_cl, _fn, _wq); \ | 321 | set_closure_fn(_cl, _fn, _wq); \ |
322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ | 322 | closure_sub(_cl, CLOSURE_RUNNING + 1); \ |
323 | return; \ | ||
324 | } while (0) | 323 | } while (0) |
325 | 324 | ||
326 | /** | 325 | /** |
@@ -349,7 +348,6 @@ do { \ | |||
349 | do { \ | 348 | do { \ |
350 | set_closure_fn(_cl, _fn, _wq); \ | 349 | set_closure_fn(_cl, _fn, _wq); \ |
351 | closure_queue(_cl); \ | 350 | closure_queue(_cl); \ |
352 | return; \ | ||
353 | } while (0) | 351 | } while (0) |
354 | 352 | ||
355 | /** | 353 | /** |
@@ -365,7 +363,6 @@ do { \ | |||
365 | do { \ | 363 | do { \ |
366 | set_closure_fn(_cl, _destructor, NULL); \ | 364 | set_closure_fn(_cl, _destructor, NULL); \ |
367 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ | 365 | closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ |
368 | return; \ | ||
369 | } while (0) | 366 | } while (0) |
370 | 367 | ||
371 | /** | 368 | /** |
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index cb64e64a4789..bf6a9ca18403 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c | |||
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p) | |||
105 | } while (n != bio); | 105 | } while (n != bio); |
106 | 106 | ||
107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); | 107 | continue_at(&s->cl, bch_bio_submit_split_done, NULL); |
108 | return; | ||
108 | submit: | 109 | submit: |
109 | generic_make_request(bio); | 110 | generic_make_request(bio); |
110 | } | 111 | } |
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ce64fc851251..418607a6ba33 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
@@ -592,12 +592,14 @@ static void journal_write_unlocked(struct closure *cl) | |||
592 | 592 | ||
593 | if (!w->need_write) { | 593 | if (!w->need_write) { |
594 | closure_return_with_destructor(cl, journal_write_unlock); | 594 | closure_return_with_destructor(cl, journal_write_unlock); |
595 | return; | ||
595 | } else if (journal_full(&c->journal)) { | 596 | } else if (journal_full(&c->journal)) { |
596 | journal_reclaim(c); | 597 | journal_reclaim(c); |
597 | spin_unlock(&c->journal.lock); | 598 | spin_unlock(&c->journal.lock); |
598 | 599 | ||
599 | btree_flush_write(c); | 600 | btree_flush_write(c); |
600 | continue_at(cl, journal_write, system_wq); | 601 | continue_at(cl, journal_write, system_wq); |
602 | return; | ||
601 | } | 603 | } |
602 | 604 | ||
603 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); | 605 | c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 4afb2d26b148..f292790997d7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl) | |||
88 | if (journal_ref) | 88 | if (journal_ref) |
89 | atomic_dec_bug(journal_ref); | 89 | atomic_dec_bug(journal_ref); |
90 | 90 | ||
91 | if (!op->insert_data_done) | 91 | if (!op->insert_data_done) { |
92 | continue_at(cl, bch_data_insert_start, op->wq); | 92 | continue_at(cl, bch_data_insert_start, op->wq); |
93 | return; | ||
94 | } | ||
93 | 95 | ||
94 | bch_keylist_free(&op->insert_keys); | 96 | bch_keylist_free(&op->insert_keys); |
95 | closure_return(cl); | 97 | closure_return(cl); |
@@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl) | |||
216 | /* 1 for the device pointer and 1 for the chksum */ | 218 | /* 1 for the device pointer and 1 for the chksum */ |
217 | if (bch_keylist_realloc(&op->insert_keys, | 219 | if (bch_keylist_realloc(&op->insert_keys, |
218 | 3 + (op->csum ? 1 : 0), | 220 | 3 + (op->csum ? 1 : 0), |
219 | op->c)) | 221 | op->c)) { |
220 | continue_at(cl, bch_data_insert_keys, op->wq); | 222 | continue_at(cl, bch_data_insert_keys, op->wq); |
223 | return; | ||
224 | } | ||
221 | 225 | ||
222 | k = op->insert_keys.top; | 226 | k = op->insert_keys.top; |
223 | bkey_init(k); | 227 | bkey_init(k); |
@@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl) | |||
255 | 259 | ||
256 | op->insert_data_done = true; | 260 | op->insert_data_done = true; |
257 | continue_at(cl, bch_data_insert_keys, op->wq); | 261 | continue_at(cl, bch_data_insert_keys, op->wq); |
262 | return; | ||
258 | err: | 263 | err: |
259 | /* bch_alloc_sectors() blocks if s->writeback = true */ | 264 | /* bch_alloc_sectors() blocks if s->writeback = true */ |
260 | BUG_ON(op->writeback); | 265 | BUG_ON(op->writeback); |
@@ -576,8 +581,10 @@ static void cache_lookup(struct closure *cl) | |||
576 | ret = bch_btree_map_keys(&s->op, s->iop.c, | 581 | ret = bch_btree_map_keys(&s->op, s->iop.c, |
577 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), | 582 | &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), |
578 | cache_lookup_fn, MAP_END_KEY); | 583 | cache_lookup_fn, MAP_END_KEY); |
579 | if (ret == -EAGAIN) | 584 | if (ret == -EAGAIN) { |
580 | continue_at(cl, cache_lookup, bcache_wq); | 585 | continue_at(cl, cache_lookup, bcache_wq); |
586 | return; | ||
587 | } | ||
581 | 588 | ||
582 | closure_return(cl); | 589 | closure_return(cl); |
583 | } | 590 | } |
@@ -1085,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio) | |||
1085 | continue_at_nobarrier(&s->cl, | 1092 | continue_at_nobarrier(&s->cl, |
1086 | flash_dev_nodata, | 1093 | flash_dev_nodata, |
1087 | bcache_wq); | 1094 | bcache_wq); |
1095 | return; | ||
1088 | } else if (rw) { | 1096 | } else if (rw) { |
1089 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, | 1097 | bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, |
1090 | &KEY(d->id, bio->bi_iter.bi_sector, 0), | 1098 | &KEY(d->id, bio->bi_iter.bi_sector, 0), |
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 58cfab80dd70..1b62d768c7df 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
@@ -47,6 +47,7 @@ struct blkcg { | |||
47 | 47 | ||
48 | struct blkcg_policy_data *pd[BLKCG_MAX_POLS]; | 48 | struct blkcg_policy_data *pd[BLKCG_MAX_POLS]; |
49 | 49 | ||
50 | struct list_head all_blkcgs_node; | ||
50 | #ifdef CONFIG_CGROUP_WRITEBACK | 51 | #ifdef CONFIG_CGROUP_WRITEBACK |
51 | struct list_head cgwb_list; | 52 | struct list_head cgwb_list; |
52 | #endif | 53 | #endif |
@@ -88,18 +89,12 @@ struct blkg_policy_data { | |||
88 | * Policies that need to keep per-blkcg data which is independent | 89 | * Policies that need to keep per-blkcg data which is independent |
89 | * from any request_queue associated to it must specify its size | 90 | * from any request_queue associated to it must specify its size |
90 | * with the cpd_size field of the blkcg_policy structure and | 91 | * with the cpd_size field of the blkcg_policy structure and |
91 | * embed a blkcg_policy_data in it. blkcg core allocates | 92 | * embed a blkcg_policy_data in it. cpd_init() is invoked to let |
92 | * policy-specific per-blkcg structures lazily the first time | 93 | * each policy handle per-blkcg data. |
93 | * they are actually needed, so it handles them together with | ||
94 | * blkgs. cpd_init() is invoked to let each policy handle | ||
95 | * per-blkcg data. | ||
96 | */ | 94 | */ |
97 | struct blkcg_policy_data { | 95 | struct blkcg_policy_data { |
98 | /* the policy id this per-policy data belongs to */ | 96 | /* the policy id this per-policy data belongs to */ |
99 | int plid; | 97 | int plid; |
100 | |||
101 | /* used during policy activation */ | ||
102 | struct list_head alloc_node; | ||
103 | }; | 98 | }; |
104 | 99 | ||
105 | /* association between a blk cgroup and a request queue */ | 100 | /* association between a blk cgroup and a request queue */ |