stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Sagi Grimberg <sagi@grimberg.me>, Christoph Hellwig <hch@lst.de>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 054/102] nvme: centralize setting the timeout in nvme_alloc_request
Date: Mon, 27 Jun 2022 13:21:05 +0200	[thread overview]
Message-ID: <20220627111935.074765866@linuxfoundation.org> (raw)
In-Reply-To: <20220627111933.455024953@linuxfoundation.org>

From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

[ Upstream commit 0d2e7c840b178bf9a47bd0de89d8f9182fa71d86 ]

The function nvme_alloc_request() is called from different context
(I/O and Admin queue) where callers do not consider the I/O timeout when
called from I/O queue context.

Update nvme_alloc_request() to set the default I/O and Admin timeout
value based on whether the queuedata is set or not.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/core.c     | 11 +++++++++--
 drivers/nvme/host/lightnvm.c |  3 ++-
 drivers/nvme/host/pci.c      |  2 --
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0aa68da51ed7..4a7154cbca50 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -553,6 +553,11 @@ struct request *nvme_alloc_request(struct request_queue *q,
 	if (IS_ERR(req))
 		return req;
 
+	if (req->q->queuedata)
+		req->timeout = NVME_IO_TIMEOUT;
+	else /* no queuedata implies admin queue */
+		req->timeout = ADMIN_TIMEOUT;
+
 	req->cmd_flags |= REQ_FAILFAST_DRIVER;
 	nvme_clear_nvme_request(req);
 	nvme_req(req)->cmd = cmd;
@@ -927,7 +932,8 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
+	if (timeout)
+		req->timeout = timeout;
 
 	if (buffer && bufflen) {
 		ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);
@@ -1097,7 +1103,8 @@ static int nvme_submit_user_cmd(struct request_queue *q,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
+	if (timeout)
+		req->timeout = timeout;
 	nvme_req(req)->flags |= NVME_REQ_USERCMD;
 
 	if (ubuffer && bufflen) {
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 8e562d0f2c30..88a7c8eac455 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -774,7 +774,8 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
 		goto err_cmd;
 	}
 
-	rq->timeout = timeout ? timeout : ADMIN_TIMEOUT;
+	if (timeout)
+		rq->timeout = timeout;
 
 	if (ppa_buf && ppa_len) {
 		ppa_list = dma_pool_alloc(dev->dma_pool, GFP_KERNEL, &ppa_dma);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 7de24a10dd92..f2d0148d4050 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1356,7 +1356,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 		return BLK_EH_RESET_TIMER;
 	}
 
-	abort_req->timeout = ADMIN_TIMEOUT;
 	abort_req->end_io_data = NULL;
 	blk_execute_rq_nowait(abort_req->q, NULL, abort_req, 0, abort_endio);
 
@@ -2283,7 +2282,6 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	req->timeout = ADMIN_TIMEOUT;
 	req->end_io_data = nvmeq;
 
 	init_completion(&nvmeq->delete_done);
-- 
2.35.1




  parent reply	other threads:[~2022-06-27 11:26 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 11:20 [PATCH 5.10 000/102] 5.10.127-rc1 review Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 001/102] vt: drop old FONT ioctls Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 002/102] random: schedule mix_interrupt_randomness() less often Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 003/102] random: quiet urandom warning ratelimit suppression message Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 004/102] ALSA: hda/via: Fix missing beep setup Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 005/102] ALSA: hda/conexant: " Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 006/102] ALSA: hda/realtek: Add mute LED quirk for HP Omen laptop Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 007/102] ALSA: hda/realtek - ALC897 headset MIC no sound Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 008/102] ALSA: hda/realtek: Apply fixup for Lenovo Yoga Duet 7 properly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 009/102] ALSA: hda/realtek: Add quirk for Clevo PD70PNT Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 010/102] ALSA: hda/realtek: Add quirk for Clevo NS50PU Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 011/102] net: openvswitch: fix parsing of nw_proto for IPv6 fragments Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 012/102] btrfs: add error messages to all unrecognized mount options Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 013/102] mmc: sdhci-pci-o2micro: Fix card detect by dealing with debouncing Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 014/102] mtd: rawnand: gpmi: Fix setting busy timeout setting Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 015/102] ata: libata: add qc->flags in ata_qc_complete_template tracepoint Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 016/102] dm era: commit metadata in postsuspend after worker stops Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 017/102] dm mirror log: clear log bits up to BITS_PER_LONG boundary Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 018/102] USB: serial: option: add Telit LE910Cx 0x1250 composition Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 019/102] USB: serial: option: add Quectel EM05-G modem Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 020/102] USB: serial: option: add Quectel RM500K module support Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 021/102] drm/msm: Fix double pm_runtime_disable() call Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 022/102] netfilter: nftables: add nft_parse_register_load() and use it Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 023/102] netfilter: nftables: add nft_parse_register_store() " Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 024/102] netfilter: use get_random_u32 instead of prandom Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 025/102] scsi: scsi_debug: Fix zone transition to full condition Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 026/102] drm/msm: use for_each_sgtable_sg to iterate over scatterlist Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 027/102] bpf: Fix request_sock leak in sk lookup helpers Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 028/102] drm/sun4i: Fix crash during suspend after component bind failure Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 029/102] bpf, x86: Fix tail call count offset calculation on bpf2bpf call Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 030/102] phy: aquantia: Fix AN when higher speeds than 1G are not advertised Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 031/102] tipc: simplify the finalize work queue Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 032/102] tipc: fix use-after-free Read in tipc_named_reinit Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 033/102] igb: fix a use-after-free issue in igb_clean_tx_ring Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 034/102] bonding: ARP monitor spams NETDEV_NOTIFY_PEERS notifiers Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 035/102] net/sched: sch_netem: Fix arithmetic in netem_dump() for 32-bit platforms Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 036/102] drm/msm/mdp4: Fix refcount leak in mdp4_modeset_init_intf Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 037/102] drm/msm/dp: check core_initialized before disable interrupts at dp_display_unbind() Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 038/102] drm/msm/dp: fixes wrong connection state caused by failure of link train Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 039/102] drm/msm/dp: deinitialize mainlink if link training failed Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 040/102] drm/msm/dp: promote irq_hpd handle to handle link training correctly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 041/102] drm/msm/dp: fix connect/disconnect handled at irq_hpd Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 042/102] erspan: do not assume transport header is always set Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 043/102] net/tls: fix tls_sk_proto_close executed repeatedly Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 044/102] udmabuf: add back sanity check Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 045/102] selftests: netfilter: correct PKTGEN_SCRIPT_PATHS in nft_concat_range.sh Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 046/102] x86/xen: Remove undefined behavior in setup_features() Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 047/102] MIPS: Remove repetitive increase irq_err_count Greg Kroah-Hartman
2022-06-27 11:20 ` [PATCH 5.10 048/102] afs: Fix dynamic root getattr Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 049/102] ice: ethtool: advertise 1000M speeds properly Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 050/102] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 051/102] igb: Make DMA faster when CPU is active on the PCIe link Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 052/102] virtio_net: fix xdp_rxq_info bug after suspend/resume Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 053/102] Revert "net/tls: fix tls_sk_proto_close executed repeatedly" Greg Kroah-Hartman
2022-06-27 11:21 ` Greg Kroah-Hartman [this message]
2022-06-27 11:21 ` [PATCH 5.10 055/102] nvme: split nvme_alloc_request() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 056/102] nvme: mark nvme_setup_passsthru() inline Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 057/102] nvme: dont check nvme_req flags for new req Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 058/102] nvme-pci: allocate nvme_command within driver pdu Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 059/102] nvme-pci: add NO APST quirk for Kioxia device Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 060/102] nvme: move the Samsung X5 quirk entry to the core quirks Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 061/102] gpio: winbond: Fix error code in winbond_gpio_get() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 062/102] s390/cpumf: Handle events cycles and instructions identical Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 063/102] iio: mma8452: fix probe fail when device tree compatible is used Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 064/102] iio: adc: vf610: fix conversion mode sysfs node name Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 065/102] usb: typec: wcove: Drop wrong dependency to INTEL_SOC_PMIC Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 066/102] xhci: turn off port power in shutdown Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 067/102] xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 068/102] xhci-pci: Allow host runtime PM as default for Intel Meteor " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 069/102] usb: gadget: Fix non-unique driver names in raw-gadget driver Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 070/102] USB: gadget: Fix double-free bug in raw_gadget driver Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 071/102] usb: chipidea: udc: check request status before setting device address Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 072/102] f2fs: attach inline_data after setting compression Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 073/102] iio:chemical:ccs811: rearrange iio trigger get and register Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 074/102] iio:accel:bma180: " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 075/102] iio:accel:mxc4005: " Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 076/102] iio: accel: mma8452: ignore the return value of reset operation Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 077/102] iio: gyro: mpu3050: Fix the error handling in mpu3050_power_up() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 078/102] iio: trigger: sysfs: fix use-after-free on remove Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 079/102] iio: adc: stm32: fix maximum clock rate for stm32mp15x Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 080/102] iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value) Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 081/102] iio: adc: stm32: Fix ADCs iteration in irq handler Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 082/102] iio: adc: stm32: Fix IRQs on STM32F4 by removing custom spurious IRQs message Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 083/102] iio: adc: axp288: Override TS pin bias current for some models Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 084/102] iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 085/102] xtensa: xtfpga: Fix refcount leak bug in setup Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 086/102] xtensa: Fix refcount leak bug in time.c Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 087/102] parisc/stifb: Fix fb_is_primary_device() only available with CONFIG_FB_STI Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 088/102] parisc: Enable ARCH_HAS_STRICT_MODULE_RWX Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 089/102] powerpc: Enable execve syscall exit tracepoint Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 090/102] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 091/102] powerpc/powernv: wire up rng during setup_arch Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 092/102] ARM: dts: imx7: Move hsic_phy power domain to HSIC PHY node Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 093/102] ARM: dts: imx6qdl: correct PU regulator ramp delay Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 094/102] ARM: exynos: Fix refcount leak in exynos_map_pmu Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 095/102] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 096/102] ARM: Fix refcount leak in axxia_boot_secondary Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 097/102] memory: samsung: exynos5422-dmc: Fix refcount leak in of_get_dram_timings Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 098/102] ARM: cns3xxx: Fix refcount leak in cns3xxx_init Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 099/102] modpost: fix section mismatch check for exported init/exit sections Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 100/102] random: update comment from copy_to_user() -> copy_to_iter() Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 101/102] kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS (2nd attempt) Greg Kroah-Hartman
2022-06-27 11:21 ` [PATCH 5.10 102/102] powerpc/pseries: wire up rng during setup_arch() Greg Kroah-Hartman
2022-06-27 14:44 ` [PATCH 5.10 000/102] 5.10.127-rc1 review Jon Hunter
2022-06-27 17:05 ` Florian Fainelli
2022-06-27 18:52 ` Daniel Díaz
2022-06-27 21:56 ` Shuah Khan
2022-06-27 23:41 ` Guenter Roeck
2022-06-28 13:17 ` Sudip Mukherjee
2022-06-29  1:07 ` Samuel Zou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220627111935.074765866@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagi@grimberg.me \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).