Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp375201iog; Thu, 30 Jun 2022 02:34:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u7CAwfq51zgajVnPGIqiCgOao07AmVWehztIm99w5GZVmBvrReEDeOqwSy6B1uEbt1B2OA X-Received: by 2002:a17:903:1108:b0:16a:a0ab:8f89 with SMTP id n8-20020a170903110800b0016aa0ab8f89mr14854559plh.12.1656581662196; Thu, 30 Jun 2022 02:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656581662; cv=none; d=google.com; s=arc-20160816; b=p+1WdKvjwPA9pYVJPlKnzXtRYw5WGo0RjpFUBGXs8aWSLJFEdhXT2Ze+bZ3rPf8PTe unl3gl7jNNAwSB2zppViNgY82SUA3g2oTLwgGdmW0RzUoFaHQUUOkpKdAYxIxEIOpak9 qD9IsnxfRcu77I/K9DmE6gp1A9kjvHEbKmBGK3y6qkrNH4zBStKl774eYm31PT2Cp+O4 1WwCGlwAI6EGQ+gaEbqNeFLuYkhvXhJlMUcwjLtCdfr0DdMRoAmmfH+q1DUKvEyFLVCZ plInjrI6hivEHCdrnYRYGb4yVHuqsCFZ2A/8onTO4JpFQselYd/qCVcNhus+0waWbzoB GnXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+0Viti/Lgm2xoCVdQjJwJa+NK6eCEzeJyRPNqdMmNDg=; b=TiFnuKU3WhStWIVkss44cLv7DyZvC1H2PZ4IpWsiFzBGNqm6876nnT11wo1enUnmcH JZl8GwRhYZRAOFWX2SEr7kIZuKmc1ot79HRqZTBMIBdZiNgTCkRvzeVlNDrJJJp2pEYD ZkqhXIko4NVZnRkLxt2pu+dZWvrGuBsa9WFq8snpNxQA1syZuMXaxOqR4kUi50nn6Q8C 2TaiXTHGJoQOn06AZQGvf88ASNeiJy+IXQC18Y2ZOTOu3kbqXRFdNEbDqqPL/QiTxdfY WvUZiT9DjsIA6STa99dn+luq6b1wE7rRRlCK+wbCzVku2tcBcllRNO/J+nD7s01rjf5/ vGGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=prhhmv0L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f2-20020a170902ce8200b00161e9f72b11si27374401plg.540.2022.06.30.02.33.47; Thu, 30 Jun 2022 02:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=prhhmv0L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234186AbiF3JTF (ORCPT + 99 others); Thu, 30 Jun 2022 05:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233919AbiF3JSV (ORCPT ); Thu, 30 Jun 2022 05:18:21 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C74630555 for ; Thu, 30 Jun 2022 02:17:11 -0700 (PDT) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25U0Ledk012196 for ; Thu, 30 Jun 2022 02:17:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=+0Viti/Lgm2xoCVdQjJwJa+NK6eCEzeJyRPNqdMmNDg=; b=prhhmv0LOnWucJSZKOQerVGhZ1ZPW2qyHpwy747Hsc0ZdAP7hseNp431MuM85svtCU5A dlb6mkh7YQd1Xrwpm8Xq7JOAKL0fcR/LEHTFIjN3ZzQareYh1ya8s5mDJeNCMgd0U0cz /AQdBadAGxzMUDfS8vevE3Gc53+ok/i0b9U= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h0rk5wwys-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 30 Jun 2022 02:17:10 -0700 Received: from snc-exhub201.TheFacebook.com (2620:10d:c085:21d::7) by snc-exhub103.TheFacebook.com (2620:10d:c085:11d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 30 Jun 2022 02:17:10 -0700 Received: from twshared5640.09.ash9.facebook.com (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c085:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 30 Jun 2022 02:17:09 -0700 Received: by devbig038.lla2.facebook.com (Postfix, from userid 572232) id C6CC12599FDF; Thu, 30 Jun 2022 02:14:08 -0700 (PDT) From: Dylan Yudaken To: Jens Axboe , Pavel Begunkov , CC: , , Dylan Yudaken Subject: [PATCH v2 for-next 09/12] io_uring: fix multishot accept ordering Date: Thu, 30 Jun 2022 02:12:28 -0700 Message-ID: <20220630091231.1456789-10-dylany@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220630091231.1456789-1-dylany@fb.com> References: <20220630091231.1456789-1-dylany@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: 2jGPus_Zsxf9uQl36cFUUdGWthlmFVrJ X-Proofpoint-GUID: 2jGPus_Zsxf9uQl36cFUUdGWthlmFVrJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-30_05,2022-06-28_01,2022-06-22_01 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to multishot poll, drop multishot accept when CQE overflow occurs= . Signed-off-by: Dylan Yudaken --- io_uring/net.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/io_uring/net.c b/io_uring/net.c index c3600814b308..75761f48c959 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -656,11 +656,14 @@ int io_accept(struct io_kiocb *req, unsigned int is= sue_flags) return IOU_OK; } =20 - if (ret < 0) - return ret; - if (io_post_aux_cqe(ctx, req->cqe.user_data, ret, IORING_CQE_F_MORE, tr= ue)) + if (ret >=3D 0 && + io_post_aux_cqe(ctx, req->cqe.user_data, ret, IORING_CQE_F_MORE, fa= lse)) goto retry; - return -ECANCELED; + + io_req_set_res(req, ret, 0); + if (req->flags & REQ_F_POLLED) + return IOU_STOP_MULTISHOT; + return IOU_OK; } =20 int io_socket_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) --=20 2.30.2