From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E7D1C433E6 for ; Mon, 31 Aug 2020 09:58:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A0A1206EB for ; Mon, 31 Aug 2020 09:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598867914; bh=lZGieMTfNY6jGaL18+rLoiSpMEhMUzSmCKCDcOCYpRc=; h=Subject:To:Cc:From:Date:List-ID:From; b=AtndiTfR1sDkkedbGiZJn+WBeoVTRNu+7MpeYneVBqG17q+PKC1rumAzdrY1aXgs4 qUztZ563LSdOEMJDClF/hL47n7QIAyu1iWde1Q2vhfqBA+RI7WtXmxPm6lQypJPeb/ 9KBbnzF2oxWk6ZwXT6uBvbpDTKx1lI41TyzUYobk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbgHaJ6e (ORCPT ); Mon, 31 Aug 2020 05:58:34 -0400 Received: from wforward2-smtp.messagingengine.com ([64.147.123.31]:41433 "EHLO wforward2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbgHaJ6d (ORCPT ); Mon, 31 Aug 2020 05:58:33 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id EEED5642; Mon, 31 Aug 2020 05:58:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 31 Aug 2020 05:58:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=iAWQhq snvIKOzgdkRsDgKDVOwg39kmR5cXQ9EPhJMA8=; b=LlWSEPe4tMuLna0rD1stVN ZXE+ucVxS9Iu+MLxW9SZeeMI773RMZycHqQWus13xWTRlxH8QHRNN3JsLydQtgMB GtARIdidYSoJ20UqXOBe3q6YerNaszAF3O360rkeh9RD1OrObON1u+ETXT/g1kWm Ku7u9OrhwEksL5ZikZIQo+6dtCX7QL6LiTbkOkBwQlgQ6atXOQkK9oJ5MvO/bkTs 1EeIxsxgy6nONPVjMPAIeqYTIjjL0ZQ+T2n1aUKgJ8L6/WatZFpLFv2XvMos9Z24 264ruxu7Mpd7kKm+gKUBu2lmlfjLJ88zAW06XgygWdZr97itqF/C4yQgyKXp982A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudefhedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepieetveehuedvhfdtgfdvieeiheehfeelveevheejud etveeuveeludejjefgteehnecukfhppeekfedrkeeirdejgedrieegnecuvehluhhsthgv rhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrd gtohhm X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 1ACA9306005E; Mon, 31 Aug 2020 05:58:32 -0400 (EDT) Subject: FAILED: patch "[PATCH] io_uring: don't use poll handler if file can't be nonblocking" failed to apply to 5.8-stable tree To: axboe@kernel.dk, wisp3rwind@posteo.eu Cc: From: Date: Mon, 31 Aug 2020 11:58:41 +0200 Message-ID: <159886792176158@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.8-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9dab14b81807a40dab8e464ec87043935c562c2c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 25 Aug 2020 12:27:50 -0600 Subject: [PATCH] io_uring: don't use poll handler if file can't be nonblocking read/written There's no point in using the poll handler if we can't do a nonblocking IO attempt of the operation, since we'll need to go async anyway. In fact this is actively harmful, as reading from eg pipes won't return 0 to indicate EOF. Cc: stable@vger.kernel.org # v5.7+ Reported-by: Benedikt Ames Signed-off-by: Jens Axboe diff --git a/fs/io_uring.c b/fs/io_uring.c index 384df86dfc69..d15139088e4c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4889,12 +4889,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req) struct async_poll *apoll; struct io_poll_table ipt; __poll_t mask, ret; + int rw; if (!req->file || !file_can_poll(req->file)) return false; if (req->flags & REQ_F_POLLED) return false; - if (!def->pollin && !def->pollout) + if (def->pollin) + rw = READ; + else if (def->pollout) + rw = WRITE; + else + return false; + /* if we can't nonblock try, then no point in arming a poll handler */ + if (!io_file_supports_async(req->file, rw)) return false; apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);