Skip to content

Commit 815a76b

Browse files
committed
Merge tag 'block-6.8-2024-02-01' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: - NVMe pull request via Keith: - Remove duplicated enums (Guixen) - Use appropriate controller state accessors (Keith) - Retryable authentication (Hannes) - Add missing module descriptions (Chaitanya) - Fibre-channel fixes for blktests (Daniel) - Various type correctness updates (Caleb) - Improve fabrics connection debugging prints (Nitin) - Passthrough command verbose error logging (Adam) - Fix for where we set IO priority in the bio for drivers that use fops->submit_bio() to queue IO, like md/dm etc. * tag 'block-6.8-2024-02-01' of git://git.kernel.dk/linux: (32 commits) block: Fix where bio IO priority gets set nvme: allow passthru cmd error logging nvme-fc: show hostnqn when connecting to fc target nvme-rdma: show hostnqn when connecting to rdma target nvme-tcp: show hostnqn when connecting to tcp target nvmet-fc: use RCU list iterator for assoc_list nvmet-fc: take ref count on tgtport before delete assoc nvmet-fc: avoid deadlock on delete association path nvmet-fc: abort command when there is no binding nvmet-fc: do not tack refs on tgtports from assoc nvmet-fc: remove null hostport pointer check nvmet-fc: hold reference on hostport match nvmet-fc: free queue and assoc directly nvmet-fc: defer cleanup using RCU properly nvmet-fc: release reference on target port nvmet-fcloop: swap the list_add_tail arguments nvme-fc: do not wait in vain when unloading module nvme-fc: log human-readable opcode on timeout nvme: split out fabrics version of nvme_opcode_str() nvme: take const cmd pointer in read-only helpers ...
2 parents 717ca0b + f3c8998 commit 815a76b

File tree

25 files changed

+390
-246
lines changed

25 files changed

+390
-246
lines changed

block/blk-core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "blk-pm.h"
5050
#include "blk-cgroup.h"
5151
#include "blk-throttle.h"
52+
#include "blk-ioprio.h"
5253

5354
struct dentry *blk_debugfs_root;
5455

@@ -833,6 +834,14 @@ void submit_bio_noacct(struct bio *bio)
833834
}
834835
EXPORT_SYMBOL(submit_bio_noacct);
835836

837+
static void bio_set_ioprio(struct bio *bio)
838+
{
839+
/* Nobody set ioprio so far? Initialize it based on task's nice value */
840+
if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
841+
bio->bi_ioprio = get_current_ioprio();
842+
blkcg_set_ioprio(bio);
843+
}
844+
836845
/**
837846
* submit_bio - submit a bio to the block device layer for I/O
838847
* @bio: The &struct bio which describes the I/O
@@ -855,6 +864,7 @@ void submit_bio(struct bio *bio)
855864
count_vm_events(PGPGOUT, bio_sectors(bio));
856865
}
857866

867+
bio_set_ioprio(bio);
858868
submit_bio_noacct(bio);
859869
}
860870
EXPORT_SYMBOL(submit_bio);

block/blk-mq.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "blk-stat.h"
4141
#include "blk-mq-sched.h"
4242
#include "blk-rq-qos.h"
43-
#include "blk-ioprio.h"
4443

4544
static DEFINE_PER_CPU(struct llist_head, blk_cpu_done);
4645
static DEFINE_PER_CPU(call_single_data_t, blk_cpu_csd);
@@ -2944,14 +2943,6 @@ static bool blk_mq_use_cached_rq(struct request *rq, struct blk_plug *plug,
29442943
return true;
29452944
}
29462945

2947-
static void bio_set_ioprio(struct bio *bio)
2948-
{
2949-
/* Nobody set ioprio so far? Initialize it based on task's nice value */
2950-
if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
2951-
bio->bi_ioprio = get_current_ioprio();
2952-
blkcg_set_ioprio(bio);
2953-
}
2954-
29552946
/**
29562947
* blk_mq_submit_bio - Create and send a request to block device.
29572948
* @bio: Bio pointer.
@@ -2976,7 +2967,6 @@ void blk_mq_submit_bio(struct bio *bio)
29762967
blk_status_t ret;
29772968

29782969
bio = blk_queue_bounce(bio, q);
2979-
bio_set_ioprio(bio);
29802970

29812971
if (plug) {
29822972
rq = rq_list_peek(&plug->cached_rq);

drivers/nvme/common/auth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,5 @@ int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key)
471471
}
472472
EXPORT_SYMBOL_GPL(nvme_auth_generate_key);
473473

474+
MODULE_DESCRIPTION("NVMe Authentication framework");
474475
MODULE_LICENSE("GPL v2");

drivers/nvme/common/keyring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,6 @@ static void __exit nvme_keyring_exit(void)
181181

182182
MODULE_LICENSE("GPL v2");
183183
MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>");
184+
MODULE_DESCRIPTION("NVMe Keyring implementation");
184185
module_init(nvme_keyring_init);
185186
module_exit(nvme_keyring_exit);

drivers/nvme/host/apple.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ static int apple_nvme_init_request(struct blk_mq_tag_set *set,
797797

798798
static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
799799
{
800+
enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);
800801
u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
801802
bool dead = false, freeze = false;
802803
unsigned long flags;
@@ -808,8 +809,8 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
808809
if (csts & NVME_CSTS_CFS)
809810
dead = true;
810811

811-
if (anv->ctrl.state == NVME_CTRL_LIVE ||
812-
anv->ctrl.state == NVME_CTRL_RESETTING) {
812+
if (state == NVME_CTRL_LIVE ||
813+
state == NVME_CTRL_RESETTING) {
813814
freeze = true;
814815
nvme_start_freeze(&anv->ctrl);
815816
}
@@ -881,7 +882,7 @@ static enum blk_eh_timer_return apple_nvme_timeout(struct request *req)
881882
unsigned long flags;
882883
u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
883884

884-
if (anv->ctrl.state != NVME_CTRL_LIVE) {
885+
if (nvme_ctrl_state(&anv->ctrl) != NVME_CTRL_LIVE) {
885886
/*
886887
* From rdma.c:
887888
* If we are resetting, connecting or deleting we should
@@ -985,10 +986,10 @@ static void apple_nvme_reset_work(struct work_struct *work)
985986
u32 boot_status, aqa;
986987
struct apple_nvme *anv =
987988
container_of(work, struct apple_nvme, ctrl.reset_work);
989+
enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);
988990

989-
if (anv->ctrl.state != NVME_CTRL_RESETTING) {
990-
dev_warn(anv->dev, "ctrl state %d is not RESETTING\n",
991-
anv->ctrl.state);
991+
if (state != NVME_CTRL_RESETTING) {
992+
dev_warn(anv->dev, "ctrl state %d is not RESETTING\n", state);
992993
ret = -ENODEV;
993994
goto out;
994995
}

drivers/nvme/host/auth.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ struct nvme_dhchap_queue_context {
4848

4949
static struct workqueue_struct *nvme_auth_wq;
5050

51-
#define nvme_auth_flags_from_qid(qid) \
52-
(qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED
53-
#define nvme_auth_queue_from_qid(ctrl, qid) \
54-
(qid == 0) ? (ctrl)->fabrics_q : (ctrl)->connect_q
55-
5651
static inline int ctrl_max_dhchaps(struct nvme_ctrl *ctrl)
5752
{
5853
return ctrl->opts->nr_io_queues + ctrl->opts->nr_write_queues +
@@ -63,10 +58,15 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
6358
void *data, size_t data_len, bool auth_send)
6459
{
6560
struct nvme_command cmd = {};
66-
blk_mq_req_flags_t flags = nvme_auth_flags_from_qid(qid);
67-
struct request_queue *q = nvme_auth_queue_from_qid(ctrl, qid);
61+
nvme_submit_flags_t flags = NVME_SUBMIT_RETRY;
62+
struct request_queue *q = ctrl->fabrics_q;
6863
int ret;
6964

65+
if (qid != 0) {
66+
flags |= NVME_SUBMIT_NOWAIT | NVME_SUBMIT_RESERVED;
67+
q = ctrl->connect_q;
68+
}
69+
7070
cmd.auth_common.opcode = nvme_fabrics_command;
7171
cmd.auth_common.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
7272
cmd.auth_common.spsp0 = 0x01;
@@ -80,8 +80,7 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
8080
}
8181

8282
ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, data_len,
83-
qid == 0 ? NVME_QID_ANY : qid,
84-
0, flags);
83+
qid == 0 ? NVME_QID_ANY : qid, flags);
8584
if (ret > 0)
8685
dev_warn(ctrl->device,
8786
"qid %d auth_send failed with status %d\n", qid, ret);
@@ -897,7 +896,7 @@ static void nvme_ctrl_auth_work(struct work_struct *work)
897896
* If the ctrl is no connected, bail as reconnect will handle
898897
* authentication.
899898
*/
900-
if (ctrl->state != NVME_CTRL_LIVE)
899+
if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE)
901900
return;
902901

903902
/* Authenticate admin queue first */

drivers/nvme/host/constants.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,31 +171,31 @@ static const char * const nvme_statuses[] = {
171171
[NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command",
172172
};
173173

174-
const unsigned char *nvme_get_error_status_str(u16 status)
174+
const char *nvme_get_error_status_str(u16 status)
175175
{
176176
status &= 0x7ff;
177177
if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status])
178-
return nvme_statuses[status & 0x7ff];
178+
return nvme_statuses[status];
179179
return "Unknown";
180180
}
181181

182-
const unsigned char *nvme_get_opcode_str(u8 opcode)
182+
const char *nvme_get_opcode_str(u8 opcode)
183183
{
184184
if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode])
185185
return nvme_ops[opcode];
186186
return "Unknown";
187187
}
188188
EXPORT_SYMBOL_GPL(nvme_get_opcode_str);
189189

190-
const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
190+
const char *nvme_get_admin_opcode_str(u8 opcode)
191191
{
192192
if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode])
193193
return nvme_admin_ops[opcode];
194194
return "Unknown";
195195
}
196196
EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str);
197197

198-
const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) {
198+
const char *nvme_get_fabrics_opcode_str(u8 opcode) {
199199
if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode])
200200
return nvme_fabrics_ops[opcode];
201201
return "Unknown";

0 commit comments

Comments
 (0)