Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp4241264pjb; Mon, 21 Oct 2019 02:19:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7L+6VwX0PQ/ToEm6F8/9156Y3vPFpy2xtuICagCuhDfyKtCt8dAdplm5+81FAG+F6Bc1y X-Received: by 2002:a05:6402:1612:: with SMTP id f18mr23932034edv.66.1571649560501; Mon, 21 Oct 2019 02:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571649560; cv=none; d=google.com; s=arc-20160816; b=hwErBNuDe4IwzIv+aNi+Cuc6NKgJ8PdFkpPj9+8Euiakxyxcojzs9nVyDN1reUIIUu CgcaoeA8c4OnVPacNT7LrT+s1N048qvp4v0K4LZqr1+Mg7NK9taGomIrX+X8M9g9wHmL KgtUJA9u0Uy2wY3jd84mCBxvSHWkW1G4aztipaicxImBDUkzQ1Ve9ezm1PfwJYwMckTm tt/xJOBcNNhindhX4Xi+ezVqtHyT66DPgzS+8VT1C4LiWaLYlTbKEvr13mnQgZ5p+IDy fKtBURVfKwvNTmu3T6hRT7nLAFgLMGKpBEdyKcwkV9/c7sDNAPWfzEsZ6FNjfN7f1fs/ 8Y6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NjpvV8uwr5CMxSHQQg16F2wD3z2WNwbI9Jh+TD4XnXY=; b=AVfgQwMccbXhC/4tCoodnstGpBiT260qbe+HtzOfAnhwB7OrhIAdpnAdIhh35WnMl6 oLXkKIJ+Wuahs1UTs1o6FJFskH3VfkYqhuwBpNPprfcVHgquwTmR/RbWSy2SCMmnZbXm zg+qZ4frhew1jL7Met1DKRLXZ6Bp4fL+Hh8dT8f20chOqGX4s6+zm1eBBDKBLy+fJSUd EX1sy7eGJkYLgcYJcZxnTvgd8F6wex95Fi2jBmr9Rdadi+Trf5i6+CpRziKrjSwhPeVT 5FwQym/WNBOYUXKdA6/WgUL96OWNRIJQ8eQOv69e+pJjQSAss7kA2OpbIxuqZ2TKFshw 84Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=vEk6Puhf; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sb7si7889488ejb.321.2019.10.21.02.18.56; Mon, 21 Oct 2019 02:19:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=vEk6Puhf; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbfJUJSx (ORCPT + 99 others); Mon, 21 Oct 2019 05:18:53 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39466 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfJUJSx (ORCPT ); Mon, 21 Oct 2019 05:18:53 -0400 Received: by mail-pf1-f194.google.com with SMTP id v4so8034103pff.6 for ; Mon, 21 Oct 2019 02:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mbobrowski-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NjpvV8uwr5CMxSHQQg16F2wD3z2WNwbI9Jh+TD4XnXY=; b=vEk6Puhf0YPo+yAGy4lqVJHbL+tKXJEEvZvEtTFBubOEZwsz5yx/yjBzdATqReIk+F OMEqpCFZsfZSbMI+aAeTWr9OwkffaOe/VxkUAs9IkfHVxHNCXiYef/H90ebe9fQxszW1 2oAbngOddMhzSIiZlDhmNUL+qTVM2flr+GjOXRc+LeZav0DcGjwhW33+D98OWGPxLGj2 HE/yhuERMsd7MGJ2vUIp8En0nN1driDlotlMdVaGBB9VHo3hZ+hif3kaLCH8nOaBm+Ik M5TMMW1RV/Do6DLc2b0ggSai0x7YjF4xw0WLnwTs84s4RWlR7jDjWhumahmSEiXOhRhQ a8YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NjpvV8uwr5CMxSHQQg16F2wD3z2WNwbI9Jh+TD4XnXY=; b=fbhOYBNMFiXJ5fjW2lx36T0EPKNJ345mUTO6+JdUcdRRuBw3dCYJcKQ0Y2VWwU7f43 I5KXVo5LkdKStDNtDNYnqd7ELfSn0NtNQX+3DnJom7z7QyyVmNhfYRJLxWP1YdVkHm/+ 3InFFbvhxT1vKo2expM28vRgHFwKS0jv7+wtVXtSsYA+TwX0lsMTOpNLsEwbqWYMyHVl ply2FE7Mwce7/Nq9AWeTFnXZYl0u5cw0j/9YIflTybgH0sCM5uAUi8dbsbCMvlqxach3 EH2xvJbs+dZrtGDMvB+/zRkdZf0ATtsUsVan5Nt8ckcXsrJi/GMxUog3u39N046DxUEE ZR6g== X-Gm-Message-State: APjAAAXrmp6LJBOBvW3Dj3dzc4jg9Gsysl8o6qOx6dS05+tQBmqlpJFQ b+94vaHC6Q5FgSgQoWLQsstc X-Received: by 2002:a62:b504:: with SMTP id y4mr12897974pfe.40.1571649532852; Mon, 21 Oct 2019 02:18:52 -0700 (PDT) Received: from athena.bobrowski.net (n1-41-199-60.bla2.nsw.optusnet.com.au. [1.41.199.60]) by smtp.gmail.com with ESMTPSA id x72sm17185876pfc.89.2019.10.21.02.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 02:18:52 -0700 (PDT) Date: Mon, 21 Oct 2019 20:18:46 +1100 From: Matthew Bobrowski To: tytso@mit.edu, jack@suse.cz, adilger.kernel@dilger.ca Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, david@fromorbit.com, darrick.wong@oracle.com Subject: [PATCH v5 08/12] ext4: update direct I/O read to do trylock in IOCB_NOWAIT cases Message-ID: <5ee370a435eb08fb14579c7c197b16e9fa0886f0.1571647179.git.mbobrowski@mbobrowski.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This patch updates the lock pattern in ext4_dio_read_iter() to only perform the trylock in IOCB_NOWAIT cases. Signed-off-by: Matthew Bobrowski --- fs/ext4/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 6ea7e00e0204..8420686b90f5 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -52,7 +52,13 @@ static int ext4_dio_read_iter(struct kiocb *iocb, struct iov_iter *to) ssize_t ret; struct inode *inode = file_inode(iocb->ki_filp); - inode_lock_shared(inode); + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!inode_trylock_shared(inode)) + return -EAGAIN; + } else { + inode_lock_shared(inode); + } + if (!ext4_dio_supported(inode)) { inode_unlock_shared(inode); /* -- 2.20.1 ----