Skip to content

Commit d33db70

Browse files
committed
Merge tag 'block-5.8-2020-07-10' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Fix for inflight accounting, which affects only dm (Ming) - Fix documentation error for bfq (Yufen) - Fix memory leak for nbd (Zheng) * tag 'block-5.8-2020-07-10' of git://git.kernel.dk/linux-block: nbd: Fix memory leak in nbd_add_socket blk-mq: consider non-idle request as "inflight" in blk_mq_rq_inflight() docs: block: update and fix tiny error for bfq
2 parents b1b11d0 + 579dd91 commit d33db70

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

Documentation/block/bfq-iosched.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,6 @@ set max_budget to higher values than those to which BFQ would have set
492492
it with auto-tuning. An alternative way to achieve this goal is to
493493
just increase the value of timeout_sync, leaving max_budget equal to 0.
494494

495-
weights
496-
-------
497-
498-
Read-only parameter, used to show the weights of the currently active
499-
BFQ queues.
500-
501-
502495
4. Group scheduling with BFQ
503496
============================
504497

@@ -566,7 +559,7 @@ Parameters to set
566559
For each group, there is only the following parameter to set.
567560

568561
weight (namely blkio.bfq.weight or io.bfq-weight): the weight of the
569-
group inside its parent. Available values: 1..10000 (default 100). The
562+
group inside its parent. Available values: 1..1000 (default 100). The
570563
linear mapping between ioprio and weights, described at the beginning
571564
of the tunable section, is still valid, but all weights higher than
572565
IOPRIO_BE_NR*10 are mapped to ioprio 0.

block/blk-mq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,10 @@ static bool blk_mq_rq_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq,
828828
void *priv, bool reserved)
829829
{
830830
/*
831-
* If we find a request that is inflight and the queue matches,
831+
* If we find a request that isn't idle and the queue matches,
832832
* we know the queue is busy. Return false to stop the iteration.
833833
*/
834-
if (rq->state == MQ_RQ_IN_FLIGHT && rq->q == hctx->queue) {
834+
if (blk_mq_request_started(rq) && rq->q == hctx->queue) {
835835
bool *busy = priv;
836836

837837
*busy = true;

drivers/block/nbd.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,25 +1033,26 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
10331033
test_bit(NBD_RT_BOUND, &config->runtime_flags))) {
10341034
dev_err(disk_to_dev(nbd->disk),
10351035
"Device being setup by another task");
1036-
sockfd_put(sock);
1037-
return -EBUSY;
1036+
err = -EBUSY;
1037+
goto put_socket;
1038+
}
1039+
1040+
nsock = kzalloc(sizeof(*nsock), GFP_KERNEL);
1041+
if (!nsock) {
1042+
err = -ENOMEM;
1043+
goto put_socket;
10381044
}
10391045

10401046
socks = krealloc(config->socks, (config->num_connections + 1) *
10411047
sizeof(struct nbd_sock *), GFP_KERNEL);
10421048
if (!socks) {
1043-
sockfd_put(sock);
1044-
return -ENOMEM;
1049+
kfree(nsock);
1050+
err = -ENOMEM;
1051+
goto put_socket;
10451052
}
10461053

10471054
config->socks = socks;
10481055

1049-
nsock = kzalloc(sizeof(struct nbd_sock), GFP_KERNEL);
1050-
if (!nsock) {
1051-
sockfd_put(sock);
1052-
return -ENOMEM;
1053-
}
1054-
10551056
nsock->fallback_index = -1;
10561057
nsock->dead = false;
10571058
mutex_init(&nsock->tx_lock);
@@ -1063,6 +1064,10 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
10631064
atomic_inc(&config->live_connections);
10641065

10651066
return 0;
1067+
1068+
put_socket:
1069+
sockfd_put(sock);
1070+
return err;
10661071
}
10671072

10681073
static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)

0 commit comments

Comments
 (0)