Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp875262rwi; Wed, 19 Oct 2022 04:11:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X+rcYHeFNGI1UL0ii/qhryuE7BKSkWkjQ2GCb6FxD7Ac16nx0wRSJqvMZlQxeCMlaFP4s X-Received: by 2002:a17:902:ef95:b0:17c:256a:d52c with SMTP id iz21-20020a170902ef9500b0017c256ad52cmr7948252plb.94.1666177873082; Wed, 19 Oct 2022 04:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177873; cv=none; d=google.com; s=arc-20160816; b=WPsGx1V4i0t5MHsa2ywaSPSa8flGPL/GPNp99QL4ZmuzQH8fRXMwtWJa44XRCkWibm adv3+BykZ7663MaF7TZrKHNN+ihAhScarVPg7RfxJB6/td1Kptww85YkWBAGkVLAIk1B LYyeGQreAJQYL8ge7cnbqL9vdWJ0/Bp17v1j3LY1GiIQ8EHrXz24ESIwoD0MV4WsaHY6 DbGg8yTu0la1HwEJyfJHkyAIIINvzm8fwA/bDkPAOvHH4cC8hrKTXhArMSVkD3EJm/f/ 4bYNG6oDufl+8Po7cxlx2+mrfD91PI+d9jNLagwMVqD2age/f9tGygab5hccK/KcAO6F dMBg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q7nA9IVWl361R5KiY1R0XaqbDId0OUi6Dnq5RGVAyws=; b=cmPEtmoEEKryZloBSXTXLyMc18PgQqUUxDNbBwXemXNwv4jEo2A8W8KA1ineoFeCU4 SMz3RsJ3+gv4/Fggo9uFaFYfNH2JIq+ySo/v7bqdrOa3+E4umE7kGQi2vqYKMFYPMALw Nuaj+Bs6OI3dFMOQwrOP2+3a/7xXimQ+aWJoHgz89ioawv5h8wwIptXo1AH+B3Z/zIYv Pnm/Fl94VZ1CqhBHboqB2RdduhzZLvgEFbQKVlirh1JNh/xALR/p/m0CiBd3BIuJWu7F HreO2AC8Acn2o0nJM6aM82fW8qViJmwC5wl4cHFTdGJKdZ4Mgy3+7tkv6aMuYDSrSfsV gPqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LsqaxDul; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020aa7980f000000b00562e898af18si18103249pfl.119.2022.10.19.04.11.00; Wed, 19 Oct 2022 04:11:13 -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=@linuxfoundation.org header.s=korg header.b=LsqaxDul; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbiJSJqG (ORCPT + 99 others); Wed, 19 Oct 2022 05:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235165AbiJSJmX (ORCPT ); Wed, 19 Oct 2022 05:42:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9DC13D50; Wed, 19 Oct 2022 02:19:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16B6B61826; Wed, 19 Oct 2022 09:15:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBA7C433C1; Wed, 19 Oct 2022 09:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170951; bh=furww8hO+9bHJEvRn56IiQow58Lk26dZ+/cLHdxJFq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsqaxDulwYNQKiHFlDg78rv9Td3L8OqOVhkDNIkOD9iN6F7hdNFfQwpb/kVeu9oIY rHyGWBeJIjPZn8z9nOUwFde1/PkYOEFt2ivOoL2mMgumpEVYeR4rA0Se7an7RMWK/6 WEtPyMpt8k/Nza+V0uQeEe3fjV2bbIS9nMHvmb0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 847/862] io_uring/net: fix notif cqe reordering Date: Wed, 19 Oct 2022 10:35:34 +0200 Message-Id: <20221019083327.298431964@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Pavel Begunkov [ upstream commit 108893ddcc4d3aa0a4a02aeb02d478e997001227 ] send zc is not restricted to !IO_URING_F_UNLOCKED anymore and so we can't use task-tw ordering trick to order notification cqes with requests completions. In this case leave it alone and let io_send_zc_cleanup() flush it. Cc: stable@vger.kernel.org Fixes: 53bdc88aac9a2 ("io_uring/notif: order notif vs send CQEs") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/0031f3a00d492e814a4a0935a2029a46d9c9ba06.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1073,8 +1073,14 @@ int io_send_zc(struct io_kiocb *req, uns else if (zc->done_io) ret = zc->done_io; - io_notif_flush(zc->notif); - req->flags &= ~REQ_F_NEED_CLEANUP; + /* + * If we're in io-wq we can't rely on tw ordering guarantees, defer + * flushing notif to io_send_zc_cleanup() + */ + if (!(issue_flags & IO_URING_F_UNLOCKED)) { + io_notif_flush(zc->notif); + req->flags &= ~REQ_F_NEED_CLEANUP; + } io_req_set_res(req, ret, IORING_CQE_F_MORE); return IOU_OK; }