History

Merge tag 'for-linus-20191010' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe: - Fix wbt performance regression introduced with the blk-rq-qos refactoring (Harshad) - Fix io_uring fileset removal inadvertently killing the workqueue (me) - Fix io_uring typo in linked command nonblock submission (Pavel) - Remove spurious io_uring wakeups on request free (Pavel) - Fix null_blk zoned command error return (Keith) - Don't use freezable workqueues for backing_dev, also means we can revert a previous libata hack (Mika) - Fix nbd sysfs mutex dropped too soon at removal time (Xiubo) * tag 'for-linus-20191010' of git://git.kernel.dk/linux-block: nbd: fix possible sysfs duplicate warning null_blk: Fix zoned command return code io_uring: only flush workqueues on fileset removal io_uring: remove wait loop spurious wakeups blk-wbt: fix performance regression in wbt scale_up/scale_down Revert "libata, freezer: avoid block device removal while system is frozen" bdi: Do not use freezable workqueue io_uring: fix reversed nonblock flag for link submission

Linus Torvalds committed 7 years ago

Commit 297cbcc2 parents 9e208aa 86248819 files · +29 −55Browse files

Unified · Split

9 files
  1. block/blk-rq-qos.c +9 −5
  2. block/blk-rq-qos.h +2 −2
  3. block/blk-wbt.c +4 −2
  4. drivers/ata/libata-scsi.c +0 −21
  5. drivers/block/nbd.c +1 −1
  6. drivers/block/null_blk_zoned.c +1 −2
  7. fs/io_uring.c +10 −14
  8. kernel/freezer.c +0 −6
  9. mm/backing-dev.c +2 −2
block/blk-rq-qos.c+9−5
@@ -160,24 +160,27 @@ bool rq_depth_calc_max_depth(struct rq_depth *rqd) · 159 unmodified lines
160160 return ret;
161161 }
162162
163−void rq_depth_scale_up(struct rq_depth *rqd)
163+/* Returns true on success and false if scaling up wasn't possible */
164+bool rq_depth_scale_up(struct rq_depth *rqd)
164165 {
165166 /*
166167 * Hit max in previous round, stop here
167168 */
168169 if (rqd->scaled_max)
169− return;
170+ return false;
170171
171172 rqd->scale_step--;
172173
173174 rqd->scaled_max = rq_depth_calc_max_depth(rqd);
175+ return true;
174176 }
175177
176178 /*
177179 * Scale rwb down. If 'hard_throttle' is set, do it quicker, since we
178− * had a latency violation.
180+ * had a latency violation. Returns true on success and returns false if
181+ * scaling down wasn't possible.
179182 */
180−void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle)
183+bool rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle)
181184 {
182185 /*
183186 * Stop scaling down when we've hit the limit. This also prevents
@@ -185,7 +188,7 @@ void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) · 1 unmodified line
185188 * keep up.
186189 */
187190 if (rqd->max_depth == 1)
188− return;
191+ return false;
189192
190193 if (rqd->scale_step < 0 && hard_throttle)
191194 rqd->scale_step = 0;
@@ -194,6 +197,7 @@ void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) · 2 unmodified lines
194197
195198 rqd->scaled_max = false;
196199 rq_depth_calc_max_depth(rqd);
200+ return true;
197201 }
198202
199203 struct rq_qos_wait_data {
block/blk-rq-qos.h+2−2
@@ -130,8 +130,8 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, · 129 unmodified lines
130130 acquire_inflight_cb_t *acquire_inflight_cb,
131131 cleanup_cb_t *cleanup_cb);
132132 bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit);
133−void rq_depth_scale_up(struct rq_depth *rqd);
134−void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle);
133+bool rq_depth_scale_up(struct rq_depth *rqd);
134+bool rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle);
135135 bool rq_depth_calc_max_depth(struct rq_depth *rqd);
136136
137137 void __rq_qos_cleanup(struct rq_qos *rqos, struct bio *bio);
block/blk-wbt.c+4−2
@@ -308,7 +308,8 @@ static void calc_wb_limits(struct rq_wb *rwb) · 307 unmodified lines
308308
309309 static void scale_up(struct rq_wb *rwb)
310310 {
311− rq_depth_scale_up(&rwb->rq_depth);
311+ if (!rq_depth_scale_up(&rwb->rq_depth))
312+ return;
312313 calc_wb_limits(rwb);
313314 rwb->unknown_cnt = 0;
314315 rwb_wake_all(rwb);
@@ -317,7 +318,8 @@ static void scale_up(struct rq_wb *rwb) · 2 unmodified lines
317318
318319 static void scale_down(struct rq_wb *rwb, bool hard_throttle)
319320 {
320− rq_depth_scale_down(&rwb->rq_depth, hard_throttle);
321+ if (!rq_depth_scale_down(&rwb->rq_depth, hard_throttle))
322+ return;
321323 calc_wb_limits(rwb);
322324 rwb->unknown_cnt = 0;
323325 rwb_trace_step(rwb, "scale down");
drivers/ata/libata-scsi.c+0−21
@@ -4791,27 +4791,6 @@ void ata_scsi_hotplug(struct work_struct *work) · 4790 unmodified lines
47914791 return;
47924792 }
47934793
4794− /*
4795− * XXX - UGLY HACK
4796− *
4797− * The block layer suspend/resume path is fundamentally broken due
4798− * to freezable kthreads and workqueue and may deadlock if a block
4799− * device gets removed while resume is in progress. I don't know
4800− * what the solution is short of removing freezable kthreads and
4801− * workqueues altogether.
4802− *
4803− * The following is an ugly hack to avoid kicking off device
4804− * removal while freezer is active. This is a joke but does avoid
4805− * this particular deadlock scenario.
4806− *
4807− * https://bugzilla.kernel.org/show_bug.cgi?id=62801
4808− * http://marc.info/?l=linux-kernel&m=138695698516487
4809− */
4810−#ifdef CONFIG_FREEZER
4811− while (pm_freezing)
4812− msleep(10);
4813−#endif
4814−
48154794 DPRINTK("ENTER\n");
48164795 mutex_lock(&ap->scsi_scan_mutex);
48174796
drivers/block/nbd.c+1−1
@@ -248,8 +248,8 @@ static void nbd_put(struct nbd_device *nbd) · 247 unmodified lines
248248 if (refcount_dec_and_mutex_lock(&nbd->refs,
249249 &nbd_index_mutex)) {
250250 idr_remove(&nbd_index_idr, nbd->index);
251− mutex_unlock(&nbd_index_mutex);
252251 nbd_dev_remove(nbd);
252+ mutex_unlock(&nbd_index_mutex);
253253 }
254254 }
255255
drivers/block/null_blk_zoned.c+1−2
@@ -142,8 +142,7 @@ static blk_status_t null_zone_reset(struct nullb_cmd *cmd, sector_t sector) · 141 unmodified lines
142142 zone->wp = zone->start;
143143 break;
144144 default:
145− cmd->error = BLK_STS_NOTSUPP;
146− break;
145+ return BLK_STS_NOTSUPP;
147146 }
148147 return BLK_STS_OK;
149148 }
fs/io_uring.c+10−14
@@ -591,14 +591,6 @@ static void io_cqring_add_event(struct io_ring_ctx *ctx, u64 user_data, · 590 unmodified lines
591591 io_cqring_ev_posted(ctx);
592592 }
593593
594−static void io_ring_drop_ctx_refs(struct io_ring_ctx *ctx, unsigned refs)
595−{
596− percpu_ref_put_many(&ctx->refs, refs);
597−
598− if (waitqueue_active(&ctx->wait))
599− wake_up(&ctx->wait);
600−}
601−
602594 static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
603595 struct io_submit_state *state)
604596 {
@@ -646,7 +638,7 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx, · 41 unmodified lines
646638 req->result = 0;
647639 return req;
648640 out:
649− io_ring_drop_ctx_refs(ctx, 1);
641+ percpu_ref_put(&ctx->refs);
650642 return NULL;
651643 }
652644
@@ -654,7 +646,7 @@ static void io_free_req_many(struct io_ring_ctx *ctx, void **reqs, int *nr) · 1 unmodified line
654646 {
655647 if (*nr) {
656648 kmem_cache_free_bulk(req_cachep, *nr, reqs);
657− io_ring_drop_ctx_refs(ctx, *nr);
649+ percpu_ref_put_many(&ctx->refs, *nr);
658650 *nr = 0;
659651 }
660652 }
@@ -663,7 +655,7 @@ static void __io_free_req(struct io_kiocb *req) · 2 unmodified lines
663655 {
664656 if (req->file && !(req->flags & REQ_F_FIXED_FILE))
665657 fput(req->file);
666− io_ring_drop_ctx_refs(req->ctx, 1);
658+ percpu_ref_put(&req->ctx->refs);
667659 kmem_cache_free(req_cachep, req);
668660 }
669661
@@ -2761,7 +2753,7 @@ out: · 2091 unmodified lines
27612753
27622754 if (link)
27632755 io_queue_link_head(ctx, link, &link->submit, shadow_req,
2764− block_for_last);
2756+ !block_for_last);
27652757 if (statep)
27662758 io_submit_state_end(statep);
27672759
@@ -2920,8 +2912,12 @@ static void io_finish_async(struct io_ring_ctx *ctx) · 152 unmodified lines
29202912 static void io_destruct_skb(struct sk_buff *skb)
29212913 {
29222914 struct io_ring_ctx *ctx = skb->sk->sk_user_data;
2915+ int i;
2916+
2917+ for (i = 0; i < ARRAY_SIZE(ctx->sqo_wq); i++)
2918+ if (ctx->sqo_wq[i])
2919+ flush_workqueue(ctx->sqo_wq[i]);
29232920
2924− io_finish_async(ctx);
29252921 unix_destruct_scm(skb);
29262922 }
29272923
@@ -3630,7 +3626,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 702 unmodified lines
36303626 }
36313627 }
36323628
3633− io_ring_drop_ctx_refs(ctx, 1);
3629+ percpu_ref_put(&ctx->refs);
36343630 out_fput:
36353631 fdput(f);
36363632 return submitted ? submitted : ret;
kernel/freezer.c+0−6
@@ -22,12 +22,6 @@ EXPORT_SYMBOL(system_freezing_cnt); · 21 unmodified lines
2222 bool pm_freezing;
2323 bool pm_nosig_freezing;
2424
25−/*
26− * Temporary export for the deadlock workaround in ata_scsi_hotplug().
27− * Remove once the hack becomes unnecessary.
28− */
29−EXPORT_SYMBOL_GPL(pm_freezing);
30−
3125 /* protects freezing and frozen transitions */
3226 static DEFINE_SPINLOCK(freezer_lock);
3327
mm/backing-dev.c+2−2
@@ -239,8 +239,8 @@ static int __init default_bdi_init(void) · 238 unmodified lines
239239 {
240240 int err;
241241
242− bdi_wq = alloc_workqueue("writeback", WQ_MEM_RECLAIM | WQ_FREEZABLE |
243− WQ_UNBOUND | WQ_SYSFS, 0);
242+ bdi_wq = alloc_workqueue("writeback", WQ_MEM_RECLAIM | WQ_UNBOUND |
243+ WQ_SYSFS, 0);
244244 if (!bdi_wq)
245245 return -ENOMEM;
246246

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t