Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966367AbeAJQA1 (ORCPT + 1 other); Wed, 10 Jan 2018 11:00:27 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:42177 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966322AbeAJQAW (ORCPT ); Wed, 10 Jan 2018 11:00:22 -0500 From: Christoph Hellwig To: viro@zeniv.linux.org.uk Cc: Avi Kivity , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 29/32] aio: delete iocbs from the active_reqs list in kiocb_cancel Date: Wed, 10 Jan 2018 16:58:50 +0100 Message-Id: <20180110155853.32348-30-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180110155853.32348-1-hch@lst.de> References: <20180110155853.32348-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: One we cancel an iocb there is no reason to keep it on the active_reqs list, given that the list is only used to look for cancelation candidates. Signed-off-by: Christoph Hellwig --- fs/aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 6204c1b81a36..99c1d2ad67e9 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -561,6 +561,8 @@ static int kiocb_cancel(struct aio_kiocb *kiocb) { kiocb_cancel_fn *cancel = kiocb->ki_cancel; + list_del_init(&kiocb->ki_list); + if (!cancel) return -EINVAL; kiocb->ki_cancel = NULL; @@ -607,8 +609,6 @@ static void free_ioctx_users(struct percpu_ref *ref) while (!list_empty(&ctx->active_reqs)) { req = list_first_entry(&ctx->active_reqs, struct aio_kiocb, ki_list); - - list_del_init(&req->ki_list); kiocb_cancel(req); } -- 2.14.2