Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp430025ybg; Tue, 22 Oct 2019 23:54:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxva3Xm6OIsf6VguAw4kyhh6i61jgyYORvr5sOdNc+Xkbz+IzM1ex9aAVBT8Vxn6vLj9MNf X-Received: by 2002:a17:906:6bc3:: with SMTP id t3mr1238239ejs.147.1571813644269; Tue, 22 Oct 2019 23:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571813644; cv=none; d=google.com; s=arc-20160816; b=sWRbo+TWIw22Qy4YSTv+McrNijc/gp+EOvqTiEI91g9Pf6uuHfq7lZrAc/aG1JvEPu l/syxkJ2TvW1Ga1i6IMTp6LJwYqQl+C46ynneCU0dCSj2aRZA2jZpG+P+e5aN6f+7Isa no98KvxBV98M1ND3P7KxMUQ1p+wzhaTFh3OTadhnbagcyJkWUuBrOe18+u2ROXZSFHsj 31V/dQNgAlkSbpdgpVhA5aAQ00mKei//2WZq4MmnZRpRQDmLaLtTTRJ1Qhq39gHsmIrX hZCmr6M68Oj48Hdpr9yi3vQSIF2HOPAIUfYcxcpafIIPriSt0YXOkN5tf9hGMDU7fg80 2gsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=PV6McGFqH5It9+aX8htiSaUVx/THB7WoHVfHVpQ4rsg=; b=BB2Fkg50rMbXNGdUPczY58SPBf2nWGfCG+eHwMV5kjD6YuXbB6j/y5pmAs4tg8I6D6 okObkSbXhe3rAUyfP0ZwAEbHelYE50lDY0VamDhWDGE56bhNMnzyo1fo1KiNiKZjuEvM 6gjL87Ub33Qwf48rtne0Jbs10jBNUQZ/ngflnt9sX0BgZ3mPK3U9w5g9DNyKjpk9/L13 35SfX7J3fcgnB7bYXnTP1Cn1pRbA3Zur3m1u/vMC0aoBdx8t27hnYKFKUs5EX4GhkMV2 ZylR0F5I5QJB+csuy7hLp2deUCiQVAP6I+n5FPMf9oqqNVuzs/nqahttd1EYxDsko+DS jjMw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si3875829edj.380.2019.10.22.23.53.38; Tue, 22 Oct 2019 23:54:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727194AbfJWGvW (ORCPT + 99 others); Wed, 23 Oct 2019 02:51:22 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58684 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725796AbfJWGvV (ORCPT ); Wed, 23 Oct 2019 02:51:21 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9N6lVnM128230 for ; Wed, 23 Oct 2019 02:51:20 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vtcwwfbmv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Oct 2019 02:51:20 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 Oct 2019 07:51:18 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 23 Oct 2019 07:51:14 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9N6pEsr44892310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Oct 2019 06:51:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 073EF4C04E; Wed, 23 Oct 2019 06:51:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 027304C040; Wed, 23 Oct 2019 06:51:11 +0000 (GMT) Received: from [9.199.158.207] (unknown [9.199.158.207]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Oct 2019 06:51:10 +0000 (GMT) Subject: Re: [PATCH v5 08/12] ext4: update direct I/O read to do trylock in IOCB_NOWAIT cases To: Matthew Bobrowski , 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 References: <5ee370a435eb08fb14579c7c197b16e9fa0886f0.1571647179.git.mbobrowski@mbobrowski.org> From: Ritesh Harjani Date: Wed, 23 Oct 2019 12:21:10 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <5ee370a435eb08fb14579c7c197b16e9fa0886f0.1571647179.git.mbobrowski@mbobrowski.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19102306-0008-0000-0000-00000325E1BD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19102306-0009-0000-0000-00004A450FEC Message-Id: <20191023065111.027304C040@d06av22.portsmouth.uk.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-23_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910230066 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 10/21/19 2:48 PM, Matthew Bobrowski wrote: > 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 This shall need a rebase (as mentioned in patch-1 discussion). It will be good to mention that the locking condition is kept similar to 942491c9e6d6 ("xfs: fix AIM7 regression"). Also, I think it may also need a fixes tag. It seems unconditional inode_lock_shared was added by below commit. Fixes: 16c54688592c ("ext4: Allow parallel DIO reads") Otherwise, this patch looks good to me. You may add: Reviewed-by: Ritesh Harjani > --- > 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); > /* >