Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4290695ybg; Mon, 21 Oct 2019 06:48:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhg/CMGOu2mZzWNqHfxRw4sVJznUtoY+ah506xbswwhPAsiUkMXRZii5vFrrywT6FI4pQz X-Received: by 2002:a50:9fcd:: with SMTP id c71mr25049123edf.139.1571665729117; Mon, 21 Oct 2019 06:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571665729; cv=none; d=google.com; s=arc-20160816; b=WKaE9AXvisNXoYofTPrRITM8LzYAN8NFcMCEt9tFgDosmcyih55KwjjzL/cFzQurOW 0I6LHxz33dKUOd+xwWihPqidSNGdHBV1gfDYA0qjuZXPWFNToWm8bg2z6d/amiMuFeZu WQHnY14eI/xCLSM4AqeN4ILw8vV9z2Iwr1m23PrrdCadnPEaONGdhuJd+0v0rSDbl0VO 7ofwx2mL7q16Rey55fmyw2Adl3aAH6WlgikyV7v7xWxiScle2JRSAtQ+8iK2B6uKzPBI Fz6CaZUXBt5bBpfhgUYqmRhWtp7JdhXgJPxvCk83TjdBl9sTcYD2nBPBVqGgmkW7qEL9 GVdQ== 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; bh=9onONyxHbdm0cal5iIYHAXt88msS9/Z1FMjgvyMs8/s=; b=hJgghhXTXYluuhpCBHDQntZmdqwA3I1yABM2v9vlDi/zKuOefd3VPAmR7E8rtNqpu7 iTLFR5hC98P5jthFwTSPGC6w/3BvrhMM/xSZ/lMY+DDVxLSBaQxpKq1QbxsiZoaTt9nN rrXAQDjgmkJSOowP2eVO3+7UfSr4e87ff+lmww/+4iwS5veKoMvtkw2DRge3jlt6Q8R2 Ey0vJMMS++YPGAmYbj1SdWza0B7w4OUNaQ8dAlR5D0qDr5KXuBL8a3mRKvQAWspcwo6P 8EvHYV85ISTAqT0vJSXERXGd8J6Mf4BnjjDKIuyftr4sR48FlT0csjbfWoq9+KB0eNHV PVnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 g53si2674882edb.313.2019.10.21.06.48.23; Mon, 21 Oct 2019 06:48:49 -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; 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 S1728843AbfJUNsT (ORCPT + 99 others); Mon, 21 Oct 2019 09:48:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:60466 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728083AbfJUNsT (ORCPT ); Mon, 21 Oct 2019 09:48:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D7FDDB469; Mon, 21 Oct 2019 13:48:17 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 6CC681E4AA2; Mon, 21 Oct 2019 15:48:17 +0200 (CEST) Date: Mon, 21 Oct 2019 15:48:17 +0200 From: Jan Kara To: Matthew Bobrowski Cc: tytso@mit.edu, jack@suse.cz, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, david@fromorbit.com, darrick.wong@oracle.com Subject: Re: [PATCH v5 08/12] ext4: update direct I/O read to do trylock in IOCB_NOWAIT cases Message-ID: <20191021134817.GG25184@quack2.suse.cz> References: <5ee370a435eb08fb14579c7c197b16e9fa0886f0.1571647179.git.mbobrowski@mbobrowski.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ee370a435eb08fb14579c7c197b16e9fa0886f0.1571647179.git.mbobrowski@mbobrowski.org> 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 On Mon 21-10-19 20:18:46, Matthew Bobrowski wrote: > This patch updates the lock pattern in ext4_dio_read_iter() to only > perform the trylock in IOCB_NOWAIT cases. The changelog is actually misleading. It should say something like "This patch updates the lock pattern in ext4_dio_read_iter() to not block on inode lock in case of IOCB_NOWAIT direct IO reads." Also to ease backporting of easy fixes, we try to put patches like this early in the series (fixing code in ext4_direct_IO_read(), and then the fixed code would just carry over to ext4_dio_read_iter()). The change itself looks good to me. Honza > > 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); > /* -- Jan Kara SUSE Labs, CR