Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2279028pxb; Thu, 11 Feb 2021 08:31:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVdgHBAvHX4SDvvahlSo6/4UviTNIqI1umN82husIs6W2Srx4FHbd04c0YHrDSqN5PihJo X-Received: by 2002:aa7:c58e:: with SMTP id g14mr9016892edq.362.1613061099856; Thu, 11 Feb 2021 08:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613061099; cv=none; d=google.com; s=arc-20160816; b=Y39DRSazjQzBNHHQLIRtON7Pe0TlLbIkYmoZH2e7++ucVMchtEwDni1O3WtimQ2Tdw aaGV/eWRkLtW8R3okkJJ/phCaxO83AzArOS333YNwH8D5iWRHv/O45N5JniZCJd/nOPP QpvQmQfn4JbVB4ZA+kCvqcHU6lCCTp29CsqmV0b/BJ7TrLSm+kBa9YfO8zwtKRO0/7HO BKS2578ndfQ5Bi0kjTjKugTfkCHLNakQOpc3t5ORDlrF44xDvHY+y6fSE+Z+VpRsa6A4 8vuUzuJaScMJYddyax28O/VT776vh3GmT8PZA/Onk1WazI3OS5vOmkfmPOyq2wfhuyH5 olow== 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=j84/6pFDJbiFDDBVn22YRY4YyPWXifbDURZoaLHI6C4=; b=qV0TMn+4hTal338hg+IY15nu9GHEfBhhJJgAwteJ/pBsZtOljfRTkShYMTgI8nX4lQ SIBUm43W93Fxntyez7oIu/YOaEcC4hlxTRvZ6C2tGBDZz/Sg+0mob03g8R4NoxMLccGL N9g6ZnwPtNBUdEURu0ElP6noOOrrWlQAHPnKER+sMZKQPH4kxqRC6Hs1GXDH46LGvbqH cAEn8c7emCH0x47lOzwECoBxWxKY+Xm1ImwatzfXFdLtGtUQwXCGm1uHi7ozB5MrjmaC rMby21YGsyv/MCcZbKNsuSMKvSWKdgRn+njfo9daD34VHLGLVB+StlTt/x4dc8X7cMrm KNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NqhjOOw; 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 de28si3838347edb.466.2021.02.11.08.30.39; Thu, 11 Feb 2021 08:31:39 -0800 (PST) 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=1NqhjOOw; 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 S230202AbhBKQ3w (ORCPT + 99 others); Thu, 11 Feb 2021 11:29:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:54162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbhBKPZc (ORCPT ); Thu, 11 Feb 2021 10:25:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A33D264EAA; Thu, 11 Feb 2021 15:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613055807; bh=V1cGGQRVwnMxGoASW1ReOzrD9iGH4FBinLv7pYIAjKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NqhjOOwHc1TmO2hTxbHlvb6pnE7xKsccMNQxgUF962wwq5nak576ntz2brhhm6IK YBZ86B7ZvSnjHiwmeTdgGyUAxME5Mecpy4ZpHA9eXz/sStYNwRuS9l/e+k0C/C9k4R zX4xT57YFi0Qrxk9dpzFdXsH4HdpxC6VotE2QYhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Jens Axboe , Pavel Begunkov Subject: [PATCH 5.10 15/54] io_uring: reinforce cancel on flush during exit Date: Thu, 11 Feb 2021 16:01:59 +0100 Message-Id: <20210211150153.538316844@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210211150152.885701259@linuxfoundation.org> References: <20210211150152.885701259@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: Pavel Begunkov [ Upstream commit 3a7efd1ad269ccaf9c1423364d97c9661ba6dafa ] What 84965ff8a84f0 ("io_uring: if we see flush on exit, cancel related tasks") really wants is to cancel all relevant REQ_F_INFLIGHT requests reliably. That can be achieved by io_uring_cancel_files(), but we'll miss it calling io_uring_cancel_task_requests(files=NULL) from io_uring_flush(), because it will go through __io_uring_cancel_task_requests(). Just always call io_uring_cancel_files() during cancel, it's good enough for now. Cc: stable@vger.kernel.org # 5.9+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8692,10 +8692,9 @@ static void io_uring_cancel_task_request io_cancel_defer_files(ctx, task, files); io_cqring_overflow_flush(ctx, true, task, files); + io_uring_cancel_files(ctx, task, files); if (!files) __io_uring_cancel_task_requests(ctx, task); - else - io_uring_cancel_files(ctx, task, files); if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) { atomic_dec(&task->io_uring->in_idle);