History

Merge tag 'block-6.7-2023-11-23' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe: "A bit bigger than usual at this time, but nothing really earth shattering: - NVMe pull request via Keith: - TCP TLS fixes (Hannes) - Authentifaction fixes (Mark, Hannes) - Properly terminate target names (Christoph) - MD pull request via Song, fixing a raid5 corruption issue - Disentanglement of the dependency mess in nvme introduced with the tls additions. Now it should actually build on all configs (Arnd) - Series of bcache fixes (Coly) - Removal of a dead helper (Damien) - s390 dasd fix (Muhammad, Jan) - lockdep blk-cgroup fixes (Ming)" * tag 'block-6.7-2023-11-23' of git://git.kernel.dk/linux: (33 commits) nvme: tcp: fix compile-time checks for TLS mode nvme: target: fix Kconfig select statements nvme: target: fix nvme_keyring_id() references nvme: move nvme_stop_keep_alive() back to original position nbd: pass nbd_sock to nbd_read_reply() instead of index s390/dasd: protect device queue against concurrent access s390/dasd: resolve spelling mistake block/null_blk: Fix double blk_mq_start_request() warning nvmet-tcp: always initialize tls_handshake_tmo_work nvmet: nul-terminate the NQNs passed in the connect command nvme: blank out authentication fabrics options if not configured nvme: catch errors from nvme_configure_metadata() nvme-tcp: only evaluate 'tls' option if TLS is selected nvme-auth: set explanation code for failure2 msgs nvme-auth: unlock mutex in one place only block: Remove blk_set_runtime_active() nbd: fix null-ptr-dereference while accessing 'nbd->config' nbd: factor out a helper to get nbd_config without holding 'config_lock' nbd: fold nbd config initialization into nbd_alloc_config() bcache: avoid NULL checking to c->root in run_cache_set() ...

Linus Torvalds committed 2 years ago

Commit bc893f72 parents 0044423 0e6c4fe25 files · +210 −148Browse files

Unified · Split

25 files
  1. block/blk-cgroup.c +13 −0
  2. block/blk-cgroup.h +0 −2
  3. block/blk-pm.c +5 −28
  4. block/blk-throttle.c +2 −0
  5. drivers/block/nbd.c +75 −42
  6. drivers/block/null_blk/main.c +13 −12
  7. drivers/md/bcache/bcache.h +1 −0
  8. drivers/md/bcache/btree.c +10 −1
  9. drivers/md/bcache/super.c +3 −1
  10. drivers/md/bcache/sysfs.c +1 −1
  11. drivers/md/bcache/writeback.c +18 −6
  12. drivers/md/md.c +2 −1
  13. drivers/nvme/host/auth.c +3 −2
  14. drivers/nvme/host/core.c +14 −7
  15. drivers/nvme/host/fabrics.c +2 −0
  16. drivers/nvme/host/fc.c +8 −11
  17. drivers/nvme/host/rdma.c +1 −0
  18. drivers/nvme/host/tcp.c +15 −17
  19. drivers/nvme/target/Kconfig +2 −2
  20. drivers/nvme/target/configfs.c +1 −1
  21. drivers/nvme/target/fabrics-cmd.c +4 −0
  22. drivers/nvme/target/tcp.c +3 −1
  23. drivers/s390/block/dasd.c +13 −11
  24. drivers/s390/block/dasd_int.h +1 −1
  25. include/linux/blk-pm.h +0 −1
block/blk-cgroup.c+13−0
@@ -577,6 +577,7 @@ static void blkg_destroy_all(struct gendisk *disk) · 576 unmodified lines
577 struct request_queue *q = disk->queue;577 struct request_queue *q = disk->queue;
578 struct blkcg_gq *blkg, *n;578 struct blkcg_gq *blkg, *n;
579 int count = BLKG_DESTROY_BATCH_SIZE;579 int count = BLKG_DESTROY_BATCH_SIZE;
580 int i;
580 581
581restart:582restart:
582 spin_lock_irq(&q->queue_lock);583 spin_lock_irq(&q->queue_lock);
@@ -602,6 +603,18 @@ restart: · 19 unmodified lines
602 }603 }
603 }604 }
604 605
606 /*
607 * Mark policy deactivated since policy offline has been done, and
608 * the free is scheduled, so future blkcg_deactivate_policy() can
609 * be bypassed
610 */
611 for (i = 0; i < BLKCG_MAX_POLS; i++) {
612 struct blkcg_policy *pol = blkcg_policy[i];
613
614 if (pol)
615 __clear_bit(pol->plid, q->blkcg_pols);
616 }
617
605 q->root_blkg = NULL;618 q->root_blkg = NULL;
606 spin_unlock_irq(&q->queue_lock);619 spin_unlock_irq(&q->queue_lock);
607}620}
block/blk-cgroup.h+0−2
@@ -249,8 +249,6 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, · 248 unmodified lines
249{249{
250 struct blkcg_gq *blkg;250 struct blkcg_gq *blkg;
251 251
252 WARN_ON_ONCE(!rcu_read_lock_held());
253
254 if (blkcg == &blkcg_root)252 if (blkcg == &blkcg_root)
255 return q->root_blkg;253 return q->root_blkg;
256 254
block/blk-pm.c+5−28
@@ -163,38 +163,15 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); · 162 unmodified lines
163 * @q: the queue of the device163 * @q: the queue of the device
164 *164 *
165 * Description:165 * Description:
166 * For historical reasons, this routine merely calls blk_set_runtime_active()166 * Restart the queue of a runtime suspended device. It does this regardless
167 * to do the real work of restarting the queue. It does this regardless of167 * of whether the device's runtime-resume succeeded; even if it failed the
168 * whether the device's runtime-resume succeeded; even if it failed the
169 * driver or error handler will need to communicate with the device.168 * driver or error handler will need to communicate with the device.
170 *169 *
171 * This function should be called near the end of the device's170 * This function should be called near the end of the device's
172 * runtime_resume callback.171 * runtime_resume callback to correct queue runtime PM status and re-enable
172 * peeking requests from the queue.
173 */173 */
174void blk_post_runtime_resume(struct request_queue *q)174void blk_post_runtime_resume(struct request_queue *q)
175{
176 blk_set_runtime_active(q);
177}
178EXPORT_SYMBOL(blk_post_runtime_resume);
179
180/**
181 * blk_set_runtime_active - Force runtime status of the queue to be active
182 * @q: the queue of the device
183 *
184 * If the device is left runtime suspended during system suspend the resume
185 * hook typically resumes the device and corrects runtime status
186 * accordingly. However, that does not affect the queue runtime PM status
187 * which is still "suspended". This prevents processing requests from the
188 * queue.
189 *
190 * This function can be used in driver's resume hook to correct queue
191 * runtime PM status and re-enable peeking requests from the queue. It
192 * should be called before first request is added to the queue.
193 *
194 * This function is also called by blk_post_runtime_resume() for
195 * runtime resumes. It does everything necessary to restart the queue.
196 */
197void blk_set_runtime_active(struct request_queue *q)
198{175{
199 int old_status;176 int old_status;
200 177
@@ -211,4 +188,4 @@ void blk_set_runtime_active(struct request_queue *q) · 10 unmodified lines
211 if (old_status != RPM_ACTIVE)188 if (old_status != RPM_ACTIVE)
212 blk_clear_pm_only(q);189 blk_clear_pm_only(q);
213}190}
214EXPORT_SYMBOL(blk_set_runtime_active);191EXPORT_SYMBOL(blk_post_runtime_resume);
block/blk-throttle.c+2−0
@@ -1320,6 +1320,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global) · 1319 unmodified lines
1320 tg_bps_limit(tg, READ), tg_bps_limit(tg, WRITE),1320 tg_bps_limit(tg, READ), tg_bps_limit(tg, WRITE),
1321 tg_iops_limit(tg, READ), tg_iops_limit(tg, WRITE));1321 tg_iops_limit(tg, READ), tg_iops_limit(tg, WRITE));
1322 1322
1323 rcu_read_lock();
1323 /*1324 /*
1324 * Update has_rules[] flags for the updated tg's subtree. A tg is1325 * Update has_rules[] flags for the updated tg's subtree. A tg is
1325 * considered to have rules if either the tg itself or any of its1326 * considered to have rules if either the tg itself or any of its
@@ -1347,6 +1348,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global) · 21 unmodified lines
1347 this_tg->latency_target = max(this_tg->latency_target,1348 this_tg->latency_target = max(this_tg->latency_target,
1348 parent_tg->latency_target);1349 parent_tg->latency_target);
1349 }1350 }
1351 rcu_read_unlock();
1350 1352
1351 /*1353 /*
1352 * We're already holding queue_lock and know @tg is valid. Let's1354 * We're already holding queue_lock and know @tg is valid. Let's
drivers/block/nbd.c+75−42
@@ -67,6 +67,7 @@ struct nbd_sock { · 66 unmodified lines
67struct recv_thread_args {67struct recv_thread_args {
68 struct work_struct work;68 struct work_struct work;
69 struct nbd_device *nbd;69 struct nbd_device *nbd;
70 struct nbd_sock *nsock;
70 int index;71 int index;
71};72};
72 73
@@ -395,6 +396,22 @@ static u32 req_to_nbd_cmd_type(struct request *req) · 322 unmodified lines
395 }396 }
396}397}
397 398
399static struct nbd_config *nbd_get_config_unlocked(struct nbd_device *nbd)
400{
401 if (refcount_inc_not_zero(&nbd->config_refs)) {
402 /*
403 * Add smp_mb__after_atomic to ensure that reading nbd->config_refs
404 * and reading nbd->config is ordered. The pair is the barrier in
405 * nbd_alloc_and_init_config(), avoid nbd->config_refs is set
406 * before nbd->config.
407 */
408 smp_mb__after_atomic();
409 return nbd->config;
410 }
411
412 return NULL;
413}
414
398static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req)415static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req)
399{416{
400 struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req);417 struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req);
@@ -409,13 +426,13 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req) · 8 unmodified lines
409 return BLK_EH_DONE;426 return BLK_EH_DONE;
410 }427 }
411 428
412 if (!refcount_inc_not_zero(&nbd->config_refs)) {429 config = nbd_get_config_unlocked(nbd);
430 if (!config) {
413 cmd->status = BLK_STS_TIMEOUT;431 cmd->status = BLK_STS_TIMEOUT;
414 __clear_bit(NBD_CMD_INFLIGHT, &cmd->flags);432 __clear_bit(NBD_CMD_INFLIGHT, &cmd->flags);
415 mutex_unlock(&cmd->lock);433 mutex_unlock(&cmd->lock);
416 goto done;434 goto done;
417 }435 }
418 config = nbd->config;
419 436
420 if (config->num_connections > 1 ||437 if (config->num_connections > 1 ||
421 (config->num_connections == 1 && nbd->tag_set.timeout)) {438 (config->num_connections == 1 && nbd->tag_set.timeout)) {
@@ -489,15 +506,9 @@ done: · 67 unmodified lines
489 return BLK_EH_DONE;506 return BLK_EH_DONE;
490}507}
491 508
492/*509static int __sock_xmit(struct nbd_device *nbd, struct socket *sock, int send,
493 * Send or receive packet. Return a positive value on success and510 struct iov_iter *iter, int msg_flags, int *sent)
494 * negtive value on failue, and never return 0.
495 */
496static int sock_xmit(struct nbd_device *nbd, int index, int send,
497 struct iov_iter *iter, int msg_flags, int *sent)
498{511{
499 struct nbd_config *config = nbd->config;
500 struct socket *sock = config->socks[index]->sock;
501 int result;512 int result;
502 struct msghdr msg;513 struct msghdr msg;
503 unsigned int noreclaim_flag;514 unsigned int noreclaim_flag;
@@ -540,6 +551,19 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send, · 36 unmodified lines
540 return result;551 return result;
541}552}
542 553
554/*
555 * Send or receive packet. Return a positive value on success and
556 * negtive value on failure, and never return 0.
557 */
558static int sock_xmit(struct nbd_device *nbd, int index, int send,
559 struct iov_iter *iter, int msg_flags, int *sent)
560{
561 struct nbd_config *config = nbd->config;
562 struct socket *sock = config->socks[index]->sock;
563
564 return __sock_xmit(nbd, sock, send, iter, msg_flags, sent);
565}
566
543/*567/*
544 * Different settings for sk->sk_sndtimeo can result in different return values568 * Different settings for sk->sk_sndtimeo can result in different return values
545 * if there is a signal pending when we enter sendmsg, because reasons?569 * if there is a signal pending when we enter sendmsg, because reasons?
@@ -696,7 +720,7 @@ out: · 150 unmodified lines
696 return 0;720 return 0;
697}721}
698 722
699static int nbd_read_reply(struct nbd_device *nbd, int index,723static int nbd_read_reply(struct nbd_device *nbd, struct socket *sock,
700 struct nbd_reply *reply)724 struct nbd_reply *reply)
701{725{
702 struct kvec iov = {.iov_base = reply, .iov_len = sizeof(*reply)};726 struct kvec iov = {.iov_base = reply, .iov_len = sizeof(*reply)};
@@ -705,7 +729,7 @@ static int nbd_read_reply(struct nbd_device *nbd, int index, · 2 unmodified lines
705 729
706 reply->magic = 0;730 reply->magic = 0;
707 iov_iter_kvec(&to, ITER_DEST, &iov, 1, sizeof(*reply));731 iov_iter_kvec(&to, ITER_DEST, &iov, 1, sizeof(*reply));
708 result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);732 result = __sock_xmit(nbd, sock, 0, &to, MSG_WAITALL, NULL);
709 if (result < 0) {733 if (result < 0) {
710 if (!nbd_disconnected(nbd->config))734 if (!nbd_disconnected(nbd->config))
711 dev_err(disk_to_dev(nbd->disk),735 dev_err(disk_to_dev(nbd->disk),
@@ -829,14 +853,14 @@ static void recv_work(struct work_struct *work) · 117 unmodified lines
829 struct nbd_device *nbd = args->nbd;853 struct nbd_device *nbd = args->nbd;
830 struct nbd_config *config = nbd->config;854 struct nbd_config *config = nbd->config;
831 struct request_queue *q = nbd->disk->queue;855 struct request_queue *q = nbd->disk->queue;
832 struct nbd_sock *nsock;856 struct nbd_sock *nsock = args->nsock;
833 struct nbd_cmd *cmd;857 struct nbd_cmd *cmd;
834 struct request *rq;858 struct request *rq;
835 859
836 while (1) {860 while (1) {
837 struct nbd_reply reply;861 struct nbd_reply reply;
838 862
839 if (nbd_read_reply(nbd, args->index, &reply))863 if (nbd_read_reply(nbd, nsock->sock, &reply))
840 break;864 break;
841 865
842 /*866 /*
@@ -871,7 +895,6 @@ static void recv_work(struct work_struct *work) · 28 unmodified lines
871 percpu_ref_put(&q->q_usage_counter);895 percpu_ref_put(&q->q_usage_counter);
872 }896 }
873 897
874 nsock = config->socks[args->index];
875 mutex_lock(&nsock->tx_lock);898 mutex_lock(&nsock->tx_lock);
876 nbd_mark_nsock_dead(nbd, nsock, 1);899 nbd_mark_nsock_dead(nbd, nsock, 1);
877 mutex_unlock(&nsock->tx_lock);900 mutex_unlock(&nsock->tx_lock);
@@ -977,12 +1000,12 @@ static int nbd_handle_cmd(struct nbd_cmd *cmd, int index) · 99 unmodified lines
977 struct nbd_sock *nsock;1000 struct nbd_sock *nsock;
978 int ret;1001 int ret;
979 1002
980 if (!refcount_inc_not_zero(&nbd->config_refs)) {1003 config = nbd_get_config_unlocked(nbd);
1004 if (!config) {
981 dev_err_ratelimited(disk_to_dev(nbd->disk),1005 dev_err_ratelimited(disk_to_dev(nbd->disk),
982 "Socks array is empty\n");1006 "Socks array is empty\n");
983 return -EINVAL;1007 return -EINVAL;
984 }1008 }
985 config = nbd->config;
986 1009
987 if (index >= config->num_connections) {1010 if (index >= config->num_connections) {
988 dev_err_ratelimited(disk_to_dev(nbd->disk),1011 dev_err_ratelimited(disk_to_dev(nbd->disk),
@@ -1215,6 +1238,7 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) · 226 unmodified lines
1215 INIT_WORK(&args->work, recv_work);1238 INIT_WORK(&args->work, recv_work);
1216 args->index = i;1239 args->index = i;
1217 args->nbd = nbd;1240 args->nbd = nbd;
1241 args->nsock = nsock;
1218 nsock->cookie++;1242 nsock->cookie++;
1219 mutex_unlock(&nsock->tx_lock);1243 mutex_unlock(&nsock->tx_lock);
1220 sockfd_put(old);1244 sockfd_put(old);
@@ -1397,6 +1421,7 @@ static int nbd_start_device(struct nbd_device *nbd) · 176 unmodified lines
1397 refcount_inc(&nbd->config_refs);1421 refcount_inc(&nbd->config_refs);
1398 INIT_WORK(&args->work, recv_work);1422 INIT_WORK(&args->work, recv_work);
1399 args->nbd = nbd;1423 args->nbd = nbd;
1424 args->nsock = config->socks[i];
1400 args->index = i;1425 args->index = i;
1401 queue_work(nbd->recv_workq, &args->work);1426 queue_work(nbd->recv_workq, &args->work);
1402 }1427 }
@@ -1530,17 +1555,20 @@ static int nbd_ioctl(struct block_device *bdev, blk_mode_t mode, · 127 unmodified lines
1530 return error;1555 return error;
1531}1556}
1532 1557
1533static struct nbd_config *nbd_alloc_config(void)1558static int nbd_alloc_and_init_config(struct nbd_device *nbd)
1534{1559{
1535 struct nbd_config *config;1560 struct nbd_config *config;
1536 1561
1562 if (WARN_ON(nbd->config))
1563 return -EINVAL;
1564
1537 if (!try_module_get(THIS_MODULE))1565 if (!try_module_get(THIS_MODULE))
1538 return ERR_PTR(-ENODEV);1566 return -ENODEV;
1539 1567
1540 config = kzalloc(sizeof(struct nbd_config), GFP_NOFS);1568 config = kzalloc(sizeof(struct nbd_config), GFP_NOFS);
1541 if (!config) {1569 if (!config) {
1542 module_put(THIS_MODULE);1570 module_put(THIS_MODULE);
1543 return ERR_PTR(-ENOMEM);1571 return -ENOMEM;
1544 }1572 }
1545 1573
1546 atomic_set(&config->recv_threads, 0);1574 atomic_set(&config->recv_threads, 0);
@@ -1548,12 +1576,24 @@ static struct nbd_config *nbd_alloc_config(void) · 1 unmodified line
1548 init_waitqueue_head(&config->conn_wait);1576 init_waitqueue_head(&config->conn_wait);
1549 config->blksize_bits = NBD_DEF_BLKSIZE_BITS;1577 config->blksize_bits = NBD_DEF_BLKSIZE_BITS;
1550 atomic_set(&config->live_connections, 0);1578 atomic_set(&config->live_connections, 0);
1551 return config;1579
1580 nbd->config = config;
1581 /*
1582 * Order refcount_set(&nbd->config_refs, 1) and nbd->config assignment,
1583 * its pair is the barrier in nbd_get_config_unlocked().
1584 * So nbd_get_config_unlocked() won't see nbd->config as null after
1585 * refcount_inc_not_zero() succeed.
1586 */
1587 smp_mb__before_atomic();
1588 refcount_set(&nbd->config_refs, 1);
1589
1590 return 0;
1552}1591}
1553 1592
1554static int nbd_open(struct gendisk *disk, blk_mode_t mode)1593static int nbd_open(struct gendisk *disk, blk_mode_t mode)
1555{1594{
1556 struct nbd_device *nbd;1595 struct nbd_device *nbd;
1596 struct nbd_config *config;
1557 int ret = 0;1597 int ret = 0;
1558 1598
1559 mutex_lock(&nbd_index_mutex);1599 mutex_lock(&nbd_index_mutex);
@@ -1566,27 +1606,25 @@ static int nbd_open(struct gendisk *disk, blk_mode_t mode) · 6 unmodified lines
1566 ret = -ENXIO;1606 ret = -ENXIO;
1567 goto out;1607 goto out;
1568 }1608 }
1569 if (!refcount_inc_not_zero(&nbd->config_refs)) {
1570 struct nbd_config *config;
1571 1609
1610 config = nbd_get_config_unlocked(nbd);
1611 if (!config) {
1572 mutex_lock(&nbd->config_lock);1612 mutex_lock(&nbd->config_lock);
1573 if (refcount_inc_not_zero(&nbd->config_refs)) {1613 if (refcount_inc_not_zero(&nbd->config_refs)) {
1574 mutex_unlock(&nbd->config_lock);1614 mutex_unlock(&nbd->config_lock);
1575 goto out;1615 goto out;
1576 }1616 }
1577 config = nbd_alloc_config();1617 ret = nbd_alloc_and_init_config(nbd);
1578 if (IS_ERR(config)) {1618 if (ret) {
1579 ret = PTR_ERR(config);
1580 mutex_unlock(&nbd->config_lock);1619 mutex_unlock(&nbd->config_lock);
1581 goto out;1620 goto out;
1582 }1621 }
1583 nbd->config = config;1622
1584 refcount_set(&nbd->config_refs, 1);
1585 refcount_inc(&nbd->refs);1623 refcount_inc(&nbd->refs);
1586 mutex_unlock(&nbd->config_lock);1624 mutex_unlock(&nbd->config_lock);
1587 if (max_part)1625 if (max_part)
1588 set_bit(GD_NEED_PART_SCAN, &disk->state);1626 set_bit(GD_NEED_PART_SCAN, &disk->state);
1589 } else if (nbd_disconnected(nbd->config)) {1627 } else if (nbd_disconnected(config)) {
1590 if (max_part)1628 if (max_part)
1591 set_bit(GD_NEED_PART_SCAN, &disk->state);1629 set_bit(GD_NEED_PART_SCAN, &disk->state);
1592 }1630 }
@@ -1990,22 +2028,17 @@ again: · 397 unmodified lines
1990 pr_err("nbd%d already in use\n", index);2028 pr_err("nbd%d already in use\n", index);
1991 return -EBUSY;2029 return -EBUSY;
1992 }2030 }
1993 if (WARN_ON(nbd->config)) {2031
1994 mutex_unlock(&nbd->config_lock);2032 ret = nbd_alloc_and_init_config(nbd);
1995 nbd_put(nbd);2033 if (ret) {
1996 return -EINVAL;
1997 }
1998 config = nbd_alloc_config();
1999 if (IS_ERR(config)) {
2000 mutex_unlock(&nbd->config_lock);2034 mutex_unlock(&nbd->config_lock);
2001 nbd_put(nbd);2035 nbd_put(nbd);
2002 pr_err("couldn't allocate config\n");2036 pr_err("couldn't allocate config\n");
2003 return PTR_ERR(config);2037 return ret;
2004 }2038 }
2005 nbd->config = config;
2006 refcount_set(&nbd->config_refs, 1);
2007 set_bit(NBD_RT_BOUND, &config->runtime_flags);
2008 2039
2040 config = nbd->config;
2041 set_bit(NBD_RT_BOUND, &config->runtime_flags);
2009 ret = nbd_genl_size_set(info, nbd);2042 ret = nbd_genl_size_set(info, nbd);
2010 if (ret)2043 if (ret)
2011 goto out;2044 goto out;
@@ -2208,7 +2241,8 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info) · 196 unmodified lines
2208 }2241 }
2209 mutex_unlock(&nbd_index_mutex);2242 mutex_unlock(&nbd_index_mutex);
2210 2243
2211 if (!refcount_inc_not_zero(&nbd->config_refs)) {2244 config = nbd_get_config_unlocked(nbd);
2245 if (!config) {
2212 dev_err(nbd_to_dev(nbd),2246 dev_err(nbd_to_dev(nbd),
2213 "not configured, cannot reconfigure\n");2247 "not configured, cannot reconfigure\n");
2214 nbd_put(nbd);2248 nbd_put(nbd);
@@ -2216,7 +2250,6 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info) · 1 unmodified line
2216 }2250 }
2217 2251
2218 mutex_lock(&nbd->config_lock);2252 mutex_lock(&nbd->config_lock);
2219 config = nbd->config;
2220 if (!test_bit(NBD_RT_BOUND, &config->runtime_flags) ||2253 if (!test_bit(NBD_RT_BOUND, &config->runtime_flags) ||
2221 !nbd->pid) {2254 !nbd->pid) {
2222 dev_err(nbd_to_dev(nbd),2255 dev_err(nbd_to_dev(nbd),
drivers/block/null_blk/main.c+13−12
@@ -1464,19 +1464,13 @@ blk_status_t null_process_cmd(struct nullb_cmd *cmd, enum req_op op, · 1463 unmodified lines
1464 return BLK_STS_OK;1464 return BLK_STS_OK;
1465}1465}
1466 1466
1467static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,1467static void null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
1468 sector_t nr_sectors, enum req_op op)1468 sector_t nr_sectors, enum req_op op)
1469{1469{
1470 struct nullb_device *dev = cmd->nq->dev;1470 struct nullb_device *dev = cmd->nq->dev;
1471 struct nullb *nullb = dev->nullb;1471 struct nullb *nullb = dev->nullb;
1472 blk_status_t sts;1472 blk_status_t sts;
1473 1473
1474 if (test_bit(NULLB_DEV_FL_THROTTLED, &dev->flags)) {
1475 sts = null_handle_throttled(cmd);
1476 if (sts != BLK_STS_OK)
1477 return sts;
1478 }
1479
1480 if (op == REQ_OP_FLUSH) {1474 if (op == REQ_OP_FLUSH) {
1481 cmd->error = errno_to_blk_status(null_handle_flush(nullb));1475 cmd->error = errno_to_blk_status(null_handle_flush(nullb));
1482 goto out;1476 goto out;
@@ -1493,7 +1487,6 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, · 10 unmodified lines
1493 1487
1494out:1488out:
1495 nullb_complete_cmd(cmd);1489 nullb_complete_cmd(cmd);
1496 return BLK_STS_OK;
1497}1490}
1498 1491
1499static enum hrtimer_restart nullb_bwtimer_fn(struct hrtimer *timer)1492static enum hrtimer_restart nullb_bwtimer_fn(struct hrtimer *timer)
@@ -1724,8 +1717,6 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx, · 224 unmodified lines
1724 cmd->fake_timeout = should_timeout_request(rq) ||1717 cmd->fake_timeout = should_timeout_request(rq) ||
1725 blk_should_fake_timeout(rq->q);1718 blk_should_fake_timeout(rq->q);
1726 1719
1727 blk_mq_start_request(rq);
1728
1729 if (should_requeue_request(rq)) {1720 if (should_requeue_request(rq)) {
1730 /*1721 /*
1731 * Alternate between hitting the core BUSY path, and the1722 * Alternate between hitting the core BUSY path, and the
@@ -1738,6 +1729,15 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx, · 6 unmodified lines
1738 return BLK_STS_OK;1729 return BLK_STS_OK;
1739 }1730 }
1740 1731
1732 if (test_bit(NULLB_DEV_FL_THROTTLED, &nq->dev->flags)) {
1733 blk_status_t sts = null_handle_throttled(cmd);
1734
1735 if (sts != BLK_STS_OK)
1736 return sts;
1737 }
1738
1739 blk_mq_start_request(rq);
1740
1741 if (is_poll) {1741 if (is_poll) {
1742 spin_lock(&nq->poll_lock);1742 spin_lock(&nq->poll_lock);
1743 list_add_tail(&rq->queuelist, &nq->poll_list);1743 list_add_tail(&rq->queuelist, &nq->poll_list);
@@ -1747,7 +1747,8 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx, · 3 unmodified lines
1747 if (cmd->fake_timeout)1747 if (cmd->fake_timeout)
1748 return BLK_STS_OK;1748 return BLK_STS_OK;
1749 1749
1750 return null_handle_cmd(cmd, sector, nr_sectors, req_op(rq));1750 null_handle_cmd(cmd, sector, nr_sectors, req_op(rq));
1751 return BLK_STS_OK;
1751}1752}
1752 1753
1753static void null_queue_rqs(struct request **rqlist)1754static void null_queue_rqs(struct request **rqlist)
drivers/md/bcache/bcache.h+1−0
@@ -265,6 +265,7 @@ struct bcache_device { · 264 unmodified lines
265#define BCACHE_DEV_WB_RUNNING 3265#define BCACHE_DEV_WB_RUNNING 3
266#define BCACHE_DEV_RATE_DW_RUNNING 4266#define BCACHE_DEV_RATE_DW_RUNNING 4
267 int nr_stripes;267 int nr_stripes;
268#define BCH_MIN_STRIPE_SZ ((4 << 20) >> SECTOR_SHIFT)
268 unsigned int stripe_size;269 unsigned int stripe_size;
269 atomic_t *stripe_sectors_dirty;270 atomic_t *stripe_sectors_dirty;
270 unsigned long *full_dirty_stripes;271 unsigned long *full_dirty_stripes;
drivers/md/bcache/btree.c+10−1
@@ -1000,6 +1000,9 @@ err: · 999 unmodified lines
1000 *1000 *
1001 * The btree node will have either a read or a write lock held, depending on1001 * The btree node will have either a read or a write lock held, depending on
1002 * level and op->lock.1002 * level and op->lock.
1003 *
1004 * Note: Only error code or btree pointer will be returned, it is unncessary
1005 * for callers to check NULL pointer.
1003 */1006 */
1004struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,1007struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,
1005 struct bkey *k, int level, bool write,1008 struct bkey *k, int level, bool write,
@@ -1111,6 +1114,10 @@ retry: · 105 unmodified lines
1111 mutex_unlock(&b->c->bucket_lock);1114 mutex_unlock(&b->c->bucket_lock);
1112}1115}
1113 1116
1117/*
1118 * Only error code or btree pointer will be returned, it is unncessary for
1119 * callers to check NULL pointer.
1120 */
1114struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,1121struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
1115 int level, bool wait,1122 int level, bool wait,
1116 struct btree *parent)1123 struct btree *parent)
@@ -1368,7 +1375,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, · 251 unmodified lines
1368 memset(new_nodes, 0, sizeof(new_nodes));1375 memset(new_nodes, 0, sizeof(new_nodes));
1369 closure_init_stack(&cl);1376 closure_init_stack(&cl);
1370 1377
1371 while (nodes < GC_MERGE_NODES && !IS_ERR(r[nodes].b))1378 while (nodes < GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b))
1372 keys += r[nodes++].keys;1379 keys += r[nodes++].keys;
1373 1380
1374 blocks = btree_default_blocks(b->c) * 2 / 3;1381 blocks = btree_default_blocks(b->c) * 2 / 3;
@@ -1532,6 +1539,8 @@ static int btree_gc_rewrite_node(struct btree *b, struct btree_op *op, · 157 unmodified lines
1532 return 0;1539 return 0;
1533 1540
1534 n = btree_node_alloc_replacement(replace, NULL);1541 n = btree_node_alloc_replacement(replace, NULL);
1542 if (IS_ERR(n))
1543 return 0;
1535 1544
1536 /* recheck reserve after allocating replacement node */1545 /* recheck reserve after allocating replacement node */
1537 if (btree_check_reserve(b, NULL)) {1546 if (btree_check_reserve(b, NULL)) {
drivers/md/bcache/super.c+3−1
@@ -905,6 +905,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, · 904 unmodified lines
905 905
906 if (!d->stripe_size)906 if (!d->stripe_size)
907 d->stripe_size = 1 << 31;907 d->stripe_size = 1 << 31;
908 else if (d->stripe_size < BCH_MIN_STRIPE_SZ)
909 d->stripe_size = roundup(BCH_MIN_STRIPE_SZ, d->stripe_size);
908 910
909 n = DIV_ROUND_UP_ULL(sectors, d->stripe_size);911 n = DIV_ROUND_UP_ULL(sectors, d->stripe_size);
910 if (!n || n > max_stripes) {912 if (!n || n > max_stripes) {
@@ -2016,7 +2018,7 @@ static int run_cache_set(struct cache_set *c) · 1105 unmodified lines
2016 c->root = bch_btree_node_get(c, NULL, k,2018 c->root = bch_btree_node_get(c, NULL, k,
2017 j->btree_level,2019 j->btree_level,
2018 true, NULL);2020 true, NULL);
2019 if (IS_ERR_OR_NULL(c->root))2021 if (IS_ERR(c->root))
2020 goto err;2022 goto err;
2021 2023
2022 list_del_init(&c->root->list);2024 list_del_init(&c->root->list);
drivers/md/bcache/sysfs.c+1−1
@@ -1104,7 +1104,7 @@ SHOW(__bch_cache) · 1103 unmodified lines
1104 sum += INITIAL_PRIO - cached[i];1104 sum += INITIAL_PRIO - cached[i];
1105 1105
1106 if (n)1106 if (n)
1107 do_div(sum, n);1107 sum = div64_u64(sum, n);
1108 1108
1109 for (i = 0; i < ARRAY_SIZE(q); i++)1109 for (i = 0; i < ARRAY_SIZE(q); i++)
1110 q[i] = INITIAL_PRIO - cached[n * (i + 1) /1110 q[i] = INITIAL_PRIO - cached[n * (i + 1) /
drivers/md/bcache/writeback.c+18−6
@@ -913,7 +913,7 @@ static int bch_dirty_init_thread(void *arg) · 912 unmodified lines
913 int cur_idx, prev_idx, skip_nr;913 int cur_idx, prev_idx, skip_nr;
914 914
915 k = p = NULL;915 k = p = NULL;
916 cur_idx = prev_idx = 0;916 prev_idx = 0;
917 917
918 bch_btree_iter_init(&c->root->keys, &iter, NULL);918 bch_btree_iter_init(&c->root->keys, &iter, NULL);
919 k = bch_btree_iter_next_filter(&iter, &c->root->keys, bch_ptr_bad);919 k = bch_btree_iter_next_filter(&iter, &c->root->keys, bch_ptr_bad);
@@ -977,24 +977,35 @@ static int bch_btre_dirty_init_thread_nr(void) · 57 unmodified lines
977void bch_sectors_dirty_init(struct bcache_device *d)977void bch_sectors_dirty_init(struct bcache_device *d)
978{978{
979 int i;979 int i;
980 struct btree *b = NULL;
980 struct bkey *k = NULL;981 struct bkey *k = NULL;
981 struct btree_iter iter;982 struct btree_iter iter;
982 struct sectors_dirty_init op;983 struct sectors_dirty_init op;
983 struct cache_set *c = d->c;984 struct cache_set *c = d->c;
984 struct bch_dirty_init_state state;985 struct bch_dirty_init_state state;
985 986
987retry_lock:
988 b = c->root;
989 rw_lock(0, b, b->level);
990 if (b != c->root) {
991 rw_unlock(0, b);
992 goto retry_lock;
993 }
994
986 /* Just count root keys if no leaf node */995 /* Just count root keys if no leaf node */
987 rw_lock(0, c->root, c->root->level);
988 if (c->root->level == 0) {996 if (c->root->level == 0) {
989 bch_btree_op_init(&op.op, -1);997 bch_btree_op_init(&op.op, -1);
990 op.inode = d->id;998 op.inode = d->id;
991 op.count = 0;999 op.count = 0;
992 1000
993 for_each_key_filter(&c->root->keys,1001 for_each_key_filter(&c->root->keys,
994 k, &iter, bch_ptr_invalid)1002 k, &iter, bch_ptr_invalid) {
1003 if (KEY_INODE(k) != op.inode)
1004 continue;
995 sectors_dirty_init_fn(&op.op, c->root, k);1005 sectors_dirty_init_fn(&op.op, c->root, k);
1006 }
996 1007
997 rw_unlock(0, c->root);1008 rw_unlock(0, b);
998 return;1009 return;
999 }1010 }
1000 1011
@@ -1014,23 +1025,24 @@ void bch_sectors_dirty_init(struct bcache_device *d) · 13 unmodified lines
1014 if (atomic_read(&state.enough))1025 if (atomic_read(&state.enough))
1015 break;1026 break;
1016 1027
1028 atomic_inc(&state.started);
1017 state.infos[i].state = &state;1029 state.infos[i].state = &state;
1018 state.infos[i].thread =1030 state.infos[i].thread =
1019 kthread_run(bch_dirty_init_thread, &state.infos[i],1031 kthread_run(bch_dirty_init_thread, &state.infos[i],
1020 "bch_dirtcnt[%d]", i);1032 "bch_dirtcnt[%d]", i);
1021 if (IS_ERR(state.infos[i].thread)) {1033 if (IS_ERR(state.infos[i].thread)) {
1022 pr_err("fails to run thread bch_dirty_init[%d]\n", i);1034 pr_err("fails to run thread bch_dirty_init[%d]\n", i);
1035 atomic_dec(&state.started);
1023 for (--i; i >= 0; i--)1036 for (--i; i >= 0; i--)
1024 kthread_stop(state.infos[i].thread);1037 kthread_stop(state.infos[i].thread);
1025 goto out;1038 goto out;
1026 }1039 }
1027 atomic_inc(&state.started);
1028 }1040 }
1029 1041
1030out:1042out:
1031 /* Must wait for all threads to stop. */1043 /* Must wait for all threads to stop. */
1032 wait_event(state.wait, atomic_read(&state.started) == 0);1044 wait_event(state.wait, atomic_read(&state.started) == 0);
1033 rw_unlock(0, c->root);1045 rw_unlock(0, b);
1034}1046}
1035 1047
1036void bch_cached_dev_writeback_init(struct cached_dev *dc)1048void bch_cached_dev_writeback_init(struct cached_dev *dc)
drivers/md/md.c+2−1
@@ -8666,7 +8666,8 @@ static void md_end_clone_io(struct bio *bio) · 8665 unmodified lines
8666 struct bio *orig_bio = md_io_clone->orig_bio;8666 struct bio *orig_bio = md_io_clone->orig_bio;
8667 struct mddev *mddev = md_io_clone->mddev;8667 struct mddev *mddev = md_io_clone->mddev;
8668 8668
8669 orig_bio->bi_status = bio->bi_status;8669 if (bio->bi_status && !orig_bio->bi_status)
8670 orig_bio->bi_status = bio->bi_status;
8670 8671
8671 if (md_io_clone->start_time)8672 if (md_io_clone->start_time)
8672 bio_end_io_acct(orig_bio, md_io_clone->start_time);8673 bio_end_io_acct(orig_bio, md_io_clone->start_time);
drivers/nvme/host/auth.c+3−2
@@ -757,12 +757,11 @@ static void nvme_queue_auth_work(struct work_struct *work) · 756 unmodified lines
757 __func__, chap->qid);757 __func__, chap->qid);
758 mutex_lock(&ctrl->dhchap_auth_mutex);758 mutex_lock(&ctrl->dhchap_auth_mutex);
759 ret = nvme_auth_dhchap_setup_host_response(ctrl, chap);759 ret = nvme_auth_dhchap_setup_host_response(ctrl, chap);
760 mutex_unlock(&ctrl->dhchap_auth_mutex);
760 if (ret) {761 if (ret) {
761 mutex_unlock(&ctrl->dhchap_auth_mutex);
762 chap->error = ret;762 chap->error = ret;
763 goto fail2;763 goto fail2;
764 }764 }
765 mutex_unlock(&ctrl->dhchap_auth_mutex);
766 765
767 /* DH-HMAC-CHAP Step 3: send reply */766 /* DH-HMAC-CHAP Step 3: send reply */
768 dev_dbg(ctrl->device, "%s: qid %d send reply\n",767 dev_dbg(ctrl->device, "%s: qid %d send reply\n",
@@ -839,6 +838,8 @@ static void nvme_queue_auth_work(struct work_struct *work) · 70 unmodified lines
839 }838 }
840 839
841fail2:840fail2:
841 if (chap->status == 0)
842 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED;
842 dev_dbg(ctrl->device, "%s: qid %d send failure2, status %x\n",843 dev_dbg(ctrl->device, "%s: qid %d send failure2, status %x\n",
843 __func__, chap->qid, chap->status);844 __func__, chap->qid, chap->status);
844 tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap);845 tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap);
drivers/nvme/host/core.c+14−7
@@ -482,7 +482,6 @@ EXPORT_SYMBOL_GPL(nvme_cancel_tagset); · 481 unmodified lines
482 482
483void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl)483void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl)
484{484{
485 nvme_stop_keep_alive(ctrl);
486 if (ctrl->admin_tagset) {485 if (ctrl->admin_tagset) {
487 blk_mq_tagset_busy_iter(ctrl->admin_tagset,486 blk_mq_tagset_busy_iter(ctrl->admin_tagset,
488 nvme_cancel_request, ctrl);487 nvme_cancel_request, ctrl);
@@ -1814,16 +1813,18 @@ set_pi: · 1325 unmodified lines
1814 return ret;1813 return ret;
1815}1814}
1816 1815
1817static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)1816static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
1818{1817{
1819 struct nvme_ctrl *ctrl = ns->ctrl;1818 struct nvme_ctrl *ctrl = ns->ctrl;
1819 int ret;
1820 1820
1821 if (nvme_init_ms(ns, id))1821 ret = nvme_init_ms(ns, id);
1822 return;1822 if (ret)
1823 return ret;
1823 1824
1824 ns->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);1825 ns->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
1825 if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))1826 if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
1826 return;1827 return 0;
1827 1828
1828 if (ctrl->ops->flags & NVME_F_FABRICS) {1829 if (ctrl->ops->flags & NVME_F_FABRICS) {
1829 /*1830 /*
@@ -1832,7 +1833,7 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 2 unmodified lines
1832 * remap the separate metadata buffer from the block layer.1833 * remap the separate metadata buffer from the block layer.
1833 */1834 */
1834 if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))1835 if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))
1835 return;1836 return 0;
1836 1837
1837 ns->features |= NVME_NS_EXT_LBAS;1838 ns->features |= NVME_NS_EXT_LBAS;
1838 1839
@@ -1859,6 +1860,7 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 20 unmodified lines
1859 else1860 else
1860 ns->features |= NVME_NS_METADATA_SUPPORTED;1861 ns->features |= NVME_NS_METADATA_SUPPORTED;
1861 }1862 }
1863 return 0;
1862}1864}
1863 1865
1864static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,1866static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
@@ -2032,7 +2034,11 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns, · 167 unmodified lines
2032 ns->lba_shift = id->lbaf[lbaf].ds;2034 ns->lba_shift = id->lbaf[lbaf].ds;
2033 nvme_set_queue_limits(ns->ctrl, ns->queue);2035 nvme_set_queue_limits(ns->ctrl, ns->queue);
2034 2036
2035 nvme_configure_metadata(ns, id);2037 ret = nvme_configure_metadata(ns, id);
2038 if (ret < 0) {
2039 blk_mq_unfreeze_queue(ns->disk->queue);
2040 goto out;
2041 }
2036 nvme_set_chunk_sectors(ns, id);2042 nvme_set_chunk_sectors(ns, id);
2037 nvme_update_disk_info(ns->disk, ns, id);2043 nvme_update_disk_info(ns->disk, ns, id);
2038 2044
@@ -4348,6 +4354,7 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) · 2309 unmodified lines
4348{4354{
4349 nvme_mpath_stop(ctrl);4355 nvme_mpath_stop(ctrl);
4350 nvme_auth_stop(ctrl);4356 nvme_auth_stop(ctrl);
4357 nvme_stop_keep_alive(ctrl);
4351 nvme_stop_failfast_work(ctrl);4358 nvme_stop_failfast_work(ctrl);
4352 flush_work(&ctrl->async_event_work);4359 flush_work(&ctrl->async_event_work);
4353 cancel_work_sync(&ctrl->fw_act_work);4360 cancel_work_sync(&ctrl->fw_act_work);
drivers/nvme/host/fabrics.c+2−0
@@ -667,8 +667,10 @@ static const match_table_t opt_tokens = { · 666 unmodified lines
667#endif667#endif
668 { NVMF_OPT_FAIL_FAST_TMO, "fast_io_fail_tmo=%d" },668 { NVMF_OPT_FAIL_FAST_TMO, "fast_io_fail_tmo=%d" },
669 { NVMF_OPT_DISCOVERY, "discovery" },669 { NVMF_OPT_DISCOVERY, "discovery" },
670#ifdef CONFIG_NVME_HOST_AUTH
670 { NVMF_OPT_DHCHAP_SECRET, "dhchap_secret=%s" },671 { NVMF_OPT_DHCHAP_SECRET, "dhchap_secret=%s" },
671 { NVMF_OPT_DHCHAP_CTRL_SECRET, "dhchap_ctrl_secret=%s" },672 { NVMF_OPT_DHCHAP_CTRL_SECRET, "dhchap_ctrl_secret=%s" },
673#endif
672#ifdef CONFIG_NVME_TCP_TLS674#ifdef CONFIG_NVME_TCP_TLS
673 { NVMF_OPT_TLS, "tls" },675 { NVMF_OPT_TLS, "tls" },
674#endif676#endif
drivers/nvme/host/fc.c+8−11
@@ -2530,12 +2530,6 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) · 2529 unmodified lines
2530 * clean up the admin queue. Same thing as above.2530 * clean up the admin queue. Same thing as above.
2531 */2531 */
2532 nvme_quiesce_admin_queue(&ctrl->ctrl);2532 nvme_quiesce_admin_queue(&ctrl->ctrl);
2533
2534 /*
2535 * Open-coding nvme_cancel_admin_tagset() as fc
2536 * is not using nvme_cancel_request().
2537 */
2538 nvme_stop_keep_alive(&ctrl->ctrl);
2539 blk_sync_queue(ctrl->ctrl.admin_q);2533 blk_sync_queue(ctrl->ctrl.admin_q);
2540 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,2534 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
2541 nvme_fc_terminate_exchange, &ctrl->ctrl);2535 nvme_fc_terminate_exchange, &ctrl->ctrl);
@@ -3138,11 +3132,12 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 596 unmodified lines
3138 nvme_unquiesce_admin_queue(&ctrl->ctrl);3132 nvme_unquiesce_admin_queue(&ctrl->ctrl);
3139 3133
3140 ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);3134 ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);
3141 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
3142 ret = -EIO;
3143 if (ret)3135 if (ret)
3144 goto out_disconnect_admin_queue;3136 goto out_disconnect_admin_queue;
3145 3137 if (test_bit(ASSOC_FAILED, &ctrl->flags)) {
3138 ret = -EIO;
3139 goto out_stop_keep_alive;
3140 }
3146 /* sanity checks */3141 /* sanity checks */
3147 3142
3148 /* FC-NVME does not have other data in the capsule */3143 /* FC-NVME does not have other data in the capsule */
@@ -3150,7 +3145,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 1 unmodified line
3150 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n",3145 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n",
3151 ctrl->ctrl.icdoff);3146 ctrl->ctrl.icdoff);
3152 ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;3147 ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
3153 goto out_disconnect_admin_queue;3148 goto out_stop_keep_alive;
3154 }3149 }
3155 3150
3156 /* FC-NVME supports normal SGL Data Block Descriptors */3151 /* FC-NVME supports normal SGL Data Block Descriptors */
@@ -3158,7 +3153,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 1 unmodified line
3158 dev_err(ctrl->ctrl.device,3153 dev_err(ctrl->ctrl.device,
3159 "Mandatory sgls are not supported!\n");3154 "Mandatory sgls are not supported!\n");
3160 ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;3155 ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
3161 goto out_disconnect_admin_queue;3156 goto out_stop_keep_alive;
3162 }3157 }
3163 3158
3164 if (opts->queue_size > ctrl->ctrl.maxcmd) {3159 if (opts->queue_size > ctrl->ctrl.maxcmd) {
@@ -3205,6 +3200,8 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 40 unmodified lines
3205 3200
3206out_term_aen_ops:3201out_term_aen_ops:
3207 nvme_fc_term_aen_ops(ctrl);3202 nvme_fc_term_aen_ops(ctrl);
3203out_stop_keep_alive:
3204 nvme_stop_keep_alive(&ctrl->ctrl);
3208out_disconnect_admin_queue:3205out_disconnect_admin_queue:
3209 dev_warn(ctrl->ctrl.device,3206 dev_warn(ctrl->ctrl.device,
3210 "NVME-FC{%d}: create_assoc failed, assoc_id %llx ret %d\n",3207 "NVME-FC{%d}: create_assoc failed, assoc_id %llx ret %d\n",
drivers/nvme/host/rdma.c+1−0
@@ -1080,6 +1080,7 @@ destroy_io: · 1079 unmodified lines
1080 nvme_rdma_free_io_queues(ctrl);1080 nvme_rdma_free_io_queues(ctrl);
1081 }1081 }
1082destroy_admin:1082destroy_admin:
1083 nvme_stop_keep_alive(&ctrl->ctrl);
1083 nvme_quiesce_admin_queue(&ctrl->ctrl);1084 nvme_quiesce_admin_queue(&ctrl->ctrl);
1084 blk_sync_queue(ctrl->ctrl.admin_q);1085 blk_sync_queue(ctrl->ctrl.admin_q);
1085 nvme_rdma_stop_queue(&ctrl->queues[0]);1086 nvme_rdma_stop_queue(&ctrl->queues[0]);
drivers/nvme/host/tcp.c+15−17
@@ -36,11 +36,11 @@ static int so_priority; · 35 unmodified lines
36module_param(so_priority, int, 0644);36module_param(so_priority, int, 0644);
37MODULE_PARM_DESC(so_priority, "nvme tcp socket optimize priority");37MODULE_PARM_DESC(so_priority, "nvme tcp socket optimize priority");
38 38
39#ifdef CONFIG_NVME_TCP_TLS
40/*39/*
41 * TLS handshake timeout40 * TLS handshake timeout
42 */41 */
43static int tls_handshake_timeout = 10;42static int tls_handshake_timeout = 10;
43#ifdef CONFIG_NVME_TCP_TLS
44module_param(tls_handshake_timeout, int, 0644);44module_param(tls_handshake_timeout, int, 0644);
45MODULE_PARM_DESC(tls_handshake_timeout,45MODULE_PARM_DESC(tls_handshake_timeout,
46 "nvme TLS handshake timeout in seconds (default 10)");46 "nvme TLS handshake timeout in seconds (default 10)");
@@ -161,10 +161,8 @@ struct nvme_tcp_queue { · 114 unmodified lines
161 struct ahash_request *snd_hash;161 struct ahash_request *snd_hash;
162 __le32 exp_ddgst;162 __le32 exp_ddgst;
163 __le32 recv_ddgst;163 __le32 recv_ddgst;
164#ifdef CONFIG_NVME_TCP_TLS
165 struct completion tls_complete;164 struct completion tls_complete;
166 int tls_err;165 int tls_err;
167#endif
168 struct page_frag_cache pf_cache;166 struct page_frag_cache pf_cache;
169 167
170 void (*state_change)(struct sock *);168 void (*state_change)(struct sock *);
@@ -207,6 +205,14 @@ static inline int nvme_tcp_queue_id(struct nvme_tcp_queue *queue) · 36 unmodified lines
207 return queue - queue->ctrl->queues;205 return queue - queue->ctrl->queues;
208}206}
209 207
208static inline bool nvme_tcp_tls(struct nvme_ctrl *ctrl)
209{
210 if (!IS_ENABLED(CONFIG_NVME_TCP_TLS))
211 return 0;
212
213 return ctrl->opts->tls;
214}
215
210static inline struct blk_mq_tags *nvme_tcp_tagset(struct nvme_tcp_queue *queue)216static inline struct blk_mq_tags *nvme_tcp_tagset(struct nvme_tcp_queue *queue)
211{217{
212 u32 queue_idx = nvme_tcp_queue_id(queue);218 u32 queue_idx = nvme_tcp_queue_id(queue);
@@ -1412,7 +1418,7 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 1199 unmodified lines
1412 memset(&msg, 0, sizeof(msg));1418 memset(&msg, 0, sizeof(msg));
1413 iov.iov_base = icresp;1419 iov.iov_base = icresp;
1414 iov.iov_len = sizeof(*icresp);1420 iov.iov_len = sizeof(*icresp);
1415 if (queue->ctrl->ctrl.opts->tls) {1421 if (nvme_tcp_tls(&queue->ctrl->ctrl)) {
1416 msg.msg_control = cbuf;1422 msg.msg_control = cbuf;
1417 msg.msg_controllen = sizeof(cbuf);1423 msg.msg_controllen = sizeof(cbuf);
1418 }1424 }
@@ -1424,7 +1430,7 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 5 unmodified lines
1424 goto free_icresp;1430 goto free_icresp;
1425 }1431 }
1426 ret = -ENOTCONN;1432 ret = -ENOTCONN;
1427 if (queue->ctrl->ctrl.opts->tls) {1433 if (nvme_tcp_tls(&queue->ctrl->ctrl)) {
1428 ctype = tls_get_record_type(queue->sock->sk,1434 ctype = tls_get_record_type(queue->sock->sk,
1429 (struct cmsghdr *)cbuf);1435 (struct cmsghdr *)cbuf);
1430 if (ctype != TLS_RECORD_TYPE_DATA) {1436 if (ctype != TLS_RECORD_TYPE_DATA) {
@@ -1548,7 +1554,6 @@ static void nvme_tcp_set_queue_io_cpu(struct nvme_tcp_queue *queue) · 117 unmodified lines
1548 queue->io_cpu = cpumask_next_wrap(n - 1, cpu_online_mask, -1, false);1554 queue->io_cpu = cpumask_next_wrap(n - 1, cpu_online_mask, -1, false);
1549}1555}
1550 1556
1551#ifdef CONFIG_NVME_TCP_TLS
1552static void nvme_tcp_tls_done(void *data, int status, key_serial_t pskid)1557static void nvme_tcp_tls_done(void *data, int status, key_serial_t pskid)
1553{1558{
1554 struct nvme_tcp_queue *queue = data;1559 struct nvme_tcp_queue *queue = data;
@@ -1625,14 +1630,6 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl, · 70 unmodified lines
1625 }1630 }
1626 return ret;1631 return ret;
1627}1632}
1628#else
1629static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,
1630 struct nvme_tcp_queue *queue,
1631 key_serial_t pskid)
1632{
1633 return -EPROTONOSUPPORT;
1634}
1635#endif
1636 1633
1637static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,1634static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,
1638 key_serial_t pskid)1635 key_serial_t pskid)
@@ -1759,7 +1756,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, · 120 unmodified lines
1759 }1756 }
1760 1757
1761 /* If PSKs are configured try to start TLS */1758 /* If PSKs are configured try to start TLS */
1762 if (pskid) {1759 if (IS_ENABLED(CONFIG_NVME_TCP_TLS) && pskid) {
1763 ret = nvme_tcp_start_tls(nctrl, queue, pskid);1760 ret = nvme_tcp_start_tls(nctrl, queue, pskid);
1764 if (ret)1761 if (ret)
1765 goto err_init_connect;1762 goto err_init_connect;
@@ -1916,7 +1913,7 @@ static int nvme_tcp_alloc_admin_queue(struct nvme_ctrl *ctrl) · 150 unmodified lines
1916 int ret;1913 int ret;
1917 key_serial_t pskid = 0;1914 key_serial_t pskid = 0;
1918 1915
1919 if (ctrl->opts->tls) {1916 if (nvme_tcp_tls(ctrl)) {
1920 if (ctrl->opts->tls_key)1917 if (ctrl->opts->tls_key)
1921 pskid = key_serial(ctrl->opts->tls_key);1918 pskid = key_serial(ctrl->opts->tls_key);
1922 else1919 else
@@ -1949,7 +1946,7 @@ static int __nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) · 26 unmodified lines
1949{1946{
1950 int i, ret;1947 int i, ret;
1951 1948
1952 if (ctrl->opts->tls && !ctrl->tls_key) {1949 if (nvme_tcp_tls(ctrl) && !ctrl->tls_key) {
1953 dev_err(ctrl->device, "no PSK negotiated\n");1950 dev_err(ctrl->device, "no PSK negotiated\n");
1954 return -ENOKEY;1951 return -ENOKEY;
1955 }1952 }
@@ -2237,6 +2234,7 @@ destroy_io: · 281 unmodified lines
2237 nvme_tcp_destroy_io_queues(ctrl, new);2234 nvme_tcp_destroy_io_queues(ctrl, new);
2238 }2235 }
2239destroy_admin:2236destroy_admin:
2237 nvme_stop_keep_alive(ctrl);
2240 nvme_tcp_teardown_admin_queue(ctrl, false);2238 nvme_tcp_teardown_admin_queue(ctrl, false);
2241 return ret;2239 return ret;
2242}2240}
drivers/nvme/target/Kconfig+2−2
@@ -4,6 +4,8 @@ config NVME_TARGET · 3 unmodified lines
4 tristate "NVMe Target support"4 tristate "NVMe Target support"
5 depends on BLOCK5 depends on BLOCK
6 depends on CONFIGFS_FS6 depends on CONFIGFS_FS
7 select NVME_KEYRING if NVME_TARGET_TCP_TLS
8 select KEYS if NVME_TARGET_TCP_TLS
7 select BLK_DEV_INTEGRITY_T10 if BLK_DEV_INTEGRITY9 select BLK_DEV_INTEGRITY_T10 if BLK_DEV_INTEGRITY
8 select SGL_ALLOC10 select SGL_ALLOC
9 help11 help
@@ -87,9 +89,7 @@ config NVME_TARGET_TCP · 77 unmodified lines
87config NVME_TARGET_TCP_TLS89config NVME_TARGET_TCP_TLS
88 bool "NVMe over Fabrics TCP target TLS encryption support"90 bool "NVMe over Fabrics TCP target TLS encryption support"
89 depends on NVME_TARGET_TCP91 depends on NVME_TARGET_TCP
90 select NVME_KEYRING
91 select NET_HANDSHAKE92 select NET_HANDSHAKE
92 select KEYS
93 help93 help
94 Enables TLS encryption for the NVMe TCP target using the netlink handshake API.94 Enables TLS encryption for the NVMe TCP target using the netlink handshake API.
95 95
drivers/nvme/target/configfs.c+1−1
@@ -1893,7 +1893,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group, · 1892 unmodified lines
1893 return ERR_PTR(-ENOMEM);1893 return ERR_PTR(-ENOMEM);
1894 }1894 }
1895 1895
1896 if (nvme_keyring_id()) {1896 if (IS_ENABLED(CONFIG_NVME_TARGET_TCP_TLS) && nvme_keyring_id()) {
1897 port->keyring = key_lookup(nvme_keyring_id());1897 port->keyring = key_lookup(nvme_keyring_id());
1898 if (IS_ERR(port->keyring)) {1898 if (IS_ERR(port->keyring)) {
1899 pr_warn("NVMe keyring not available, disabling TLS\n");1899 pr_warn("NVMe keyring not available, disabling TLS\n");
drivers/nvme/target/fabrics-cmd.c+4−0
@@ -244,6 +244,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req) · 243 unmodified lines
244 goto out;244 goto out;
245 }245 }
246 246
247 d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
248 d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
247 status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,249 status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
248 le32_to_cpu(c->kato), &ctrl);250 le32_to_cpu(c->kato), &ctrl);
249 if (status)251 if (status)
@@ -313,6 +315,8 @@ static void nvmet_execute_io_connect(struct nvmet_req *req) · 63 unmodified lines
313 goto out;315 goto out;
314 }316 }
315 317
318 d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
319 d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
316 ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,320 ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,
317 le16_to_cpu(d->cntlid), req);321 le16_to_cpu(d->cntlid), req);
318 if (!ctrl) {322 if (!ctrl) {
drivers/nvme/target/tcp.c+3−1
@@ -1854,6 +1854,8 @@ static int nvmet_tcp_tls_handshake(struct nvmet_tcp_queue *queue) · 1853 unmodified lines
1854 }1854 }
1855 return ret;1855 return ret;
1856}1856}
1857#else
1858static void nvmet_tcp_tls_handshake_timeout(struct work_struct *w) {}
1857#endif1859#endif
1858 1860
1859static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,1861static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
@@ -1911,9 +1913,9 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, · 51 unmodified lines
1911 list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list);1913 list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list);
1912 mutex_unlock(&nvmet_tcp_queue_mutex);1914 mutex_unlock(&nvmet_tcp_queue_mutex);
1913 1915
1914#ifdef CONFIG_NVME_TARGET_TCP_TLS
1915 INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work,1916 INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work,
1916 nvmet_tcp_tls_handshake_timeout);1917 nvmet_tcp_tls_handshake_timeout);
1918#ifdef CONFIG_NVME_TARGET_TCP_TLS
1917 if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {1919 if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {
1918 struct sock *sk = queue->sock->sk;1920 struct sock *sk = queue->sock->sk;
1919 1921
drivers/s390/block/dasd.c+13−11
@@ -676,18 +676,20 @@ static void dasd_profile_start(struct dasd_block *block, · 675 unmodified lines
676 * we count each request only once.676 * we count each request only once.
677 */677 */
678 device = cqr->startdev;678 device = cqr->startdev;
679 if (device->profile.data) {679 if (!device->profile.data)
680 counter = 1; /* request is not yet queued on the start device */680 return;
681 list_for_each(l, &device->ccw_queue)681
682 if (++counter >= 31)682 spin_lock(get_ccwdev_lock(device->cdev));
683 break;683 counter = 1; /* request is not yet queued on the start device */
684 }684 list_for_each(l, &device->ccw_queue)
685 if (++counter >= 31)
686 break;
687 spin_unlock(get_ccwdev_lock(device->cdev));
688
685 spin_lock(&device->profile.lock);689 spin_lock(&device->profile.lock);
686 if (device->profile.data) {690 device->profile.data->dasd_io_nr_req[counter]++;
687 device->profile.data->dasd_io_nr_req[counter]++;691 if (rq_data_dir(req) == READ)
688 if (rq_data_dir(req) == READ)692 device->profile.data->dasd_read_nr_req[counter]++;
689 device->profile.data->dasd_read_nr_req[counter]++;
690 }
691 spin_unlock(&device->profile.lock);693 spin_unlock(&device->profile.lock);
692}694}
693 695
drivers/s390/block/dasd_int.h+1−1
@@ -283,7 +283,7 @@ struct dasd_pprc_dev_info { · 282 unmodified lines
283 __u8 secondary; /* 7 Secondary device address */283 __u8 secondary; /* 7 Secondary device address */
284 __u16 pprc_id; /* 8-9 Peer-to-Peer Remote Copy ID */284 __u16 pprc_id; /* 8-9 Peer-to-Peer Remote Copy ID */
285 __u8 reserved2[12]; /* 10-21 reserved */285 __u8 reserved2[12]; /* 10-21 reserved */
286 __u16 prim_cu_ssid; /* 22-23 Pimary Control Unit SSID */286 __u16 prim_cu_ssid; /* 22-23 Primary Control Unit SSID */
287 __u8 reserved3[12]; /* 24-35 reserved */287 __u8 reserved3[12]; /* 24-35 reserved */
288 __u16 sec_cu_ssid; /* 36-37 Secondary Control Unit SSID */288 __u16 sec_cu_ssid; /* 36-37 Secondary Control Unit SSID */
289 __u8 reserved4[90]; /* 38-127 reserved */289 __u8 reserved4[90]; /* 38-127 reserved */
include/linux/blk-pm.h+0−1
@@ -15,7 +15,6 @@ extern int blk_pre_runtime_suspend(struct request_queue *q); · 14 unmodified lines
15extern void blk_post_runtime_suspend(struct request_queue *q, int err);15extern void blk_post_runtime_suspend(struct request_queue *q, int err);
16extern void blk_pre_runtime_resume(struct request_queue *q);16extern void blk_pre_runtime_resume(struct request_queue *q);
17extern void blk_post_runtime_resume(struct request_queue *q);17extern void blk_post_runtime_resume(struct request_queue *q);
18extern void blk_set_runtime_active(struct request_queue *q);
19#else18#else
20static inline void blk_pm_runtime_init(struct request_queue *q,19static inline void blk_pm_runtime_init(struct request_queue *q,
21 struct device *dev) {}20 struct device *dev) {}

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