From nobody Wed Feb 01 21:08:36 2023 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 4P6ZK05YsWz3c29t; Wed, 1 Feb 2023 21:08:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6ZK056Ycz44SM; Wed, 1 Feb 2023 21:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675285716; 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=eeDmd5GvwI0aqzibl8xCS5oHNWwScEQJNSaY85YiL00=; b=hOumVagkBrKqwf03cvup6lxbMMcpfpJp5T8BWnJflbZ4wddHee3TZCGGh1M/na9IoOwo+o eMnjQ0MgufkZGvgXbb3RZgA1FUp1Vy+elvW4k0JJzRXpBSdiE9defLuVMVF+vJjvzki7q+ 8eERNA4lINwl0pjaIN+C4p8O0cIClPhn9LIGy4OBY0CRm/bpEbqorI+mmaQOdmsSgV1L7T pIGPurjsCQr9r9ISxUy8mZLHccXxMImJFGxCYXipEy0qgHyIiklMPCL2WvI9jQ+36kNfyP eap8nY09nnn2sQAckIUwqsqWINnC0FRwzC54sdIFSJUwStOPOV4x5nHlv8OV9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675285716; 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=eeDmd5GvwI0aqzibl8xCS5oHNWwScEQJNSaY85YiL00=; b=QVNJsAmNCSuNXIdzcOMRLpYi9/wAc1UrEyoylDMcIllOQvn13Ls75Ylw+8HbWjFX/KCTnI LDWEtUo8qv/UltQLPLAANoPtkSpOHEnNGygeirT5K/XvB8XbKaJPeNS8xQ/72Mr9GvSKJQ G3Sug9U24PC84Gp+QQbceZYP4qUDW2JsQ89bMyN8MIXkzttl+KqVZtcx8xdtl+GhRLpxU9 WsaN4W1qi68QWZ38k68jVAZ57KIUgeSNuVJ5XFvgbVJzvpuBQ+MQMl2HtDTSco63tgArhX FqJnogQ2TweevhqJbSQqzenPigckUUTyttKQS5n7cZmDwxfCwgmtrkJft3V2Ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675285716; a=rsa-sha256; cv=none; b=CK/Y6GbphkL06yCPAE/V6VBs7jF1auJUDQQbnXaH0SYT+gFxYDuor/s1WKD9+DrSCjkeZ1 xsNV2pi9zG1G9Um7yi7pzO3IqD3OqtemRPPJDPXFT2WbGDJ79RUwKWfF406ox8BwVmApQb QExILhlTlYNP6XZn3e+54LAYJ1R94jrJL+dInyG495a6NHX6penVjkLtvY1w6HvTM2BiH+ XSN4Nld6RqDeFpzXcB4tJ129K2mDg3Hu1/eT47QBRuwe9B6EhOBJgdBaTdkN2K543bHZMc Zr57htuxqRB6Fkc4uCtJxuxBdEbMUD+W7r5IBkNVudXeaPhFn5Z14wiCJmkGCQ== 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 4P6ZK049yWzSvT; Wed, 1 Feb 2023 21:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311L8a6w058821; Wed, 1 Feb 2023 21:08:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311L8asf058820; Wed, 1 Feb 2023 21:08:36 GMT (envelope-from git) Date: Wed, 1 Feb 2023 21:08:36 GMT Message-Id: <202302012108.311L8asf058820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: a0102dee34bc - main - sockets: in sousrsend() pass down the error to aio(4) 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0102dee34bce26b4a178bcc35bd153c3361fd97 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a0102dee34bce26b4a178bcc35bd153c3361fd97 commit a0102dee34bce26b4a178bcc35bd153c3361fd97 Author: Gleb Smirnoff AuthorDate: 2023-02-01 21:03:10 +0000 Commit: Gleb Smirnoff CommitDate: 2023-02-01 21:03:10 +0000 sockets: in sousrsend() pass down the error to aio(4) This somewhat undermines the initial goal of sousrsend() to have all the special error handling for a write on a socket in a single place. The aio(4) needs to see EWOULDBLOCK to re-schedule the job. Because aio(4) handles return from soreceive() and sousrsend() with the same code, we can't check for (error == 0 && done < job_nbytes). Keeping this exclusion for aio(4) seems a lesser evil. Fixes: 7a2c93b86ef75390a60a4b4d6e3911b36221dfbe --- sys/kern/uipc_socket.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index b7e43d496d1d..9b7f63a81617 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1861,8 +1861,15 @@ sousrsend(struct socket *so, struct sockaddr *addr, struct uio *uio, td); CURVNET_RESTORE(); if (error != 0) { + /* + * Clear transient errors for stream protocols if they made + * some progress. Make exclusion for aio(4) that would + * schedule a new write in case of EWOULDBLOCK and clear + * error itself. See soaio_process_job(). + */ if (uio->uio_resid != len && (so->so_proto->pr_flags & PR_ATOMIC) == 0 && + userproc == NULL && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0;