Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp860046pxb; Thu, 15 Apr 2021 08:14:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSYJZo0a3c8o2jIpr+YfbB9VfkRy4xxkYRwUuB+wldyTke8NG5QHeKnl0zHGuIJIoz6O4f X-Received: by 2002:a05:6402:344e:: with SMTP id l14mr4866521edc.184.1618499663119; Thu, 15 Apr 2021 08:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618499663; cv=none; d=google.com; s=arc-20160816; b=OiR+u6Ou4PLkGeZg5KqB2Y1kBdRjQ7IdDFvZofc0XyW+pLNn2rZNFFYDcDg3Ks6TU6 QaQrOlPSiOKXz6rK4caFQBX+6NlXg4B20eu5qQ98s61GM6nX+vQ9v46TLW93kNYKLuMK aelDQcbOWftiLmYmNKDSfu+IUSZzhK2Ie1X//Wu1TzP9v4siKF8jLgoTAvUItWVxEhCO 7eUzuRQ9aEqPjbqYM72/NnhJg3WDfLIv6AK4/GmMl1uGpgEiCQve4tiyOk8MoP/Yct+t Q5ikEvuU5hMh+3pFI7ZQS7zi4KVk7VdA2rJqnuTJxciNZN+a5F5q1wpa2sls9whslPit bG1g== 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=UKA24+Jf5e8sEVyME506pRaJQOVydsiC1S6lwPRy1As=; b=MMOJy+sPt/VDjmT38aumgTnL73YJh4qZv8/866HfSdJcf4xosDCKkDdVvxOskdgmDr jcBOMxp2fuDMHbRkTJpobHOki0bIBnLM5U7bCzT/ftomKfifvnYNqdsY9KokSG7xmdaQ 9u8lXpezJZCAf/tfAfbciVkJQJ6zTNkh+f0zciBSV24UF1ZXXXazIG9VI493w422UlDv IlEbBWACVaQc337isj79xdF3FcruU9oYGB8jedbfUBbUsY5xUxH9gTvyDZPWWXWB+ZmA ZO3Dw2WRVcVTo+b5QASqoJtRSAlaPyyP+iqmsZVOfzug2zKqh7Bm+i9Q9UT9Kui0C9dG x4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WW7xtu89; 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 r13si2271268edw.386.2021.04.15.08.13.59; Thu, 15 Apr 2021 08:14:23 -0700 (PDT) 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=WW7xtu89; 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 S234984AbhDOPLW (ORCPT + 99 others); Thu, 15 Apr 2021 11:11:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:47228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235317AbhDOPAs (ORCPT ); Thu, 15 Apr 2021 11:00:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 28CED613B0; Thu, 15 Apr 2021 14:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618498620; bh=S+LoKKB/P34fdLHzMLjqD/VG/Ol7NcL66qYaVLSZE38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WW7xtu89PIlADOoFipSmJGTcBktJ/5JWsZ5Nu18iBcHczUqJESCrsi3nEaKBDmi+I Kbg23OYQv/Jfd0rYnxLOHoi19e42UN6R4/JNsXznuyNkLI2um7hjJYAF/UQcej6CWd 4KvmP+JdWnxx7M3yWvtyQoU+jVR8xikEYuDf+dq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 5.4 12/18] block: dont ignore REQ_NOWAIT for direct IO Date: Thu, 15 Apr 2021 16:48:05 +0200 Message-Id: <20210415144413.434725034@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415144413.055232956@linuxfoundation.org> References: <20210415144413.055232956@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 f8b78caf21d5bc3fcfc40c18898f9d52ed1451a5 ] If IOCB_NOWAIT is set on submission, then that needs to get propagated to REQ_NOWAIT on the block side. Otherwise we completely lose this information, and any issuer of IOCB_NOWAIT IO will potentially end up blocking on eg request allocation on the storage side. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/block_dev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 79272cdbe827..bd93563477a4 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -246,6 +246,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio.bi_opf = dio_bio_write_op(iocb); task_io_account_write(ret); } + if (iocb->ki_flags & IOCB_NOWAIT) + bio.bi_opf |= REQ_NOWAIT; if (iocb->ki_flags & IOCB_HIPRI) bio_set_polled(&bio, iocb); @@ -399,6 +401,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) bio->bi_opf = dio_bio_write_op(iocb); task_io_account_write(bio->bi_iter.bi_size); } + if (iocb->ki_flags & IOCB_NOWAIT) + bio->bi_opf |= REQ_NOWAIT; dio->size += bio->bi_iter.bi_size; pos += bio->bi_iter.bi_size; -- 2.30.2