From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.175 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796239358; b=5R0+ErFBfj5RI2C3bo0lQWbsMyYl8Jn56QV2PS4ug2rax0QtihpBJn36q1Kbef1X+CSk FltOlmoU80tZRpSBsb3knIRApuGGwi4jJ2WDMxNhFnEAhJCdZtjSWqWlYRob10anbyCpX +ES70zbNhtukTPqbkEd2w1LGByHkLAP7n/Q0Ekg7t4v/0jukcdn47NZOyIo1a4esRRu1c O3YKX8xo1vcYKPrOMfxvi920UbgceN/tes6camCVeoTZPTFnEg63pGUuF2V0CyRks3jY9 ImpWJycgPDtMpRtLJ0pi/RmCZ4KIU4Jj73sEKNCbf1zZVHdMS3KZNVykIeQQJiEcI3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796239358; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=MispOkKk6alsVJPAtU+W7GmvfL19Z2+kjMJwfjwU46c=; b=ZVMbrQ3YKAZSoA+QRFS2YYacRAI+uM7CJipFZ3Epi8UnhZEwHUFJtPU6KRsn0sCU31bm 3fWfHVKyFfzj/9zUk88mXUcscLvt5MmDHFfsWljOwatpNNpSH1Ak6VBw7ywXmWIJ5Fvzw O4ZM4c0aCVRltsZWP8oEAZ7dSK2K6Do39URw2/MzNZE8gmhgTieSLiW7SwNGA5ttQM59r SktC5OPDJvaHnqOUflZ6yX2upuvkTn2E8bE60bg8HCLM2hiOLIqhnOi7U4+I7/8gxc8s7 ftwfryuRJ8rkLsyanqkKcrzRzdHQAF8de3nM9u5i5uXZwyqJfV6C9nDB3p6l9yEQysw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=stellman-greene.com; spf=none smtp.mailfrom=stellman-greene.com; dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=jUxRHkMF; arc=none smtp.remote-ip=209.85.160.175 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BDE1606A332 for ; Wed, 2 Dec 2026 19:22:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7BDE1606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=jUxRHkMF Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-55ade1de0b4so150059281cf.3 for ; Wed, 02 Dec 2026 11:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stellman-greene-com.20260707.gappssmtp.com; s=20260707; t=1796239357; x=1796844157; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=MispOkKk6alsVJPAtU+W7GmvfL19Z2+kjMJwfjwU46c=; b=jUxRHkMFwDKRV7unRFTs6d0dkfFvm3+Dsenvo8JCW4jXjbEJ7t/GhEa4lYNLGmlY1M UT3yDZnavIHkQC1tfvXfxACP50b/tOwqSsm2zAJKVsmy+CIR25foJcJ+H9+tgTvDxl0y mA5bYliOhrAtjiMfrJbI1ADx6sgzGQckDjp0YLo6TlTRmpJrzJkK6mgcYtFd56Ya8M26 3Itd8XbE3RhqpGhlIKVLryv2Lk6knqa8/zAhqcpNy8g8LDPHTbpfhctg0RzYal5aZ5dP 6LTCTiSE2ZzrpgF8K3iJKZ12goBrU1p/00NX7jjmGJYRG5YXxC6Qg4Ur0+bSJGfehC6V k/7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796239357; x=1796844157; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MispOkKk6alsVJPAtU+W7GmvfL19Z2+kjMJwfjwU46c=; b=zBAoWh0au2FdOVkIWHTZf54v+itaflrhDr8FXTzozhOZWZEFmYTok8oOxqJX2wOKHv Alxuo9WsFOfdFXOWtX68KLdskplI6Bhzw6ozSQw/la0AEFYaAc4Rn+QwbqUgvU1YtmBq uDgFqssipnct42kinJ5PJzcUZ1XoWvYsRgvbWzQU/fS8bwpScdN/je6mmhRv4+ITxMnc GPbYiZChPCyjkKRx4RXaZomZhQ5yqk1fuHea3SeQDGoDM0BT6gjnX0SJCTWy12G0znOf 6xSXmc6gAFLRKiiEkpvXFF5xKQMXcY0LsJ7S/cdfs9jbTdTc6+pEePNwIxgIONaIgoKz ibhw== X-Forwarded-Encrypted: i=1; AL+hErGlUcM/7HI5Gs5Tyt9QGkPGB0am8sxqpSbzwFI+R5H/rUS4dk47DEwTEmdKFHpEOBDta6xDL6slNOvuiXM=@vger.kernel.org X-Gm-Message-State: APuU4Z+X3g/qy7Z8i8ZZuObt87V3vTz6OCk8mR2ddh79W1RCnNeGWqZ6 AcIkBtfA6/qJZnsyGZbwsCX2wzRYssQCOSA0o934Hon1zdhZfR7SaqdAUEnJu72FLxQ= X-Gm-Gg: AZFdTZdm16IHATXrsVrR2OLgi697hjrh95DHlsEOM/Lh1r2bBb/VoRqtBYhaljlsWRG m8RTu+CkgpEGlcMGDX9eFpcxrIXQME56Sf6Ap39215NfdzalOFGw25OA7TvAsHAnnpanezp5gsR sh/aPAe/pygidxZZIWY2okNEKMrwcxbyecIh5hRM6NcLOntFaHqM7TMfWoOz00yj9i/6B8cUMl9 UQJxW+BBnNvon7D85PP22ZTzN2takZP7UEcgQFgTZyACZBn7Ux0jG+xGho3IVQQ2i81uulD2i7N RE0/PbXyVu3mmTp48NqcDqNxTHBY7VJKZB4LllbJr2Xs24RxIEXqngr7l1A5W6//ib5AkWc0ADc Uom6oGBdLeBPAB2Sk+kbiMhDKh/NnWN8TxRqwXShfu2Rox0utCxcFCrexaxGLbDGobehYmPJTVC TWliCqh2Zl/qgXOaHVBHGVY76q1kQZHQzDI7VB4oM20fiFRR9nig8GsyAYM9QjFGpDhTDlW4I0a c26CvMZb3RvYeIMPaOT7Hc35Fjm1f8AvsONAuVaw+s9Q8wVWGpydGT1fuVviDe+dqHIK9yX+L7v mWLsCFsGISRH0SNQjmiQUaPsa1375JPQ4ypdglYp6kf+VIG2r75nxFLE8KNDt0AfcXvy1yHdwcq 4 X-Received: by 2002:a05:622a:4e95:b0:55c:cdb4:9e73 with SMTP id d75a77b69052e-55d76ae8368mr717098631cf.48.1796239357272; Wed, 02 Dec 2026 11:22:37 -0800 (PST) Received: from Mac.mynetworksettings.com ([2600:4041:5c28:200:9fd:9761:5b78:f32c]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-92134a0f5d7sm358780376d6.37.2026.12.02.11.22.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 02 Dec 2026 11:22:37 -0800 (PST) From: Andrew Stellman To: Keith Busch , Christoph Hellwig , Sagi Grimberg Cc: Jens Axboe , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] nvme: requeue keep-alive work when a Keep Alive fails Date: Wed, 2 Dec 2026 14:22:36 -0500 Message-ID: <20261202192236.88068-1-bugs@stellman-greene.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andrew Stellman When a Keep Alive fails, nvme_keep_alive_end_io() returns without queueing ka_work again, so no more Keep Alives get sent and the target's keep-alive timer expires even though the controller is still LIVE. Fix this by requeueing ka_work in LIVE with nvme_queue_keep_alive_work(), so a failed Keep Alive gets retried after the normal delay. Fixes: 038bd4cb6766 ("nvme: add keep-alive support") Signed-off-by: Andrew Stellman --- v2: requeue only in LIVE, with the normal delay, after Sashiko's review of v1. A failed Keep Alive in CONNECTING still stops keep-alive, as it does today. v1: https://lore.kernel.org/r/20261202163728.48705-1-bugs@stellman-greene.com Tested on mainline 19cc08c1a6a6 in arm64 QEMU with KASAN over NVMe/TCP loopback with a test-only nvmet error: before the fix the target's keep-alive timer expired, and with it another Keep Alive arrived first. Found with Quality Playbook (https://github.com/andrewstellman/quality-playbook) running Claude Opus 5.5; the fix was drafted with OpenAI GPT-6 (Codex). A reproducer is available on request. drivers/nvme/host/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f43582e5f6c4..58bae0e85a01 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1387,6 +1387,8 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq, dev_err(ctrl->device, "failed nvme_keep_alive_end_io error=%d\n", status); + if (state == NVME_CTRL_LIVE) + nvme_queue_keep_alive_work(ctrl); return RQ_END_IO_NONE; } -- 2.53.0