diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-21 19:20:05 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-21 19:20:05 -0400 |
| commit | 0151ef0085f946eed75da851297577f88d74c50c (patch) | |
| tree | 9ab2f69450555848a5c4d0d473f06b248e1a07c2 | |
| parent | bb236dbeea8181c6733e6d34a53bfef9c8ef4e95 (diff) | |
| parent | 42de82a8b544fa55670feef7d6f85085fba48fc0 (diff) | |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
"A small set of fixes for -rc2 - two fixes for BFQ, documentation and
code, and a removal of an unused variable in nbd. Outside of that, a
small collection of fixes from the usual crew on the nvme side"
* 'for-linus' of git://git.kernel.dk/linux-block:
nvmet: don't report 0-bytes in serial number
nvmet: preserve controller serial number between reboots
nvmet: Move serial number from controller to subsystem
nvmet: prefix version configfs file with attr
nvme-pci: Fix an error handling path in 'nvme_probe()'
nvme-pci: Remove nvme_setup_prps BUG_ON
nvme-pci: add another device ID with stripe quirk
nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association
nvme: fix byte swapping in the streams code
nbd: kill unused ret in recv_work
bfq: dispatch request to prevent queue stalling after the request completion
bfq: fix typos in comments about B-WF2Q+ algorithm
| -rw-r--r-- | block/bfq-iosched.c | 3 | ||||
| -rw-r--r-- | block/bfq-iosched.h | 2 | ||||
| -rw-r--r-- | block/bfq-wf2q.c | 2 | ||||
| -rw-r--r-- | drivers/block/nbd.c | 2 | ||||
| -rw-r--r-- | drivers/nvme/host/core.c | 2 | ||||
| -rw-r--r-- | drivers/nvme/host/pci.c | 43 | ||||
| -rw-r--r-- | drivers/nvme/target/admin-cmd.c | 16 | ||||
| -rw-r--r-- | drivers/nvme/target/configfs.c | 30 | ||||
| -rw-r--r-- | drivers/nvme/target/core.c | 5 | ||||
| -rw-r--r-- | drivers/nvme/target/fc.c | 8 | ||||
| -rw-r--r-- | drivers/nvme/target/nvmet.h | 2 | ||||
| -rw-r--r-- | include/linux/nvme.h | 14 |
12 files changed, 92 insertions, 37 deletions
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 60a6835265fc..436b6ca6b175 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c | |||
| @@ -4299,6 +4299,9 @@ static void bfq_completed_request(struct bfq_queue *bfqq, struct bfq_data *bfqd) | |||
| 4299 | bfq_bfqq_expire(bfqd, bfqq, false, | 4299 | bfq_bfqq_expire(bfqd, bfqq, false, |
| 4300 | BFQQE_NO_MORE_REQUESTS); | 4300 | BFQQE_NO_MORE_REQUESTS); |
| 4301 | } | 4301 | } |
| 4302 | |||
| 4303 | if (!bfqd->rq_in_driver) | ||
| 4304 | bfq_schedule_dispatch(bfqd); | ||
| 4302 | } | 4305 | } |
| 4303 | 4306 | ||
| 4304 | static void bfq_put_rq_priv_body(struct bfq_queue *bfqq) | 4307 | static void bfq_put_rq_priv_body(struct bfq_queue *bfqq) |
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 8fd83b885774..63e771ab56d8 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h | |||
| @@ -52,7 +52,7 @@ struct bfq_entity; | |||
| 52 | struct bfq_service_tree { | 52 | struct bfq_service_tree { |
| 53 | /* tree for active entities (i.e., those backlogged) */ | 53 | /* tree for active entities (i.e., those backlogged) */ |
| 54 | struct rb_root active; | 54 | struct rb_root active; |
| 55 | /* tree for idle entities (i.e., not backlogged, with V <= F_i)*/ | 55 | /* tree for idle entities (i.e., not backlogged, with V < F_i)*/ |
| 56 | struct rb_root idle; | 56 | struct rb_root idle; |
| 57 | 57 | ||
| 58 | /* idle entity with minimum F_i */ | 58 | /* idle entity with minimum F_i */ |
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 5ec05cd42b80..979f8f21b7e2 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c | |||
| @@ -1297,7 +1297,7 @@ static void bfq_update_vtime(struct bfq_service_tree *st, u64 new_value) | |||
| 1297 | * | 1297 | * |
| 1298 | * This function searches the first schedulable entity, starting from the | 1298 | * This function searches the first schedulable entity, starting from the |
| 1299 | * root of the tree and going on the left every time on this side there is | 1299 | * root of the tree and going on the left every time on this side there is |
| 1300 | * a subtree with at least one eligible (start >= vtime) entity. The path on | 1300 | * a subtree with at least one eligible (start <= vtime) entity. The path on |
| 1301 | * the right is followed only if a) the left subtree contains no eligible | 1301 | * the right is followed only if a) the left subtree contains no eligible |
| 1302 | * entities and b) no eligible entity has been found yet. | 1302 | * entities and b) no eligible entity has been found yet. |
| 1303 | */ | 1303 | */ |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index dea7d85134ee..87a0a29f6e7e 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -626,7 +626,6 @@ static void recv_work(struct work_struct *work) | |||
| 626 | struct nbd_device *nbd = args->nbd; | 626 | struct nbd_device *nbd = args->nbd; |
| 627 | struct nbd_config *config = nbd->config; | 627 | struct nbd_config *config = nbd->config; |
| 628 | struct nbd_cmd *cmd; | 628 | struct nbd_cmd *cmd; |
| 629 | int ret = 0; | ||
| 630 | 629 | ||
| 631 | while (1) { | 630 | while (1) { |
| 632 | cmd = nbd_read_stat(nbd, args->index); | 631 | cmd = nbd_read_stat(nbd, args->index); |
| @@ -636,7 +635,6 @@ static void recv_work(struct work_struct *work) | |||
| 636 | mutex_lock(&nsock->tx_lock); | 635 | mutex_lock(&nsock->tx_lock); |
| 637 | nbd_mark_nsock_dead(nbd, nsock, 1); | 636 | nbd_mark_nsock_dead(nbd, nsock, 1); |
| 638 | mutex_unlock(&nsock->tx_lock); | 637 | mutex_unlock(&nsock->tx_lock); |
| 639 | ret = PTR_ERR(cmd); | ||
| 640 | break; | 638 | break; |
| 641 | } | 639 | } |
| 642 | 640 | ||
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index cb96f4a7ae3a..3b77cfe5aa1e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
| @@ -336,7 +336,7 @@ static int nvme_get_stream_params(struct nvme_ctrl *ctrl, | |||
| 336 | 336 | ||
| 337 | c.directive.opcode = nvme_admin_directive_recv; | 337 | c.directive.opcode = nvme_admin_directive_recv; |
| 338 | c.directive.nsid = cpu_to_le32(nsid); | 338 | c.directive.nsid = cpu_to_le32(nsid); |
| 339 | c.directive.numd = sizeof(*s); | 339 | c.directive.numd = cpu_to_le32(sizeof(*s)); |
| 340 | c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM; | 340 | c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM; |
| 341 | c.directive.dtype = NVME_DIR_STREAMS; | 341 | c.directive.dtype = NVME_DIR_STREAMS; |
| 342 | 342 | ||
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index d10d2f279d19..8569ee771269 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
| @@ -539,7 +539,7 @@ static void nvme_dif_complete(u32 p, u32 v, struct t10_pi_tuple *pi) | |||
| 539 | } | 539 | } |
| 540 | #endif | 540 | #endif |
| 541 | 541 | ||
| 542 | static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | 542 | static blk_status_t nvme_setup_prps(struct nvme_dev *dev, struct request *req) |
| 543 | { | 543 | { |
| 544 | struct nvme_iod *iod = blk_mq_rq_to_pdu(req); | 544 | struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
| 545 | struct dma_pool *pool; | 545 | struct dma_pool *pool; |
| @@ -556,7 +556,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | |||
| 556 | 556 | ||
| 557 | length -= (page_size - offset); | 557 | length -= (page_size - offset); |
| 558 | if (length <= 0) | 558 | if (length <= 0) |
| 559 | return true; | 559 | return BLK_STS_OK; |
| 560 | 560 | ||
| 561 | dma_len -= (page_size - offset); | 561 | dma_len -= (page_size - offset); |
| 562 | if (dma_len) { | 562 | if (dma_len) { |
| @@ -569,7 +569,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | |||
| 569 | 569 | ||
| 570 | if (length <= page_size) { | 570 | if (length <= page_size) { |
| 571 | iod->first_dma = dma_addr; | 571 | iod->first_dma = dma_addr; |
| 572 | return true; | 572 | return BLK_STS_OK; |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | nprps = DIV_ROUND_UP(length, page_size); | 575 | nprps = DIV_ROUND_UP(length, page_size); |
| @@ -585,7 +585,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | |||
| 585 | if (!prp_list) { | 585 | if (!prp_list) { |
| 586 | iod->first_dma = dma_addr; | 586 | iod->first_dma = dma_addr; |
| 587 | iod->npages = -1; | 587 | iod->npages = -1; |
| 588 | return false; | 588 | return BLK_STS_RESOURCE; |
| 589 | } | 589 | } |
| 590 | list[0] = prp_list; | 590 | list[0] = prp_list; |
| 591 | iod->first_dma = prp_dma; | 591 | iod->first_dma = prp_dma; |
| @@ -595,7 +595,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | |||
| 595 | __le64 *old_prp_list = prp_list; | 595 | __le64 *old_prp_list = prp_list; |
| 596 | prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma); | 596 | prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma); |
| 597 | if (!prp_list) | 597 | if (!prp_list) |
| 598 | return false; | 598 | return BLK_STS_RESOURCE; |
| 599 | list[iod->npages++] = prp_list; | 599 | list[iod->npages++] = prp_list; |
| 600 | prp_list[0] = old_prp_list[i - 1]; | 600 | prp_list[0] = old_prp_list[i - 1]; |
| 601 | old_prp_list[i - 1] = cpu_to_le64(prp_dma); | 601 | old_prp_list[i - 1] = cpu_to_le64(prp_dma); |
| @@ -609,13 +609,29 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) | |||
| 609 | break; | 609 | break; |
| 610 | if (dma_len > 0) | 610 | if (dma_len > 0) |
| 611 | continue; | 611 | continue; |
| 612 | BUG_ON(dma_len < 0); | 612 | if (unlikely(dma_len < 0)) |
| 613 | goto bad_sgl; | ||
| 613 | sg = sg_next(sg); | 614 | sg = sg_next(sg); |
| 614 | dma_addr = sg_dma_address(sg); | 615 | dma_addr = sg_dma_address(sg); |
| 615 | dma_len = sg_dma_len(sg); | 616 | dma_len = sg_dma_len(sg); |
| 616 | } | 617 | } |
| 617 | 618 | ||
| 618 | return true; | 619 | return BLK_STS_OK; |
| 620 | |||
| 621 | bad_sgl: | ||
| 622 | if (WARN_ONCE(1, "Invalid SGL for payload:%d nents:%d\n", | ||
| 623 | blk_rq_payload_bytes(req), iod->nents)) { | ||
| 624 | for_each_sg(iod->sg, sg, iod->nents, i) { | ||
| 625 | dma_addr_t phys = sg_phys(sg); | ||
| 626 | pr_warn("sg[%d] phys_addr:%pad offset:%d length:%d " | ||
| 627 | "dma_address:%pad dma_length:%d\n", i, &phys, | ||
| 628 | sg->offset, sg->length, | ||
| 629 | &sg_dma_address(sg), | ||
| 630 | sg_dma_len(sg)); | ||
| 631 | } | ||
| 632 | } | ||
| 633 | return BLK_STS_IOERR; | ||
| 634 | |||
| 619 | } | 635 | } |
| 620 | 636 | ||
| 621 | static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, | 637 | static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, |
| @@ -637,7 +653,8 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, | |||
| 637 | DMA_ATTR_NO_WARN)) | 653 | DMA_ATTR_NO_WARN)) |
| 638 | goto out; | 654 | goto out; |
| 639 | 655 | ||
| 640 | if (!nvme_setup_prps(dev, req)) | 656 | ret = nvme_setup_prps(dev, req); |
| 657 | if (ret != BLK_STS_OK) | ||
| 641 | goto out_unmap; | 658 | goto out_unmap; |
| 642 | 659 | ||
| 643 | ret = BLK_STS_IOERR; | 660 | ret = BLK_STS_IOERR; |
| @@ -2282,7 +2299,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2282 | 2299 | ||
| 2283 | result = nvme_dev_map(dev); | 2300 | result = nvme_dev_map(dev); |
| 2284 | if (result) | 2301 | if (result) |
| 2285 | goto free; | 2302 | goto put_pci; |
| 2286 | 2303 | ||
| 2287 | INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work); | 2304 | INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work); |
| 2288 | INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work); | 2305 | INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work); |
| @@ -2291,7 +2308,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2291 | 2308 | ||
| 2292 | result = nvme_setup_prp_pools(dev); | 2309 | result = nvme_setup_prp_pools(dev); |
| 2293 | if (result) | 2310 | if (result) |
| 2294 | goto put_pci; | 2311 | goto unmap; |
| 2295 | 2312 | ||
| 2296 | quirks |= check_dell_samsung_bug(pdev); | 2313 | quirks |= check_dell_samsung_bug(pdev); |
| 2297 | 2314 | ||
| @@ -2308,9 +2325,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2308 | 2325 | ||
| 2309 | release_pools: | 2326 | release_pools: |
| 2310 | nvme_release_prp_pools(dev); | 2327 | nvme_release_prp_pools(dev); |
| 2328 | unmap: | ||
| 2329 | nvme_dev_unmap(dev); | ||
| 2311 | put_pci: | 2330 | put_pci: |
| 2312 | put_device(dev->dev); | 2331 | put_device(dev->dev); |
| 2313 | nvme_dev_unmap(dev); | ||
| 2314 | free: | 2332 | free: |
| 2315 | kfree(dev->queues); | 2333 | kfree(dev->queues); |
| 2316 | kfree(dev); | 2334 | kfree(dev); |
| @@ -2466,6 +2484,9 @@ static const struct pci_device_id nvme_id_table[] = { | |||
| 2466 | { PCI_VDEVICE(INTEL, 0x0a54), | 2484 | { PCI_VDEVICE(INTEL, 0x0a54), |
| 2467 | .driver_data = NVME_QUIRK_STRIPE_SIZE | | 2485 | .driver_data = NVME_QUIRK_STRIPE_SIZE | |
| 2468 | NVME_QUIRK_DEALLOCATE_ZEROES, }, | 2486 | NVME_QUIRK_DEALLOCATE_ZEROES, }, |
| 2487 | { PCI_VDEVICE(INTEL, 0x0a55), | ||
| 2488 | .driver_data = NVME_QUIRK_STRIPE_SIZE | | ||
| 2489 | NVME_QUIRK_DEALLOCATE_ZEROES, }, | ||
| 2469 | { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ | 2490 | { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ |
| 2470 | .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, | 2491 | .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, |
| 2471 | { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ | 2492 | { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ |
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 35f930db3c02..2d7a98ab53fb 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c | |||
| @@ -168,11 +168,21 @@ out: | |||
| 168 | nvmet_req_complete(req, status); | 168 | nvmet_req_complete(req, status); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static void copy_and_pad(char *dst, int dst_len, const char *src, int src_len) | ||
| 172 | { | ||
| 173 | int len = min(src_len, dst_len); | ||
| 174 | |||
| 175 | memcpy(dst, src, len); | ||
| 176 | if (dst_len > len) | ||
| 177 | memset(dst + len, ' ', dst_len - len); | ||
| 178 | } | ||
| 179 | |||
| 171 | static void nvmet_execute_identify_ctrl(struct nvmet_req *req) | 180 | static void nvmet_execute_identify_ctrl(struct nvmet_req *req) |
| 172 | { | 181 | { |
| 173 | struct nvmet_ctrl *ctrl = req->sq->ctrl; | 182 | struct nvmet_ctrl *ctrl = req->sq->ctrl; |
| 174 | struct nvme_id_ctrl *id; | 183 | struct nvme_id_ctrl *id; |
| 175 | u16 status = 0; | 184 | u16 status = 0; |
| 185 | const char model[] = "Linux"; | ||
| 176 | 186 | ||
| 177 | id = kzalloc(sizeof(*id), GFP_KERNEL); | 187 | id = kzalloc(sizeof(*id), GFP_KERNEL); |
| 178 | if (!id) { | 188 | if (!id) { |
| @@ -184,8 +194,10 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) | |||
| 184 | id->vid = 0; | 194 | id->vid = 0; |
| 185 | id->ssvid = 0; | 195 | id->ssvid = 0; |
| 186 | 196 | ||
| 187 | memset(id->sn, ' ', sizeof(id->sn)); | 197 | bin2hex(id->sn, &ctrl->subsys->serial, |
| 188 | snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial); | 198 | min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); |
| 199 | copy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1); | ||
| 200 | copy_and_pad(id->fr, sizeof(id->fr), UTS_RELEASE, strlen(UTS_RELEASE)); | ||
| 189 | 201 | ||
| 190 | memset(id->mn, ' ', sizeof(id->mn)); | 202 | memset(id->mn, ' ', sizeof(id->mn)); |
| 191 | strncpy((char *)id->mn, "Linux", sizeof(id->mn)); | 203 | strncpy((char *)id->mn, "Linux", sizeof(id->mn)); |
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index a358ecd93e11..0a0067e771f5 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c | |||
| @@ -650,7 +650,7 @@ out_unlock: | |||
| 650 | 650 | ||
| 651 | CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host); | 651 | CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host); |
| 652 | 652 | ||
| 653 | static ssize_t nvmet_subsys_version_show(struct config_item *item, | 653 | static ssize_t nvmet_subsys_attr_version_show(struct config_item *item, |
| 654 | char *page) | 654 | char *page) |
| 655 | { | 655 | { |
| 656 | struct nvmet_subsys *subsys = to_subsys(item); | 656 | struct nvmet_subsys *subsys = to_subsys(item); |
| @@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item, | |||
| 666 | (int)NVME_MINOR(subsys->ver)); | 666 | (int)NVME_MINOR(subsys->ver)); |
| 667 | } | 667 | } |
| 668 | 668 | ||
| 669 | static ssize_t nvmet_subsys_version_store(struct config_item *item, | 669 | static ssize_t nvmet_subsys_attr_version_store(struct config_item *item, |
| 670 | const char *page, size_t count) | 670 | const char *page, size_t count) |
| 671 | { | 671 | { |
| 672 | struct nvmet_subsys *subsys = to_subsys(item); | 672 | struct nvmet_subsys *subsys = to_subsys(item); |
| @@ -684,11 +684,33 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item, | |||
| 684 | 684 | ||
| 685 | return count; | 685 | return count; |
| 686 | } | 686 | } |
| 687 | CONFIGFS_ATTR(nvmet_subsys_, version); | 687 | CONFIGFS_ATTR(nvmet_subsys_, attr_version); |
| 688 | |||
| 689 | static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item, | ||
| 690 | char *page) | ||
| 691 | { | ||
| 692 | struct nvmet_subsys *subsys = to_subsys(item); | ||
| 693 | |||
| 694 | return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial); | ||
| 695 | } | ||
| 696 | |||
| 697 | static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item, | ||
| 698 | const char *page, size_t count) | ||
| 699 | { | ||
| 700 | struct nvmet_subsys *subsys = to_subsys(item); | ||
| 701 | |||
| 702 | down_write(&nvmet_config_sem); | ||
| 703 | sscanf(page, "%llx\n", &subsys->serial); | ||
| 704 | up_write(&nvmet_config_sem); | ||
| 705 | |||
| 706 | return count; | ||
| 707 | } | ||
| 708 | CONFIGFS_ATTR(nvmet_subsys_, attr_serial); | ||
| 688 | 709 | ||
| 689 | static struct configfs_attribute *nvmet_subsys_attrs[] = { | 710 | static struct configfs_attribute *nvmet_subsys_attrs[] = { |
| 690 | &nvmet_subsys_attr_attr_allow_any_host, | 711 | &nvmet_subsys_attr_attr_allow_any_host, |
| 691 | &nvmet_subsys_attr_version, | 712 | &nvmet_subsys_attr_attr_version, |
| 713 | &nvmet_subsys_attr_attr_serial, | ||
| 692 | NULL, | 714 | NULL, |
| 693 | }; | 715 | }; |
| 694 | 716 | ||
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index b5b4ac103748..f4b02bb4a1a8 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c | |||
| @@ -767,9 +767,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, | |||
| 767 | memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); | 767 | memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); |
| 768 | memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); | 768 | memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); |
| 769 | 769 | ||
| 770 | /* generate a random serial number as our controllers are ephemeral: */ | ||
| 771 | get_random_bytes(&ctrl->serial, sizeof(ctrl->serial)); | ||
| 772 | |||
| 773 | kref_init(&ctrl->ref); | 770 | kref_init(&ctrl->ref); |
| 774 | ctrl->subsys = subsys; | 771 | ctrl->subsys = subsys; |
| 775 | 772 | ||
| @@ -928,6 +925,8 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn, | |||
| 928 | return NULL; | 925 | return NULL; |
| 929 | 926 | ||
| 930 | subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */ | 927 | subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */ |
| 928 | /* generate a random serial number as our controllers are ephemeral: */ | ||
| 929 | get_random_bytes(&subsys->serial, sizeof(subsys->serial)); | ||
| 931 | 930 | ||
| 932 | switch (type) { | 931 | switch (type) { |
| 933 | case NVME_NQN_NVME: | 932 | case NVME_NQN_NVME: |
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 1e6dcc241b3c..d5801c150b1c 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c | |||
| @@ -1174,14 +1174,14 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport, | |||
| 1174 | */ | 1174 | */ |
| 1175 | if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN) | 1175 | if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN) |
| 1176 | ret = VERR_CR_ASSOC_LEN; | 1176 | ret = VERR_CR_ASSOC_LEN; |
| 1177 | else if (rqst->desc_list_len < | 1177 | else if (be32_to_cpu(rqst->desc_list_len) < |
| 1178 | cpu_to_be32(FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN)) | 1178 | FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN) |
| 1179 | ret = VERR_CR_ASSOC_RQST_LEN; | 1179 | ret = VERR_CR_ASSOC_RQST_LEN; |
| 1180 | else if (rqst->assoc_cmd.desc_tag != | 1180 | else if (rqst->assoc_cmd.desc_tag != |
| 1181 | cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD)) | 1181 | cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD)) |
| 1182 | ret = VERR_CR_ASSOC_CMD; | 1182 | ret = VERR_CR_ASSOC_CMD; |
| 1183 | else if (rqst->assoc_cmd.desc_len < | 1183 | else if (be32_to_cpu(rqst->assoc_cmd.desc_len) < |
| 1184 | cpu_to_be32(FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN)) | 1184 | FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN) |
| 1185 | ret = VERR_CR_ASSOC_CMD_LEN; | 1185 | ret = VERR_CR_ASSOC_CMD_LEN; |
| 1186 | else if (!rqst->assoc_cmd.ersp_ratio || | 1186 | else if (!rqst->assoc_cmd.ersp_ratio || |
| 1187 | (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >= | 1187 | (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >= |
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 747bbdb4f9c6..e3b244c7e443 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h | |||
| @@ -112,7 +112,6 @@ struct nvmet_ctrl { | |||
| 112 | 112 | ||
| 113 | struct mutex lock; | 113 | struct mutex lock; |
| 114 | u64 cap; | 114 | u64 cap; |
| 115 | u64 serial; | ||
| 116 | u32 cc; | 115 | u32 cc; |
| 117 | u32 csts; | 116 | u32 csts; |
| 118 | 117 | ||
| @@ -152,6 +151,7 @@ struct nvmet_subsys { | |||
| 152 | u16 max_qid; | 151 | u16 max_qid; |
| 153 | 152 | ||
| 154 | u64 ver; | 153 | u64 ver; |
| 154 | u64 serial; | ||
| 155 | char *subsysnqn; | 155 | char *subsysnqn; |
| 156 | 156 | ||
| 157 | struct config_group group; | 157 | struct config_group group; |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 6b8ee9e628e1..bc74da018bdc 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
| @@ -963,14 +963,14 @@ struct nvme_dbbuf { | |||
| 963 | }; | 963 | }; |
| 964 | 964 | ||
| 965 | struct streams_directive_params { | 965 | struct streams_directive_params { |
| 966 | __u16 msl; | 966 | __le16 msl; |
| 967 | __u16 nssa; | 967 | __le16 nssa; |
| 968 | __u16 nsso; | 968 | __le16 nsso; |
| 969 | __u8 rsvd[10]; | 969 | __u8 rsvd[10]; |
| 970 | __u32 sws; | 970 | __le32 sws; |
| 971 | __u16 sgs; | 971 | __le16 sgs; |
| 972 | __u16 nsa; | 972 | __le16 nsa; |
| 973 | __u16 nso; | 973 | __le16 nso; |
| 974 | __u8 rsvd2[6]; | 974 | __u8 rsvd2[6]; |
| 975 | }; | 975 | }; |
| 976 | 976 | ||
