Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3529814pxf; Mon, 15 Mar 2021 11:35:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz88JtinZ/4bkaRH+UjZNN858MDl1y35/Sb/JjD8ses6z81eqnoLZNv/IZYFvCY11t2oXj8 X-Received: by 2002:a05:6402:cb8:: with SMTP id cn24mr31928197edb.105.1615833355119; Mon, 15 Mar 2021 11:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833355; cv=none; d=google.com; s=arc-20160816; b=tnIUtZzf2+Rmb2kN9ZaRlD3WKsn5xsY2g0iQblCzt7Z7l4iXJMbu5hKdPlA+J0Ee0i wcTM420fm1c/hzIlJBeef5N38M3sqtr14M+7wtdMJPLM2mLX6Hjf+IIPPsWDo6OCCWoS hrZqRuh/l8qrGl6mh14/lsb/fNum1p1uJZoeWBCNUiXr13MhLe80KOwEg6HNh3b1WIBW MgORBgljIJ/jCvcNuhMi/LwA0WQCaSaFmTWskm2sx8FKFqpLREXGxDvtsKlheMDPiIrs wn4dOqaQ1m94lMRmzxKGDqxAwfsQb3qrW67w25RjdUvaWYHXwcaiH8qhcuW5zIq3WwVw ttwg== 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=MuSn6D3hfBNUyoyvSKHpWQTBWEFgWY4m8l8J4jbWiB0=; b=RaPK0eo+qktY+D+pliqhUg558kPAR18PEqXGfr1tnsWmfB/O6EQFm0ndMxTtNTmATa xBw8Kj3i0pWmWthIYMYJpplLBtuucqwLR5tcgZshBEpCNrIq8pCUkSQGx7Dn/yJeg3g5 JD32DZcC1am4GD7B3N0o17iS4OKuBxIcyrsA0FH7/p2zXWPIkVOLLedUUz5CdqEz+Zz0 OY2kBJW2jT9hQYUYYC0IJSDKcoqW+Ym7FhMozqOFuXLB7qTImtp5lgCJBthgYHRb2N2O qrL+cSfRCHj7+fS0IpwMVSNj38O0tpLS7h2z8KpeDWOm6d9UOuZRDnvrqOrLazi5ww88 zqWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SrdpR2BA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si11973941ejy.223.2021.03.15.11.35.32; Mon, 15 Mar 2021 11:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SrdpR2BA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241009AbhCOOsU (ORCPT + 99 others); Mon, 15 Mar 2021 10:48:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234450AbhCOODX (ORCPT ); Mon, 15 Mar 2021 10:03:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE72064EED; Mon, 15 Mar 2021 14:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817002; bh=hRi6m1Bb5VR/buKeMZd3yV/trt2XhIAgjIg+RXM4Ky8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SrdpR2BAq8JzHHrzdPAYoU8T3esuLFXny+xa5XsyJ5A3ZWe9pem1wiVsSa4crZxYr vlM5zEPMwn6e0kPPjtcNcFY7UkTtsu2xNZTMA83zM9Oe2WxqFbhLftSUj3136nCtqg tRlW/6hM7N1d3BhiwYlwHjvH/irCtGzt3JfEV7uI= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , Sasha Levin Subject: [PATCH 5.11 254/306] io_uring: perform IOPOLL reaping if canceler is thread itself Date: Mon, 15 Mar 2021 14:55:17 +0100 Message-Id: <20210315135516.228552704@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Jens Axboe [ Upstream commit d052d1d685f5125249ab4ff887562c88ba959638 ] We bypass IOPOLL completion polling (and reaping) for the SQPOLL thread, but if it's the thread itself invoking cancelations, then we still need to perform it or no one will. Fixes: 9936c7c2bc76 ("io_uring: deduplicate core cancellations sequence") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 241313278e5a..00ef0b90d149 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8891,7 +8891,8 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, } /* SQPOLL thread does its own polling */ - if (!(ctx->flags & IORING_SETUP_SQPOLL) && !files) { + if ((!(ctx->flags & IORING_SETUP_SQPOLL) && !files) || + (ctx->sq_data && ctx->sq_data->thread == current)) { while (!list_empty_careful(&ctx->iopoll_list)) { io_iopoll_try_reap_events(ctx); ret = true; -- 2.30.1