Skip to content

Commit 44579f3

Browse files
committed
Merge tag 'block-5.5-20191221' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "Let's try this one again, this time without the compat_ioctl changes. We've got those fixed up, but that can go out next week. This contains: - block queue flush lockdep annotation (Bart) - Type fix for bsg_queue_rq() (Bart) - Three dasd fixes (Stefan, Jan) - nbd deadlock fix (Mike) - Error handling bio user map fix (Yang) - iocost fix (Tejun) - sbitmap waitqueue addition fix that affects the kyber IO scheduler (David)" * tag 'block-5.5-20191221' of git://git.kernel.dk/linux-block: sbitmap: only queue kyber's wait callback if not already active block: fix memleak when __blk_rq_map_user_iov() is failed s390/dasd: fix typo in copyright statement s390/dasd: fix memleak in path handling error case s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly block: Fix a lockdep complaint triggered by request queue flushing block: Fix the type of 'sts' in bsg_queue_rq() block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT nbd: fix shutdown and recv work deadlock v2 iocost: over-budget forced IOs should schedule async delay
2 parents a313c8e + df034c9 commit 44579f3

File tree

12 files changed

+37
-39
lines changed

12 files changed

+37
-39
lines changed

block/blk-core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,11 +885,14 @@ generic_make_request_checks(struct bio *bio)
885885
}
886886

887887
/*
888-
* For a REQ_NOWAIT based request, return -EOPNOTSUPP
889-
* if queue is not a request based queue.
888+
* Non-mq queues do not honor REQ_NOWAIT, so complete a bio
889+
* with BLK_STS_AGAIN status in order to catch -EAGAIN and
890+
* to give a chance to the caller to repeat request gracefully.
890891
*/
891-
if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q))
892-
goto not_supported;
892+
if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) {
893+
status = BLK_STS_AGAIN;
894+
goto end_io;
895+
}
893896

894897
if (should_fail_bio(bio))
895898
goto end_io;

block/blk-flush.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#include <linux/blkdev.h>
7070
#include <linux/gfp.h>
7171
#include <linux/blk-mq.h>
72+
#include <linux/lockdep.h>
7273

7374
#include "blk.h"
7475
#include "blk-mq.h"
@@ -505,6 +506,9 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q,
505506
INIT_LIST_HEAD(&fq->flush_queue[1]);
506507
INIT_LIST_HEAD(&fq->flush_data_in_flight);
507508

509+
lockdep_register_key(&fq->key);
510+
lockdep_set_class(&fq->mq_flush_lock, &fq->key);
511+
508512
return fq;
509513

510514
fail_rq:
@@ -519,6 +523,7 @@ void blk_free_flush_queue(struct blk_flush_queue *fq)
519523
if (!fq)
520524
return;
521525

526+
lockdep_unregister_key(&fq->key);
522527
kfree(fq->flush_rq);
523528
kfree(fq);
524529
}

block/blk-iocost.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ static enum hrtimer_restart iocg_waitq_timer_fn(struct hrtimer *timer)
12121212
return HRTIMER_NORESTART;
12131213
}
12141214

1215-
static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost)
1215+
static bool iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost)
12161216
{
12171217
struct ioc *ioc = iocg->ioc;
12181218
struct blkcg_gq *blkg = iocg_to_blkg(iocg);
@@ -1229,11 +1229,11 @@ static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost)
12291229
/* clear or maintain depending on the overage */
12301230
if (time_before_eq64(vtime, now->vnow)) {
12311231
blkcg_clear_delay(blkg);
1232-
return;
1232+
return false;
12331233
}
12341234
if (!atomic_read(&blkg->use_delay) &&
12351235
time_before_eq64(vtime, now->vnow + vmargin))
1236-
return;
1236+
return false;
12371237

12381238
/* use delay */
12391239
if (cost) {
@@ -1250,10 +1250,11 @@ static void iocg_kick_delay(struct ioc_gq *iocg, struct ioc_now *now, u64 cost)
12501250
oexpires = ktime_to_ns(hrtimer_get_softexpires(&iocg->delay_timer));
12511251
if (hrtimer_is_queued(&iocg->delay_timer) &&
12521252
abs(oexpires - expires) <= margin_ns / 4)
1253-
return;
1253+
return true;
12541254

12551255
hrtimer_start_range_ns(&iocg->delay_timer, ns_to_ktime(expires),
12561256
margin_ns / 4, HRTIMER_MODE_ABS);
1257+
return true;
12571258
}
12581259

12591260
static enum hrtimer_restart iocg_delay_timer_fn(struct hrtimer *timer)
@@ -1739,7 +1740,9 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio)
17391740
*/
17401741
if (bio_issue_as_root_blkg(bio) || fatal_signal_pending(current)) {
17411742
atomic64_add(abs_cost, &iocg->abs_vdebt);
1742-
iocg_kick_delay(iocg, &now, cost);
1743+
if (iocg_kick_delay(iocg, &now, cost))
1744+
blkcg_schedule_throttle(rqos->q,
1745+
(bio->bi_opf & REQ_SWAP) == REQ_SWAP);
17431746
return;
17441747
}
17451748

block/blk-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
151151
return 0;
152152

153153
unmap_rq:
154-
__blk_rq_unmap_user(bio);
154+
blk_rq_unmap_user(bio);
155155
fail:
156156
rq->bio = NULL;
157157
return ret;

block/blk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct blk_flush_queue {
3030
* at the same time
3131
*/
3232
struct request *orig_rq;
33+
struct lock_class_key key;
3334
spinlock_t mq_flush_lock;
3435
};
3536

block/bsg-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,
266266
struct request *req = bd->rq;
267267
struct bsg_set *bset =
268268
container_of(q->tag_set, struct bsg_set, tag_set);
269-
int sts = BLK_STS_IOERR;
269+
blk_status_t sts = BLK_STS_IOERR;
270270
int ret;
271271

272272
blk_mq_start_request(req);

drivers/block/nbd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,10 +1296,10 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
12961296
mutex_unlock(&nbd->config_lock);
12971297
ret = wait_event_interruptible(config->recv_wq,
12981298
atomic_read(&config->recv_threads) == 0);
1299-
if (ret) {
1299+
if (ret)
13001300
sock_shutdown(nbd);
1301-
flush_workqueue(nbd->recv_workq);
1302-
}
1301+
flush_workqueue(nbd->recv_workq);
1302+
13031303
mutex_lock(&nbd->config_lock);
13041304
nbd_bdev_reset(bdev);
13051305
/* user requested, ignore socket errors */

drivers/s390/block/dasd_eckd.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,8 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11281128
{
11291129
struct dasd_eckd_private *private = device->private;
11301130
int fcx_in_css, fcx_in_gneq, fcx_in_features;
1131-
int tpm, mdc;
1131+
unsigned int mdc;
1132+
int tpm;
11321133

11331134
if (dasd_nofcx)
11341135
return 0;
@@ -1142,7 +1143,7 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11421143
return 0;
11431144

11441145
mdc = ccw_device_get_mdc(device->cdev, 0);
1145-
if (mdc < 0) {
1146+
if (mdc == 0) {
11461147
dev_warn(&device->cdev->dev, "Detecting the maximum supported data size for zHPF requests failed\n");
11471148
return 0;
11481149
} else {
@@ -1153,12 +1154,12 @@ static u32 get_fcx_max_data(struct dasd_device *device)
11531154
static int verify_fcx_max_data(struct dasd_device *device, __u8 lpm)
11541155
{
11551156
struct dasd_eckd_private *private = device->private;
1156-
int mdc;
1157+
unsigned int mdc;
11571158
u32 fcx_max_data;
11581159

11591160
if (private->fcx_max_data) {
11601161
mdc = ccw_device_get_mdc(device->cdev, lpm);
1161-
if ((mdc < 0)) {
1162+
if (mdc == 0) {
11621163
dev_warn(&device->cdev->dev,
11631164
"Detecting the maximum data size for zHPF "
11641165
"requests failed (rc=%d) for a new path %x\n",
@@ -2073,7 +2074,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
20732074
dasd_free_block(device->block);
20742075
device->block = NULL;
20752076
out_err1:
2076-
kfree(private->conf_data);
2077+
dasd_eckd_clear_conf_data(device);
20772078
kfree(device->private);
20782079
device->private = NULL;
20792080
return rc;
@@ -2082,7 +2083,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
20822083
static void dasd_eckd_uncheck_device(struct dasd_device *device)
20832084
{
20842085
struct dasd_eckd_private *private = device->private;
2085-
int i;
20862086

20872087
if (!private)
20882088
return;
@@ -2092,21 +2092,7 @@ static void dasd_eckd_uncheck_device(struct dasd_device *device)
20922092
private->sneq = NULL;
20932093
private->vdsneq = NULL;
20942094
private->gneq = NULL;
2095-
private->conf_len = 0;
2096-
for (i = 0; i < 8; i++) {
2097-
kfree(device->path[i].conf_data);
2098-
if ((__u8 *)device->path[i].conf_data ==
2099-
private->conf_data) {
2100-
private->conf_data = NULL;
2101-
private->conf_len = 0;
2102-
}
2103-
device->path[i].conf_data = NULL;
2104-
device->path[i].cssid = 0;
2105-
device->path[i].ssid = 0;
2106-
device->path[i].chpid = 0;
2107-
}
2108-
kfree(private->conf_data);
2109-
private->conf_data = NULL;
2095+
dasd_eckd_clear_conf_data(device);
21102096
}
21112097

21122098
static struct dasd_ccw_req *

drivers/s390/block/dasd_fba.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Author(s)......: Holger Smolinski <[email protected]>
44
* Bugreports.to..: <[email protected]>
5-
* Coypright IBM Corp. 1999, 2000
5+
* Copyright IBM Corp. 1999, 2000
66
*
77
*/
88

drivers/s390/block/dasd_proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Carsten Otte <[email protected]>
66
* Martin Schwidefsky <[email protected]>
77
* Bugreports.to..: <[email protected]>
8-
* Coypright IBM Corp. 1999, 2002
8+
* Copyright IBM Corp. 1999, 2002
99
*
1010
* /proc interface for the dasd driver.
1111
*

0 commit comments

Comments
 (0)