Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3758156rwb; Mon, 5 Sep 2022 18:29:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4j9PN2uzji8wUeL1X1IkXoGok8alG1J7ldp5LcxxcpXBcwYJjaGMY1nEgntx/0fAJV0goX X-Received: by 2002:a17:907:7fac:b0:741:4247:d856 with SMTP id qk44-20020a1709077fac00b007414247d856mr30550990ejc.565.1662427793024; Mon, 05 Sep 2022 18:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662427793; cv=none; d=google.com; s=arc-20160816; b=isuEYwKnOhjEJaqTt89X2uQ3DCzzGj4zC3uva2jxbGfccSNAg+QVEe7X35yiE1Bzuj mP24/H0oDIZQsLkqQv5PInzEtE3V95BSi7mHJBSO0UCpGyvPdB617eHC1i84b8qd5p3x fzfA7ZeVe9M5xWlbAou64JrqmYLQzLnLncdfZsLqT2abXkhrBIpXcHzED4nhhWwsoiVw n6M7dRRKF2ezeAh6Pm9jApjeM3KIYpCJ4Zwu5dEi1VNpFL1fDA2deZfrpO2alavl0MhV E1eRjzvDhRRUB320cQsQVCbrLGi86dJFT78C70D2Y3HfSpacyANrlp9qqxPdzrQpGADR s3rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=UXFqJo5GAIOF6o7wyHkdBTzU+C1sVte7GmJpIDlsUrM=; b=lvw/QJgrbDHVbHk4tYa7NsK/ocpXUdR6oF/7Ezp7YyCJIpcf6jiGBe6zay/h6K/N3y h4uzq/CvPZclUA7sDbD1l9Kf2WOL5VIeY/vXX1RnU+mSKMLMcKCp5TntjJkVxysThm2C swSfpTpXlD6tbkYm6Vfb39GxrZ4u+rL1GBk+fu/2U9aUoyalrAaqisWe32tkmcbigTXq 51/zrbqPRjGX9M6LNcYnOuqQ6kv2yNbFGjTR0LaNxtvm3vrxoUeYIEd72xaggHuSF7GC 8HHaNvibfZZRrOa+TGJDZ+0DWg45FWd5T5rMtGvp0lLG0Pqg503G92Kparxwf80UBQfz +ang== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a056402084900b00446e658cfdbsi10465049edz.240.2022.09.05.18.29.17; Mon, 05 Sep 2022 18:29:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbiIFBGb (ORCPT + 99 others); Mon, 5 Sep 2022 21:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbiIFBGb (ORCPT ); Mon, 5 Sep 2022 21:06:31 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 032C352460; Mon, 5 Sep 2022 18:06:28 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0VOZFNX5_1662426383; Received: from 30.221.128.209(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0VOZFNX5_1662426383) by smtp.aliyun-inc.com; Tue, 06 Sep 2022 09:06:25 +0800 Message-ID: <65f66ce6-7695-2884-23a9-378b5c9ca04f@linux.alibaba.com> Date: Tue, 6 Sep 2022 09:06:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [Ocfs2-devel] [PATCH v2 08/14] ocfs2: replace ll_rw_block() Content-Language: en-US To: Zhang Yi , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, cluster-devel@redhat.com, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, jack@suse.cz Cc: axboe@kernel.dk, hch@infradead.org, tytso@mit.edu, agruenba@redhat.com, almaz.alexandrovich@paragon-software.com, viro@zeniv.linux.org.uk, yukuai3@huawei.com, rpeterso@redhat.com, dushistov@mail.ru, chengzhihao1@huawei.com References: <20220901133505.2510834-1-yi.zhang@huawei.com> <20220901133505.2510834-9-yi.zhang@huawei.com> From: Joseph Qi In-Reply-To: <20220901133505.2510834-9-yi.zhang@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 9/1/22 9:34 PM, Zhang Yi via Ocfs2-devel wrote: > ll_rw_block() is not safe for the sync read path because it cannot > guarantee that submitting read IO if the buffer has been locked. We > could get false positive EIO after wait_on_buffer() if the buffer has > been locked by others. So stop using ll_rw_block() in ocfs2. > > Signed-off-by: Zhang Yi Looks good to me. Reviewed-by: Joseph Qi > --- > fs/ocfs2/aops.c | 2 +- > fs/ocfs2/super.c | 4 +--- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c > index af4157f61927..1d65f6ef00ca 100644 > --- a/fs/ocfs2/aops.c > +++ b/fs/ocfs2/aops.c > @@ -636,7 +636,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno, > !buffer_new(bh) && > ocfs2_should_read_blk(inode, page, block_start) && > (block_start < from || block_end > to)) { > - ll_rw_block(REQ_OP_READ, 1, &bh); > + bh_read_nowait(bh, 0); > *wait_bh++=bh; > } > > diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c > index e2cc9eec287c..26b4c2bfee49 100644 > --- a/fs/ocfs2/super.c > +++ b/fs/ocfs2/super.c > @@ -1764,9 +1764,7 @@ static int ocfs2_get_sector(struct super_block *sb, > if (!buffer_dirty(*bh)) > clear_buffer_uptodate(*bh); > unlock_buffer(*bh); > - ll_rw_block(REQ_OP_READ, 1, bh); > - wait_on_buffer(*bh); > - if (!buffer_uptodate(*bh)) { > + if (bh_read(*bh, 0) < 0) { > mlog_errno(-EIO); > brelse(*bh); > *bh = NULL;