Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1941770ybe; Thu, 12 Sep 2019 01:54:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPE5KLHEOLRs5BYk4bKZZEZ+X6wcwC/RqFAMdL/goA2cZ/atwoKNv7fJ8Bm3eftNbQ645s X-Received: by 2002:a17:906:318d:: with SMTP id 13mr32500289ejy.281.1568278467806; Thu, 12 Sep 2019 01:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568278467; cv=none; d=google.com; s=arc-20160816; b=RWO8A3gQJgKvNOFygDc65xXikAjfcSc0THKEh5HUtFYBmp+EV0MJoUDCarNtG1gOAZ j3Iy12kTieUILXjqFai37PRi5H6L3lOTZKlM0XmVbO/bPeeSHgpq+ieatW0T56kPgy+Q P6peuCLncek7nFlEiKJTBsLS2LLaP/5kJXCRTGHte65CC1FcuQzCvCmyx9EMWkS5pLsN KFCBFndxaxwqd8K8oWR+wQOHyfm65Y72J5WzWebZlmzxFnywp8k/RNDCLAEW0nRBWtuR N+MImBcz3WBzVZ33Loux6KLXTepX0mb0glJ4iRu9oci+44MSkN3pwLGtM+oa69t+FOI8 v2GQ== 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=qOnTpSfiQ5y4Wd31/aR9I2ouWDlnXUs3dss6/dEv0ZE=; b=wiICQ3VPNV/TgvUmOBNzHMPqNlDNYxqTutBfvq177mZS0PgbN3fgJKqxlCyPTb4nMu at/fOKfL/IKlAHuPSbmDD+Rk7mbsH61kZUpAy/cbKgq8Yq4oM9Tb8o6M3S2Vy8BjcRg9 Mu1dZzHipIYfSM7KsJAzrhy0SuQ2ILrvV5kBdLhOvsp/o6dcRJmsvXOegoGF9OX60LSX CVkVRUdHk1C2ABGqL0hxffjMP6mSXUanNYxfJsg7s5hCZmrPSOoqswa/cSqxd6Q/0lZO 0i4ku3RFscLntZTS2iVsg5WTpuqYfbj+/d+U7385clzfkhXsFYKWuFQLYRjYO7yxrEuI BJSg== 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 8si15625842edz.299.2019.09.12.01.53.57; Thu, 12 Sep 2019 01:54:27 -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 S1730401AbfILIwr (ORCPT + 99 others); Thu, 12 Sep 2019 04:52:47 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35400 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730405AbfILIwr (ORCPT ); Thu, 12 Sep 2019 04:52:47 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8C8jQeu128880 for ; Thu, 12 Sep 2019 04:52:46 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2uyh47kvsq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Sep 2019 04:52:45 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Sep 2019 09:52:44 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 12 Sep 2019 09:52:40 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8C8qEv915204728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Sep 2019 08:52:14 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 519A242047; Thu, 12 Sep 2019 08:52:39 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C51642042; Thu, 12 Sep 2019 08:52:36 +0000 (GMT) Received: from [9.199.159.54] (unknown [9.199.159.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 Sep 2019 08:52:36 +0000 (GMT) Subject: Re: [PATCH 2/3] ext4: fix inode rwsem regression To: Goldwyn Rodrigues , linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, hch@infradead.org, andres@anarazel.de, david@fromorbit.com, linux-f2fs-devel@lists.sourceforge.net, Goldwyn Rodrigues , Matthew Bobrowski , aneesh.kumar@linux.ibm.com References: <20190911093926.pfkkx25mffzeuo32@alap3.anarazel.de> <20190911164517.16130-1-rgoldwyn@suse.de> <20190911164517.16130-3-rgoldwyn@suse.de> From: Ritesh Harjani Date: Thu, 12 Sep 2019 14:22:35 +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: <20190911164517.16130-3-rgoldwyn@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19091208-0012-0000-0000-0000034A5978 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091208-0013-0000-0000-00002184C50C Message-Id: <20190912085236.7C51642042@d06av24.portsmouth.uk.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-12_04:,, 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-1906280000 definitions=main-1909120092 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org cc'd Matthew as well. On 9/11/19 10:15 PM, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") > Apparently our current rwsem code doesn't like doing the trylock, then > lock for real scheme. So change our read/write methods to just do the > trylock for the RWF_NOWAIT case. > > Fixes: 728fbc0e10b7 ("ext4: nowait aio support") > Signed-off-by: Goldwyn Rodrigues This patch will conflict with recent iomap patch series. So if this is getting queued up before, so iomap patch series will need to rebase and factor these changes in the new APIs. Otherwise looks good to me! Reviewed-by: Ritesh Harjani > --- > fs/ext4/file.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index 70b0438dbc94..d5b2d0cc325d 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -40,11 +40,13 @@ static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to) > struct inode *inode = file_inode(iocb->ki_filp); > ssize_t ret; > > - if (!inode_trylock_shared(inode)) { > - if (iocb->ki_flags & IOCB_NOWAIT) > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock_shared(inode)) > return -EAGAIN; > + } else { > inode_lock_shared(inode); > } > + > /* > * Recheck under inode lock - at this point we are sure it cannot > * change anymore > @@ -190,11 +192,13 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > ssize_t ret; > > - if (!inode_trylock(inode)) { > - if (iocb->ki_flags & IOCB_NOWAIT) > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock(inode)) > return -EAGAIN; > + } else { > inode_lock(inode); > } > + > ret = ext4_write_checks(iocb, from); > if (ret <= 0) > goto out; > @@ -233,9 +237,10 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) > if (!o_direct && (iocb->ki_flags & IOCB_NOWAIT)) > return -EOPNOTSUPP; > > - if (!inode_trylock(inode)) { > - if (iocb->ki_flags & IOCB_NOWAIT) > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock(inode)) > return -EAGAIN; > + } else { > inode_lock(inode); > } > >