<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/nvme/host/multipath.c, branch v5.16</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.16</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.16'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-12-07T17:19:28+00:00</updated>
<entry>
<title>nvme-multipath: set ana_log_size to 0 after free ana_log_buf</title>
<updated>2021-12-07T17:19:28+00:00</updated>
<author>
<name>Hou Tao</name>
<email>houtao1@huawei.com</email>
</author>
<published>2021-12-03T11:47:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7c15ae3dc50c0ab46c5cbbf8d2f3d3307e51f37'/>
<id>urn:sha1:c7c15ae3dc50c0ab46c5cbbf8d2f3d3307e51f37</id>
<content type='text'>
Set ana_log_size to 0 when ana_log_buf is freed to make sure
nvme_mpath_init_identify will do the right thing when retrying
after an earlier failure.

Signed-off-by: Hou Tao &lt;houtao1@huawei.com&gt;
Reviewed-by: Keith Busch &lt;kbusch@kernel.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvmet: use flex_array_size and struct_size</title>
<updated>2021-10-27T06:06:41+00:00</updated>
<author>
<name>Len Baker</name>
<email>len.baker@gmx.com</email>
</author>
<published>2021-10-24T17:29:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d156cfcafbd0eae4224ea007d95ebda467eb0c46'/>
<id>urn:sha1:d156cfcafbd0eae4224ea007d95ebda467eb0c46</id>
<content type='text'>
In an effort to avoid open-coded arithmetic in the kernel [1], use the
flex_array_size() and struct_size() helpers instead of an open-coded
calculation.

[1] https://github.com/KSPP/linux/issues/160

Signed-off-by: Len Baker &lt;len.baker@gmx.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Reviewed-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Reviewed-by: Chaitanya Kulkarni &lt;kch@nvidia.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvme: drop scan_lock and always kick requeue list when removing namespaces</title>
<updated>2021-10-20T17:23:30+00:00</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2021-10-20T05:59:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2b81a5f015199f3d585ce710190a9e87714d3c1e'/>
<id>urn:sha1:2b81a5f015199f3d585ce710190a9e87714d3c1e</id>
<content type='text'>
When reading the partition table on initial scan hits an I/O error the
I/O will hang with the scan_mutex held:

[&lt;0&gt;] do_read_cache_page+0x49b/0x790
[&lt;0&gt;] read_part_sector+0x39/0xe0
[&lt;0&gt;] read_lba+0xf9/0x1d0
[&lt;0&gt;] efi_partition+0xf1/0x7f0
[&lt;0&gt;] bdev_disk_changed+0x1ee/0x550
[&lt;0&gt;] blkdev_get_whole+0x81/0x90
[&lt;0&gt;] blkdev_get_by_dev+0x128/0x2e0
[&lt;0&gt;] device_add_disk+0x377/0x3c0
[&lt;0&gt;] nvme_mpath_set_live+0x130/0x1b0 [nvme_core]
[&lt;0&gt;] nvme_mpath_add_disk+0x150/0x160 [nvme_core]
[&lt;0&gt;] nvme_alloc_ns+0x417/0x950 [nvme_core]
[&lt;0&gt;] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core]
[&lt;0&gt;] nvme_scan_work+0x168/0x310 [nvme_core]
[&lt;0&gt;] process_one_work+0x231/0x420

and trying to delete the controller will deadlock as it tries to grab
the scan mutex:

[&lt;0&gt;] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core]
[&lt;0&gt;] nvme_remove_namespaces+0x31/0xf0 [nvme_core]
[&lt;0&gt;] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]

As we're now properly ordering the namespace list there is no need to
hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore.
And we always need to kick the requeue list as the path will be marked
as unusable and I/O will be requeued _without_ a current path.

Signed-off-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Keith Busch &lt;kbusch@kernel.org&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvme-multipath: add error handling support for add_disk()</title>
<updated>2021-10-20T17:16:03+00:00</updated>
<author>
<name>Luis Chamberlain</name>
<email>mcgrof@kernel.org</email>
</author>
<published>2021-10-15T23:52:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=11384580e3322b41dbaa68dbcd949af875b8aa22'/>
<id>urn:sha1:11384580e3322b41dbaa68dbcd949af875b8aa22</id>
<content type='text'>
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.

Since we now can tell for sure when a disk was added, move
setting the bit NVME_NSHEAD_DISK_LIVE only when we did
add the disk successfully.

Nothing to do here as the cleanup is done elsewhere. We take
care and use test_and_set_bit() because it is protects against
two nvme paths simultaneously calling device_add_disk() on the
same namespace head.

Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Reviewed-by: Keith Busch &lt;kbusch@kernel.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvme: generate uevent once a multipath namespace is operational again</title>
<updated>2021-10-20T17:16:00+00:00</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2021-10-06T09:13:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f6f09c15a767fad1206068bc09ec62d3cf273460'/>
<id>urn:sha1:f6f09c15a767fad1206068bc09ec62d3cf273460</id>
<content type='text'>
When fast_io_fail_tmo is set I/O will be aborted while recovery is
still ongoing. This causes MD to set the namespace to failed, and
no futher I/O will be submitted to that namespace.

However, once the recovery succeeds and the namespace becomes
operational again the NVMe subsystem doesn't send a notification,
so MD cannot automatically reinstate operation and requires
manual interaction.

This patch will send a KOBJ_CHANGE uevent per multipathed namespace
once the underlying controller transitions to LIVE, allowing an automatic
MD reassembly with these udev rules:

/etc/udev/rules.d/65-md-auto-re-add.rules:
SUBSYSTEM!="block", GOTO="md_end"

ACTION!="change", GOTO="md_end"
ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
PROGRAM="/sbin/md_raid_auto_readd.sh $devnode"
LABEL="md_end"

/sbin/md_raid_auto_readd.sh:

MDADM=/sbin/mdadm
DEVNAME=$1

export $(${MDADM} --examine --export ${DEVNAME})

if [ -z "${MD_UUID}" ]; then
    exit 1
fi

UUID_LINK=$(readlink /dev/disk/by-id/md-uuid-${MD_UUID})
MD_DEVNAME=${UUID_LINK##*/}
export $(${MDADM} --detail --export /dev/${MD_DEVNAME})
if [ -z "${MD_METADATA}" ] ; then
    exit 1
fi
if [ $(cat /sys/block/${MD_DEVNAME}/md/degraded) != 1 ]; then
    echo "${MD_DEVNAME}: array not degraded, nothing to do"
    exit 0
fi
MD_STATE=$(cat /sys/block/${MD_DEVNAME}/md/array_state)
if [ ${MD_STATE} != "clean" ] ; then
    echo "${MD_DEVNAME}: array state ${MD_STATE}, cannot re-add"
    exit 1
fi
MD_VARNAME="MD_DEVICE_dev_${DEVNAME##*/}_ROLE"
if [ ${!MD_VARNAME} = "spare" ] ; then
    ${MDADM} --manage /dev/${MD_DEVNAME} --re-add ${DEVNAME}
fi

Changes to v2:
- Add udev rules example to description
Changes to v1:
- use disk_uevent() as suggested by hch

Signed-off-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvme-multipath: enable polled I/O</title>
<updated>2021-10-18T12:17:36+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-10-12T11:12:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c712dccc64357b94f93e57882373e1365f0e2a56'/>
<id>urn:sha1:c712dccc64357b94f93e57882373e1365f0e2a56</id>
<content type='text'>
Set the poll queue flag to enable polling, given that the multipath
node just dispatches the bios to a lower queue.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Mark Wunderlich &lt;mark.wunderlich@intel.com&gt;
Link: https://lore.kernel.org/r/20211012111226.760968-17-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: switch polling to be bio based</title>
<updated>2021-10-18T12:17:36+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-10-12T11:12:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3e08773c3841e9db7a520908cc2b136a77d275ff'/>
<id>urn:sha1:3e08773c3841e9db7a520908cc2b136a77d275ff</id>
<content type='text'>
Replace the blk_poll interface that requires the caller to keep a queue
and cookie from the submissions with polling based on the bio.

Polling for the bio itself leads to a few advantages:

 - the cookie construction can made entirely private in blk-mq.c
 - the caller does not need to remember the request_queue and cookie
   separately and thus sidesteps their lifetime issues
 - keeping the device and the cookie inside the bio allows to trivially
   support polling BIOs remapping by stacking drivers
 - a lot of code to propagate the cookie back up the submission path can
   be removed entirely.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Mark Wunderlich &lt;mark.wunderlich@intel.com&gt;
Link: https://lore.kernel.org/r/20211012111226.760968-15-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>nvme: fix per-namespace chardev deletion</title>
<updated>2021-10-14T06:07:47+00:00</updated>
<author>
<name>Adam Manzanares</name>
<email>a.manzanares@samsung.com</email>
</author>
<published>2021-10-13T15:04:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=be5eb933542629ad6a7d4c92097b1b472b1612d0'/>
<id>urn:sha1:be5eb933542629ad6a7d4c92097b1b472b1612d0</id>
<content type='text'>
Decrease reference count of chardevice during char device deletion in
order to fix a memory leak.  Add a release callabck for the device
associated chardev and move ida_simple_remove into the release function.

Fixes: 2637baed7801 ("nvme: introduce generic per-namespace chardev")
Reported-by: Yi Zhang &lt;yi.zhang@redhat.com&gt;
Suggested-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Signed-off-by: Adam Manzanares &lt;a.manzanares@samsung.com&gt;
Reviewed-by: Javier GonzÃ¡lez &lt;javier@javigon.com&gt;
Tested-by: Yi Zhang &lt;yi.zhang@redhat.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nvme-multipath: fix ANA state updates when a namespace is not present</title>
<updated>2021-09-14T08:32:04+00:00</updated>
<author>
<name>Anton Eidelman</name>
<email>anton.eidelman@gmail.com</email>
</author>
<published>2021-09-12T18:54:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=79f528afa93918519574773ea49a444c104bc1bd'/>
<id>urn:sha1:79f528afa93918519574773ea49a444c104bc1bd</id>
<content type='text'>
nvme_update_ana_state() has a deficiency that results in a failure to
properly update the ana state for a namespace in the following case:

  NSIDs in ctrl-&gt;namespaces:	1, 3,    4
  NSIDs in desc-&gt;nsids:		1, 2, 3, 4

Loop iteration 0:
    ns index = 0, n = 0, ns-&gt;head-&gt;ns_id = 1, nsid = 1, MATCH.
Loop iteration 1:
    ns index = 1, n = 1, ns-&gt;head-&gt;ns_id = 3, nsid = 2, NO MATCH.
Loop iteration 2:
    ns index = 2, n = 2, ns-&gt;head-&gt;ns_id = 4, nsid = 4, MATCH.

Where the update to the ANA state of NSID 3 is missed.  To fix this
increment n and retry the update with the same ns when ns-&gt;head-&gt;ns_id is
higher than nsid,

Signed-off-by: Anton Eidelman &lt;anton@lightbitslabs.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Sagi Grimberg &lt;sagi@grimberg.me&gt;
</content>
</entry>
<entry>
<title>nvme-multipath: revalidate paths during rescan</title>
<updated>2021-09-06T07:59:02+00:00</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2021-08-24T14:57:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e7d65803e2bb5bc739548b67a5fc72c626cf7e3b'/>
<id>urn:sha1:e7d65803e2bb5bc739548b67a5fc72c626cf7e3b</id>
<content type='text'>
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 &lt;hare@suse.de&gt;
[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 &lt;dwagner@suse.de&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
</feed>
