Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp696642rwe; Thu, 1 Sep 2022 06:25:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR7D0MgBMGhKADd232GQ8EWeeHP71OLC9A9atvlPaUMhrUi61xnFDmkV/4TJkjnHL/FUlry0 X-Received: by 2002:a17:906:7945:b0:73b:e605:f31 with SMTP id l5-20020a170906794500b0073be6050f31mr24208857ejo.129.1662038736876; Thu, 01 Sep 2022 06:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662038736; cv=none; d=google.com; s=arc-20160816; b=WOrW37kx0jQ4zWInWKay5Ui71lLgBDcKv/tkNtwZnMDJ8BUalXxgWxFrR6RnySgN9f TLryhptPhqNYQ21tnDTQaS0YmLhqnF99eRbuH8Jfh6+v+uBXAyx7W6T6qIQHynRrjHKf jMZQrzTsDieuq/D6ZEUTDGCQQd+/3kLDh35mPMNRtFpbb+xacKw9nuT7+agmD8S9uBm+ DMtzF+UOKp0iTZ79wX4gn++ZxztpPJ+4o9lByZpOTG4G+X0U5l1DeFI/wjjfVVvA4jES KOdJV8Oebyk65CggGs/mlvGAQQaKPYxBbMhjCJXB9N6DbY1z1PJUs1zoFFvbKWjcmMtw aCdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rzqIxN9AGCz3yxFzrefLPMM8n+DHz7ooLLxe2GLVjOc=; b=oodYQ2D1Tt4eN5tuGiUm0C7kMssJsIunh/HiH6LWe/0BGVXUBr/KNWkkhql6Pnohlv GYSjnntWKmKhNe/+O78D5jLqgc4UQ/jEeL0pVVqGxXaBcGKQCCGjc1jfqx454lKqj7qo y0vX3sbYgATpdZ5mNovmHrDnkGMKvGYzm5i79DSrBBen+C8YffDJRHfMHASUZ+zrk50y FrQumhFyH07MWo0xp2o14gQtrnSCq2BdAbkdQli3LAZonQ4Z/xo43MTiqz82dJQSKvIg aFs7N14xBaP7GrQ9UGcuWZ0Nuf49FFIRQoBqcsf3/k3iSrbBTpiPZoZR26mlEjg/YUWW GrVw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a17090652c200b0072b11a2a2afsi5656792ejn.57.2022.09.01.06.25.11; Thu, 01 Sep 2022 06:25:36 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234457AbiIANYo (ORCPT + 99 others); Thu, 1 Sep 2022 09:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234022AbiIANYO (ORCPT ); Thu, 1 Sep 2022 09:24:14 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D713C2BB12; Thu, 1 Sep 2022 06:24:10 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJMBr1WRNznTwj; Thu, 1 Sep 2022 21:21:40 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 1 Sep 2022 21:24:07 +0800 From: Zhang Yi To: , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v2 11/14] ufs: replace ll_rw_block() Date: Thu, 1 Sep 2022 21:35:02 +0800 Message-ID: <20220901133505.2510834-12-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220901133505.2510834-1-yi.zhang@huawei.com> References: <20220901133505.2510834-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 ufs. Signed-off-by: Zhang Yi --- fs/ufs/balloc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index bd810d8239f2..2436e3f82147 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c @@ -295,14 +295,10 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg, if (!buffer_mapped(bh)) map_bh(bh, inode->i_sb, oldb + pos); - if (!buffer_uptodate(bh)) { - ll_rw_block(REQ_OP_READ, 1, &bh); - wait_on_buffer(bh); - if (!buffer_uptodate(bh)) { - ufs_error(inode->i_sb, __func__, - "read of block failed\n"); - break; - } + if (bh_read(bh, 0) < 0) { + ufs_error(inode->i_sb, __func__, + "read of block failed\n"); + break; } UFSD(" change from %llu to %llu, pos %u\n", -- 2.31.1