Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2402953lqp; Sun, 24 Mar 2024 18:03:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9m3CTVhB4q6+3oYnr76eQIEu2Qx0nmuc/rXdOJj+dtXeJ7QrC4MoqhI6RR0E0oqFagrPy/eJ9q7DDq6ZhfgDkL+ywflH4x0iQv2IiGA== X-Google-Smtp-Source: AGHT+IHPtG5LrZnZ13uFsNXZ+qpp+VwfyFBYME/o4wqPUW5GxqZVQ89mPk0oD7CDC8FQQpdwvVVd X-Received: by 2002:a2e:2e04:0:b0:2d2:ba5a:68d0 with SMTP id u4-20020a2e2e04000000b002d2ba5a68d0mr3922769lju.33.1711328586562; Sun, 24 Mar 2024 18:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328586; cv=pass; d=google.com; s=arc-20160816; b=Q7ZIfTpd1sSYfxux3ngkGGvfClMGeWoJH7b5L8AGa4excgPBBiaquxApV2IdPWmi9m 4RKfyVVWAWliL8zCLUev1vDHEOxnihQq+TQG3HU0Y7ExLzZgQ2sUQNuOV4qXW4KBqHiv 5BJ95zwubwqet4OpkHJGwU6FihFrHhyuPQNzktpXMNZEnB82ja+prWOfTbqsn6l51d62 fxkcoXK7Nc0IwY6aKH5iBLsNe7NJ44eCzPVvFwbWHb3j6VxOYoyyCy4IEfD33y5MrBMN 4wRQX4ByBpGdGzb/PTnw6YsZLtOUm0A0pZl+4ZZ7nXdq1v9NDeUfpDTw0IjJi+XqMC76 FJyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hYEBscFf9Tzg06WAlx6M7Wepk4tdW5qiHEu66dxyPz8=; fh=iCQFksd1e3WFWomz2HoYnQs3kNO/CWdmNf/XFd81xKE=; b=B25KlsZNf0sFv7HCLLOQ1FSZVpbwZbQzZxAsPJIH5pgSILUtIW3aJtISaxdNNEhG+O U0pw3hraH5bSzYeDVqJ0+JlL7S0dbDHXjb5vBD0zWKqg9TBG7zwIIGM/QFkzWwM2J+uV 8KvmJ4zFb0pN+2kUfUtDK2rlEzspMOrNrOzA+O8JOdkPE3ZEmTfs23n2FFwIwaovE7TA Ac3BdXzQVPyBDV/ba51YbT6E15QI0/0Zx92+jhX/PfqHF/OIXLTWVsKX+Hpi1wKev+bc UTCwzn4KdkAMFD7C/NGWDL5A9frRDjQ9OrcfJUd2zVLKAuODU3RiLYqsqunfjkCTFplS 0T2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jrS8rgUB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h10-20020a05640250ca00b0056c0d76d6c1si537674edb.238.2024.03.24.18.03.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jrS8rgUB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 480881F233AE for ; Mon, 25 Mar 2024 01:03:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEADD1C522C; Sun, 24 Mar 2024 22:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jrS8rgUB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B895B1C4B11; Sun, 24 Mar 2024 22:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320358; cv=none; b=omoltiRaH62cYIbvOkUyRBXSyPLnrw5P0XfAwrXUzm2j9NlNPXkCGQiwRerIJxbHLYLk/aFWTs+VibqEV1OeauURwCpF4s88I2Y1XaP8ICPdU/tpJvUepoI1dnd/e87i6mEdvG5VXGyAQsiUuo0K+o15HDvBi778phk2giqJZNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320358; c=relaxed/simple; bh=ElVdjxUV2VcNvyjO2SKyW/p4yoGPYipISTRYJuLUWJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RDYQ5gtaDVuc2Rn3GqcZJVVEEvI9Uzv4D8qaQCgViLF+aojEW99Bwd6Au2kH/qXX6LEsE7sf3FwjNncWdtWvbjAP7Ptt7qPIIe7Xoafq7y7tbWk5tOIErk9ZetBTgwW8I3BIo9tpwSmuUG+6Q3ya/JwDisFMsyG4TJZ76Mxkpxs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jrS8rgUB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02861C43394; Sun, 24 Mar 2024 22:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320358; bh=ElVdjxUV2VcNvyjO2SKyW/p4yoGPYipISTRYJuLUWJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrS8rgUBKuHGtF2omWedh4C82rESa0+lKoK4IPAvmNcMcxgW64M7szRdis95ySimu 8LpsnBdp+L7gWsrLug/DfWXc5s7J0JSpRWDq85ENvNT0p8rR//HXeK+lh9RS53coSN DrFYmbVhvOFrvkT8urdybDyeetWnO5tPvjrIcnA3PqL2i2krD1C9C6i4S1HRJl+qkF rzjP1xOOvImHU39y/cD/HnlxzL3A7FC0LlklbK7wmNdVXMW/iNKcYfqY5jEORaUBeh zkvVOaqPje5lnXVy9MDK7/RFlt/M0OEsqXVbCvy9AQve6vLzkubTfvGuDqcnPN+mP7 huajjCWPUOwqw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 6.8 665/715] io_uring: fix poll_remove stalled req completion Date: Sun, 24 Mar 2024 18:34:04 -0400 Message-ID: <20240324223455.1342824-666-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Pavel Begunkov [ Upstream commit 5e3afe580a9f5ca173a6bd55ffe10948796ef7e5 ] Taking the ctx lock is not enough to use the deferred request completion infrastructure, it'll get queued into the list but no one would expect it there, so it will sit there until next io_submit_flush_completions(). It's hard to care about the cancellation path, so complete it via tw. Fixes: ef7dfac51d8ed ("io_uring/poll: serialize poll linked timer start with poll removal") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/c446740bc16858f8a2a8dcdce899812f21d15f23.1710514702.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/poll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io_uring/poll.c b/io_uring/poll.c index 7513afc7b702e..58b7556f621eb 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -995,7 +995,6 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags) struct io_hash_bucket *bucket; struct io_kiocb *preq; int ret2, ret = 0; - struct io_tw_state ts = { .locked = true }; io_ring_submit_lock(ctx, issue_flags); preq = io_poll_find(ctx, true, &cd, &ctx->cancel_table, &bucket); @@ -1044,7 +1043,8 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags) req_set_fail(preq); io_req_set_res(preq, -ECANCELED, 0); - io_req_task_complete(preq, &ts); + preq->io_task_work.func = io_req_task_complete; + io_req_task_work_add(preq); out: io_ring_submit_unlock(ctx, issue_flags); if (ret < 0) { -- 2.43.0