Commit d33db702 authored by Linus Torvalds's avatar Linus Torvalds

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
parents b1b11d00 579dd91a
...@@ -492,13 +492,6 @@ set max_budget to higher values than those to which BFQ would have set ...@@ -492,13 +492,6 @@ set max_budget to higher values than those to which BFQ would have set
it with auto-tuning. An alternative way to achieve this goal is to it with auto-tuning. An alternative way to achieve this goal is to
just increase the value of timeout_sync, leaving max_budget equal to 0. just increase the value of timeout_sync, leaving max_budget equal to 0.
weights
-------
Read-only parameter, used to show the weights of the currently active
BFQ queues.
4. Group scheduling with BFQ 4. Group scheduling with BFQ
============================ ============================
...@@ -566,7 +559,7 @@ Parameters to set ...@@ -566,7 +559,7 @@ Parameters to set
For each group, there is only the following parameter to set. For each group, there is only the following parameter to set.
weight (namely blkio.bfq.weight or io.bfq-weight): the weight of the weight (namely blkio.bfq.weight or io.bfq-weight): the weight of the
group inside its parent. Available values: 1..10000 (default 100). The group inside its parent. Available values: 1..1000 (default 100). The
linear mapping between ioprio and weights, described at the beginning linear mapping between ioprio and weights, described at the beginning
of the tunable section, is still valid, but all weights higher than of the tunable section, is still valid, but all weights higher than
IOPRIO_BE_NR*10 are mapped to ioprio 0. IOPRIO_BE_NR*10 are mapped to ioprio 0.
......
...@@ -828,10 +828,10 @@ static bool blk_mq_rq_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq, ...@@ -828,10 +828,10 @@ static bool blk_mq_rq_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq,
void *priv, bool reserved) void *priv, bool reserved)
{ {
/* /*
* If we find a request that is inflight and the queue matches, * If we find a request that isn't idle and the queue matches,
* we know the queue is busy. Return false to stop the iteration. * we know the queue is busy. Return false to stop the iteration.
*/ */
if (rq->state == MQ_RQ_IN_FLIGHT && rq->q == hctx->queue) { if (blk_mq_request_started(rq) && rq->q == hctx->queue) {
bool *busy = priv; bool *busy = priv;
*busy = true; *busy = true;
......
...@@ -1033,25 +1033,26 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, ...@@ -1033,25 +1033,26 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
test_bit(NBD_RT_BOUND, &config->runtime_flags))) { test_bit(NBD_RT_BOUND, &config->runtime_flags))) {
dev_err(disk_to_dev(nbd->disk), dev_err(disk_to_dev(nbd->disk),
"Device being setup by another task"); "Device being setup by another task");
sockfd_put(sock); err = -EBUSY;
return -EBUSY; goto put_socket;
}
nsock = kzalloc(sizeof(*nsock), GFP_KERNEL);
if (!nsock) {
err = -ENOMEM;
goto put_socket;
} }
socks = krealloc(config->socks, (config->num_connections + 1) * socks = krealloc(config->socks, (config->num_connections + 1) *
sizeof(struct nbd_sock *), GFP_KERNEL); sizeof(struct nbd_sock *), GFP_KERNEL);
if (!socks) { if (!socks) {
sockfd_put(sock); kfree(nsock);
return -ENOMEM; err = -ENOMEM;
goto put_socket;
} }
config->socks = socks; config->socks = socks;
nsock = kzalloc(sizeof(struct nbd_sock), GFP_KERNEL);
if (!nsock) {
sockfd_put(sock);
return -ENOMEM;
}
nsock->fallback_index = -1; nsock->fallback_index = -1;
nsock->dead = false; nsock->dead = false;
mutex_init(&nsock->tx_lock); mutex_init(&nsock->tx_lock);
...@@ -1063,6 +1064,10 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, ...@@ -1063,6 +1064,10 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
atomic_inc(&config->live_connections); atomic_inc(&config->live_connections);
return 0; return 0;
put_socket:
sockfd_put(sock);
return err;
} }
static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment