From nobody Fri Jul 4 13:28:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGb5K94z6155Q; Fri, 04 Jul 2025 13:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGb0ny6z3MNM; Fri, 04 Jul 2025 13:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gFE1gz2c4P21fePDBmz8SiiORNnj82JZ2+nxA3z0RsA=; b=WHAAiiJz3AW44mNo7juj66v80w3qhusIjUUy9Ly+WSiPhSXzc7oMV5n6YjRfLSoPLJLOGo 2Q9RV0UTQ4jNko47Vb0nlef0eMApDvhwRPS9sDbVBTTnc1BHFLpSTmbcpARCRTiL0PNDSb T7sAwvoILrKriC3Apus94rgiNAv4ze0ZIeH0r8DLgE6wEeeLuBGEdcSR7NaClar5ku8Q+p 8scL5bgncbzgDtHwYmK/5E3QfSEcp4yOeahbLWVpxyeuBxVt28tj9EBbRZ/N7xtWODPsyi tQufvFdbsCWqmXKuDZWdRvw7AhwZjlDpBX4oFLTl1bR2/3NMfmcnzOYHyxtC0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gFE1gz2c4P21fePDBmz8SiiORNnj82JZ2+nxA3z0RsA=; b=hfe5QyOj1fO5k2VE1jvcc/UCYic2pdl9DTHNjJEl9GpHynzOYIzUN1i0n0ATN7FlKdkqWy 4G66NO1Ns5T8CvU65YQx+t0eBbsn+aa8LJU9vb7aK8rNDmh/WoAmt0cPycTiGkvS0B1wO2 4Jw68FYQguNsQ71mErVmgbv4wKM8+SdQWUMP59HMpMj+pP9eymIFmCDEBVD1rsB8PUkDbv zbIKoCy8y3M/s5hRhEv4oPoDMGsOp5DVQ3rackkvRjUvv+VqNoFmAGextfgHPRYnpvP9eU w0ij68fMAWDQ3wZelh01H8OklToYudI2OKyR5f4HaimTUNzbtMRuJm7HAjLxmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635735; a=rsa-sha256; cv=none; b=qNrse6+dcJvkZFpJGbuW+z7ciG/wQwz1M9MH7LOKwKH/TleKZ0Q9b3t5gYhyEE8aSX5g+u H5cDbmGPwFbNq2flxT35h2uFRIeG+OA2bq4HfM9Rc1H4VXMYqNzPoQUSKsTqez81p94b4H alGhKHKfaaVOBAtmh0LHgf9gph8TkuVk1bI3Q3J6h2Wby2JymWUDE5UyonZk29pjJIq5MK EJXk/TpasKjFVswRaZMEjr18TxW+QW03jvNHOJbv+0VxG2pSNNDpQdkmFp2OA88RUWSq7g 6/mbQHJpQ9pp3RA0n/e/8EdyTKKMou7lZLSElP2CoyY8uHmqAuTCWB3S6PjS3A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGb0N8TzsD5; Fri, 04 Jul 2025 13:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSsne006129; Fri, 4 Jul 2025 13:28:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSsH7006126; Fri, 4 Jul 2025 13:28:54 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:54 GMT Message-Id: <202507041328.564DSsH7006126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: f3478cfc7817 - stable/14 - virtio_p9fs: Fix handling of a full request queue List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f3478cfc7817afcd47e8c9caee143fb807220ffc Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f3478cfc7817afcd47e8c9caee143fb807220ffc commit f3478cfc7817afcd47e8c9caee143fb807220ffc Author: Mark Johnston AuthorDate: 2024-10-25 17:51:16 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 virtio_p9fs: Fix handling of a full request queue If, when submitting a request, the virtqueue is full, we sleep until an interrupt has fired, then restart the request. However, while sleeping the channel lock is dropped, and in the meantime another thread may have reset the per-channel SG list, so upon retrying we'd (re)submit whatever happened to be left over in the previous request. Fix the problem by rebuilding the SG list after sleeping. Sponsored by: Klara, Inc. (cherry picked from commit fff518117b40cbc3bca49073eed85dc725ebae4c) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 43d5c0d9d6ba..d359fbbf1a3d 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -152,6 +152,7 @@ vt9p_request(void *handle, struct p9_req_t *req) /* Grab the channel lock*/ VT9P_LOCK(chan); +req_retry: sglist_reset(sg); /* Handle out VirtIO ring buffers */ error = sglist_append(sg, req->tc->sdata, req->tc->size); @@ -170,9 +171,7 @@ vt9p_request(void *handle, struct p9_req_t *req) } writable = sg->sg_nseg - readable; -req_retry: error = virtqueue_enqueue(vq, req, sg, readable, writable); - if (error != 0) { if (error == ENOSPC) { /*