From patchwork Tue Sep 24 12:53:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Erkun X-Patchwork-Id: 11158601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35ACE14DB for ; Tue, 24 Sep 2019 12:33:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D76521655 for ; Tue, 24 Sep 2019 12:33:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504921AbfIXMdS (ORCPT ); Tue, 24 Sep 2019 08:33:18 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:48736 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731720AbfIXMdS (ORCPT ); Tue, 24 Sep 2019 08:33:18 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EBC49CED7492E1267D71; Tue, 24 Sep 2019 20:33:16 +0800 (CST) Received: from localhost.localdomain (10.175.124.28) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Tue, 24 Sep 2019 20:33:06 +0800 From: yangerkun To: , CC: , , , Subject: [PATCH] io_uring: compare cached_cq_tail with cq.head in_io_uring_poll Date: Tue, 24 Sep 2019 20:53:34 +0800 Message-ID: <20190924125334.5543-1-yangerkun@huawei.com> X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org After 75b28af("io_uring: allocate the two rings together"), we compare sq.head with cached_cq_tail to determine does there any cq invalid. Actually, we should use cq.head. Fixes: 75b28af ("io_uring: allocate the two rings together") Signed-off-by: yangerkun --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 0dadbdbead0f..63cbefba1fb5 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3263,7 +3263,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) if (READ_ONCE(ctx->rings->sq.tail) - ctx->cached_sq_head != ctx->rings->sq_ring_entries) mask |= EPOLLOUT | EPOLLWRNORM; - if (READ_ONCE(ctx->rings->sq.head) != ctx->cached_cq_tail) + if (READ_ONCE(ctx->rings->cq.head) != ctx->cached_cq_tail) mask |= EPOLLIN | EPOLLRDNORM; return mask;