#
a2941f6a |
| 27-Sep-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: add command id quirk for apple controllers
Some apple controllers use the command id as an index to implementation specific data structures and will fail if the value is out of bounds. The nvm
nvme: add command id quirk for apple controllers
Some apple controllers use the command id as an index to implementation specific data structures and will fail if the value is out of bounds. The nvme driver's recently introduced command sequence number breaks this controller.
Provide a quirk so these spec incompliant controllers can function as before. The driver will not have the ability to detect bad completions when this quirk is used, but we weren't previously checking this anyway.
The quirk bit was selected so that it can readily apply to stable.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=214509 Cc: Sven Peter <sven@svenpeter.dev> Reported-by: Orlando Chamberlain <redecorating@protonmail.com> Reported-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/20210927154306.387437-1-kbusch@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
#
43dc9878 |
| 26-Aug-2021 |
Adam Manzanares <a.manzanares@samsung.com> |
nvme: move nvme_multi_css into nvme.h
Preparatory patch in order to reuse nvme_multi_css in the nvme target code.
Signed-off-by: Adam Manzanares <a.manzanares@samsung.com> Reviewed-by: Keith Busch
nvme: move nvme_multi_css into nvme.h
Preparatory patch in order to reuse nvme_multi_css in the nvme target code.
Signed-off-by: Adam Manzanares <a.manzanares@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
e7d65803 |
| 24-Aug-2021 |
Hannes Reinecke <hare@suse.de> |
nvme-multipath: revalidate paths during rescan
When triggering a rescan due to a namespace resize we will be receiving AENs on every controller, triggering a rescan of all attached namespaces. If mu
nvme-multipath: revalidate paths during rescan
When triggering a rescan due to a namespace resize we will be receiving AENs on every controller, triggering a rescan of all attached namespaces. If multipath is active only the current path and the ns_head disk will be updated, the other paths will still refer to the old size until AENs for the remaining controllers are received.
If I/O comes in before that it might be routed to one of the old paths, triggering an I/O failure with 'access beyond end of device'. With this patch the old paths are skipped from multipath path selection until the controller serving these paths has been rescanned.
Signed-off-by: Hannes Reinecke <hare@suse.de> [dwagner: - introduce NVME_NS_READY flag instead of NVME_NS_INVALIDATE - use 'revalidate' instead of 'invalidate' which follows the zoned device code path. - clear NVME_NS_READY before clearing current_path] Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
9891668e |
| 16-Aug-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: remove the unused NVME_NS_* enum
These values are unused now that the lightnvm support is gone.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org>
|
#
77979058 |
| 16-Aug-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: remove nvm_ndev from ns
Now that the lightnvm driver is removed, we don't need a pointer to it's now non-existent struct.
Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christo
nvme: remove nvm_ndev from ns
Now that the lightnvm driver is removed, we don't need a pointer to it's now non-existent struct.
Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
e7006de6 |
| 16-Jun-2021 |
Sagi Grimberg <sagi@grimberg.me> |
nvme: code command_id with a genctr for use-after-free validation
We cannot detect a (perhaps buggy) controller that is sending us a completion for a request that was already completed (for example
nvme: code command_id with a genctr for use-after-free validation
We cannot detect a (perhaps buggy) controller that is sending us a completion for a request that was already completed (for example sending a completion twice), this phenomenon was seen in the wild a few times.
So to protect against this, we use the upper 4 msbits of the nvme sqe command_id to use as a 4-bit generation counter and verify it matches the existing request generation that is incrementing on every execution.
The 16-bit command_id structure now is constructed by: | xxxx | xxxxxxxxxxxx | gen request tag
This means that we are giving up some possible queue depth as 12 bits allow for a maximum queue depth of 4095 instead of 65536, however we never create such long queues anyways so no real harm done.
Suggested-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Acked-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Daniel Wagner <dwagner@suse.de> Tested-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
9ea9b9c4 |
| 12-Aug-2021 |
Christoph Hellwig <hch@lst.de> |
remove the lightnvm subsystem
Lightnvm supports the OCSSD 1.x and 2.0 specs which were early attempts to produce Open Channel SSDs and never made it into the NVMe spec proper. They have since been
remove the lightnvm subsystem
Lightnvm supports the OCSSD 1.x and 2.0 specs which were early attempts to produce Open Channel SSDs and never made it into the NVMe spec proper. They have since been superceeded by NVMe enhancements such as ZNS support. Remove the support per the deprecation schedule.
Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210812132308.38486-1-hch@lst.de Reviewed-by: Matias Bjørling <mb@lightnvm.io> Reviewed-by: Javier González <javier@javigon.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
#
5396fdac |
| 16-Jul-2021 |
Hannes Reinecke <hare@suse.de> |
nvme: fix refcounting imbalance when all paths are down
When the last path to a ns_head drops the current code removes the ns_head from the subsystem list, but will only delete the disk itself if th
nvme: fix refcounting imbalance when all paths are down
When the last path to a ns_head drops the current code removes the ns_head from the subsystem list, but will only delete the disk itself if the last reference to the ns_head drops. This is causing an refcounting imbalance eg when applications have a reference to the disk, as then they'll never get notified that the disk is in fact dead. This patch moves the call 'del_gendisk' into nvme_mpath_check_last_path(), ensuring that the disk can be properly removed and applications get the appropriate notifications.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
ae5e6886 |
| 10-Jun-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: use return value from blk_execute_rq()
We don't have an nvme status to report if the driver's .queue_rq() returns an error without dispatching the requested nvme command. Check the return valu
nvme: use return value from blk_execute_rq()
We don't have an nvme status to report if the driver's .queue_rq() returns an error without dispatching the requested nvme command. Check the return value from blk_execute_rq() for all passthrough commands so the caller may know their command was not successful.
If the command is from the target passthrough interface and fails to dispatch, synthesize the response back to the host as a internal target error.
Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Link: https://lore.kernel.org/r/20210610214437.641245-5-kbusch@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
#
be42a33b |
| 10-Jun-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: use blk_execute_rq() for passthrough commands
The generic blk_execute_rq() knows how to handle polled completions. Use that instead of implementing an nvme specific handler.
Signed-off-by: Ke
nvme: use blk_execute_rq() for passthrough commands
The generic blk_execute_rq() knows how to handle polled completions. Use that instead of implementing an nvme specific handler.
Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Link: https://lore.kernel.org/r/20210610214437.641245-3-kbusch@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
show more ...
|
#
73eefc27 |
| 09-Jun-2021 |
Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> |
nvme: add a helper to check ctrl sgl support
For various transports such as fc/tcp/pci it is common to check if NVMe SGLs are supported or not by the controller.
In this preparation patch we add a
nvme: add a helper to check ctrl sgl support
For various transports such as fc/tcp/pci it is common to check if NVMe SGLs are supported or not by the controller.
In this preparation patch we add a helper to avoid the open coding of such checks in the various transport.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
f1cf35e1 |
| 19-May-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: remove nvme_{get,put}_ns_from_disk
Now that only one caller is left remove the helpers by restructuring nvme_pr_command so that it has two helpers for sending a command of to a given nsid usin
nvme: remove nvme_{get,put}_ns_from_disk
Now that only one caller is left remove the helpers by restructuring nvme_pr_command so that it has two helpers for sending a command of to a given nsid using either the ns_head for multipath, or the namespace stored in the gendisk.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
show more ...
|
#
8b4fb0f9 |
| 19-May-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: split nvme_report_zones
Split multipath support out of nvme_report_zones into a separate helper and simplify the non-multipath version as a result.
Signed-off-by: Christoph Hellwig <hch@lst.d
nvme: split nvme_report_zones
Split multipath support out of nvme_report_zones into a separate helper and simplify the non-multipath version as a result.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
show more ...
|
#
5e1f6899 |
| 29-Apr-2021 |
Christoph Hellwig <hch@lst.de> |
nvme-multipath: fix double initialization of ANA state
nvme_init_identify and thus nvme_mpath_init can be called multiple times and thus must not overwrite potentially initialized or in-use fields.
nvme-multipath: fix double initialization of ANA state
nvme_init_identify and thus nvme_mpath_init can be called multiple times and thus must not overwrite potentially initialized or in-use fields. Split out a helper for the basic initialization when the controller is initialized and make sure the init_identify path does not blindly change in-use data structures.
Fixes: 0d0b660f214d ("nvme: add ANA support") Reported-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Hannes Reinecke <hare@suse.de>
show more ...
|
#
a9715744 |
| 25-Apr-2021 |
Tao Chiu <taochiu@synology.com> |
nvme: move the fabrics queue ready check routines to core
queue_rq() in pci only checks if the dispatched queue (nvmeq) is ready, e.g. not being suspended. Since nvme_alloc_admin_tags() in reset flo
nvme: move the fabrics queue ready check routines to core
queue_rq() in pci only checks if the dispatched queue (nvmeq) is ready, e.g. not being suspended. Since nvme_alloc_admin_tags() in reset flow restarts the admin queue, users are able to submit admin commands to a controller before reset_work() completes. Commands submitted under this condition may interfere with commands that performs identify, IO queue setup in reset_work(), and may result in a hang described in the following patch.
As seen in the fabrics, user commands are prevented from being executed under inproper controller states. We may reuse this logic to maintain a clear admin queue during reset_work().
Signed-off-by: Tao Chiu <taochiu@synology.com> Signed-off-by: Cody Wong <codywong@synology.com> Reviewed-by: Leon Chien <leonchien@synology.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
48145b62 |
| 22-Apr-2021 |
Minwoo Im <minwoo.im.dev@gmail.com> |
nvme: fix controller ioctl through ns_head
In multipath case, we should consider namespace attachment with controllers in a subsystem when we find out the live controller for the namespace. This pa
nvme: fix controller ioctl through ns_head
In multipath case, we should consider namespace attachment with controllers in a subsystem when we find out the live controller for the namespace. This patch manually reverted the commit 3557a4409701 ("nvme: don't bother to look up a namespace for controller ioctls") with few more updates to nvme_ns_head_chr_ioctl which has been newly updated.
Fixes: 3557a4409701 ("nvme: don't bother to look up a namespace for controller ioctls") Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
2637baed |
| 21-Apr-2021 |
Minwoo Im <minwoo.im.dev@gmail.com> |
nvme: introduce generic per-namespace chardev
Userspace has not been allowed to I/O to device that's failed to be initialized. This patch introduces generic per-namespace character device to allow
nvme: introduce generic per-namespace chardev
Userspace has not been allowed to I/O to device that's failed to be initialized. This patch introduces generic per-namespace character device to allow userspace to I/O regardless the block device is there or not.
The chardev naming convention will similar to the existing blkdev naming, using a ng prefix instead of nvme, i.e.
- /dev/ngXnY
It also supports multipath which means it will not expose chardev for the hidden namespace blkdevs (e.g., nvmeXcYnZ). If /dev/ngXnY is created for a ns_head, then I/O request will be routed to a specific controller selected by the iopolicy of the subsystem.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Javier González <javier.gonz@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Tested-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
a70b81bd |
| 16-Apr-2021 |
Hannes Reinecke <hare@suse.de> |
nvme: sanitize KATO setting
According to the NVMe base spec the KATO commands should be sent at half of the KATO interval, to properly account for round-trip times. As we now will only ever send one
nvme: sanitize KATO setting
According to the NVMe base spec the KATO commands should be sent at half of the KATO interval, to properly account for round-trip times. As we now will only ever send one KATO command per connection we can easily use the recommended values. This also fixes a potential issue where the request timeout for the KATO command does not match the value in the connect command, which might be causing spurious connection drops from the target.
Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
1496bd49 |
| 07-Apr-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: move nvme_ns_head_ops to multipath.c
Move the multipath block_device_operations to multipath.c, where they belong.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbus
nvme: move nvme_ns_head_ops to multipath.c
Move the multipath block_device_operations to multipath.c, where they belong.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Javier González <javier.gonz@samsung.com> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
show more ...
|
#
2405252a |
| 10-Apr-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: move the ioctl code to a separate file
Split out the ioctl code from core.c into a new file. Also update copyrights while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-
nvme: move the ioctl code to a separate file
Split out the ioctl code from core.c into a new file. Also update copyrights while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Javier González <javier.gonz@samsung.com> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
show more ...
|
#
d7790d37 |
| 14-Aug-2020 |
Christoph Hellwig <hch@lst.de> |
nvme: pass a user pointer to nvme_nvm_ioctl
Pass the proper user pointer instead of the not all that useful integer representation.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith
nvme: pass a user pointer to nvme_nvm_ioctl
Pass the proper user pointer instead of the not all that useful integer representation.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Javier González <javier.gonz@samsung.com>
show more ...
|
#
9953ab0c |
| 07-Apr-2021 |
Christoph Hellwig <hch@lst.de> |
nvme: cleanup setting the disk name
Return false from nvme_set_disk_name and let the caller set the non-multipath name instead of duplicating the naming information in two places. Also remove the p
nvme: cleanup setting the disk name
Return false from nvme_set_disk_name and let the caller set the non-multipath name instead of duplicating the naming information in two places. Also remove the pointless local variables for the disk name and flags and the not needed ctrl argument.
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Javier González <javier.gonz@samsung.com>
show more ...
|
#
30897388 |
| 07-Apr-2021 |
Minwoo Im <minwoo.im.dev@gmail.com> |
nvme: add a nvme_ns_head_multipath helper
Move the multipath gendisk out of #ifdef CONFIG_NVME_MULTIPATH and add a new nvme_ns_head_multipath that uses it to check if a ns_head has a multipath devic
nvme: add a nvme_ns_head_multipath helper
Move the multipath gendisk out of #ifdef CONFIG_NVME_MULTIPATH and add a new nvme_ns_head_multipath that uses it to check if a ns_head has a multipath device associated with it.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> [hch: added the IS_ENABLED, converted a few existing users] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Javier González <javier.gonz@samsung.com> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
show more ...
|
#
5befc7c2 |
| 24-Mar-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: implement non-mdts command limits
Commands that access LBA contents without a data transfer between the host historically have not had a spec defined upper limit. The driver set the queue cons
nvme: implement non-mdts command limits
Commands that access LBA contents without a data transfer between the host historically have not had a spec defined upper limit. The driver set the queue constraints for such commands to the max data transfer size just to be safe, but this artificial constraint frequently limits devices below their capabilities.
The NVMe Workgroup ratified TP4040 defines how a controller may advertise their non-MDTS limits. Use these if provided and default to the current constraints if not. Since the Dataset Management command limits are defined in logical blocks, but without a namespace to tell us the logical block size, the code defaults to the safe 512b size.
Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|
#
f4b9e6c9 |
| 17-Mar-2021 |
Keith Busch <kbusch@kernel.org> |
nvme: use driver pdu command for passthrough
All nvme transport drivers preallocate an nvme command for each request. Assume to use that command for nvme_setup_cmd() instead of requiring drivers pas
nvme: use driver pdu command for passthrough
All nvme transport drivers preallocate an nvme command for each request. Assume to use that command for nvme_setup_cmd() instead of requiring drivers pass a pointer to it. All nvme drivers must initialize the generic nvme_request 'cmd' to point to the transport's preallocated nvme_command.
The generic nvme_request cmd pointer had previously been used only as a temporary copy for passthrough commands. Since it now points to the command that gets dispatched, passthrough commands must directly set it up prior to executing the request.
Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
show more ...
|