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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 93BB0C33C9E for ; Tue, 14 Jan 2020 16:12:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5368A24658 for ; Tue, 14 Jan 2020 16:12:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kWOqEnHo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5368A24658 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2EAE98E0003; Tue, 14 Jan 2020 11:12:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2544C8E000B; Tue, 14 Jan 2020 11:12:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF7B78E0003; Tue, 14 Jan 2020 11:12:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id D06738E0009 for ; Tue, 14 Jan 2020 11:12:50 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id AE0211F1D for ; Tue, 14 Jan 2020 16:12:50 +0000 (UTC) X-FDA: 76376733300.22.boats25_35e19b8a66a15 X-HE-Tag: boats25_35e19b8a66a15 X-Filterd-Recvd-Size: 3031 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 16:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ieFO0VW89Plk/SxbxvjUMyxGKaaWQ3fu6VZZX3+eXfU=; b=kWOqEnHoRjSX1561j4MXD/6Osb /OSAUcMlRV+0OWE0r2Z9tu9pFwGdI9kU0cZLSrXGU5IgPFiU6NFRlChhIO7uHCiaP4wNdJTnqu6T9 Ps6ig31zrnEbY0fXUCQw3qTjXUe1NlpLy17XH2HPoPNpiJUSG0x6d++F+lFe7LfPM6r+8Xv04Gyag AbtmbVoAxfu/Ep68NNEmqpcqONUpR8jSGGMIFYT1Py+iCoBpYi14sVJ+dAbBfnXr2oVLhpUAkIL9K Aypu60LR6r1u0zQW/bnDAMKp4wozCSqUhg9jx/OHWyPSJHeWsIXS11ws8MzTl5qh3PhQvKaIew/NW EU6QFkZg==; Received: from [2001:4bb8:18c:4f54:fcbb:a92b:61e1:719] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1irOnz-00008Y-Fj; Tue, 14 Jan 2020 16:12:36 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Waiman Long , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Will Deacon , Andrew Morton , linux-ext4@vger.kernel.org, cluster-devel@redhat.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/12] xfs: fix IOCB_NOWAIT handling in xfs_file_dio_aio_read Date: Tue, 14 Jan 2020 17:12:16 +0100 Message-Id: <20200114161225.309792-4-hch@lst.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114161225.309792-1-hch@lst.de> References: <20200114161225.309792-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Direct I/O reads can also be used with RWF_NOWAIT & co. Fix the inode locking in xfs_file_dio_aio_read to take IOCB_NOWAIT into account. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index c93250108952..b8a4a3f29b36 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -187,7 +187,12 @@ xfs_file_dio_aio_read( =20 file_accessed(iocb->ki_filp); =20 - xfs_ilock(ip, XFS_IOLOCK_SHARED); + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) + return -EAGAIN; + } else { + xfs_ilock(ip, XFS_IOLOCK_SHARED); + } ret =3D iomap_dio_rw(iocb, to, &xfs_read_iomap_ops, NULL, is_sync_kiocb(iocb)); xfs_iunlock(ip, XFS_IOLOCK_SHARED); --=20 2.24.1