Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp698291rwe; Thu, 1 Sep 2022 06:27:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/JxDn9zJyRmTHq9doD4OGYwUAciAjjyjawEkToH4vvjTWOp1jTfJIEP+iFiLLa7vMh43q X-Received: by 2002:a05:6402:42c5:b0:448:913e:f16 with SMTP id i5-20020a05640242c500b00448913e0f16mr14493061edc.22.1662038825694; Thu, 01 Sep 2022 06:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662038825; cv=none; d=google.com; s=arc-20160816; b=JAlLvXAhur16fTcvAAHu30MdmT0BtQk63mrbnXe3Q72eHCQ8wFQ2SA95ql0RFcPG+8 l46mr+Rzq5twVHyBR2hY7hAGg8ME5VH8LIUglWMYG6xBtrOsZOgSGqMIvT+wln4NTIwV jWNskb5yi1QsM1hcaxqGFURIDluFEipUAD/g5C1DKINF2hm2b2eE4IEuxHLGokyr7+rX 1Y6C6t26F27/E6RFhkg47VrZdwFDH7skW0R7fQgrgQFcGfZjDITNnFMx9dIxu1JRSSBa MJm2whLABIB1RFCDLWL37BFZNX7MtNJD5+AIoEg1XO9/qi7LgPzXDE73StmzRm4jkgLd Uwfw== 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=55zLMtUXOwsXCvh+23NUHeer+ouKEyA1s1CcDVSQRbw=; b=tmcJw6gdAe90b8ttvbK8eSO2YHkZP8ALEDd64u7U5XsW8dI3vgqjZShWWHcxSor3+t 1Z/r5edvsCJc10Q1xE0dYC2MTxd0Z0CVk3l7AiVO1bIKUmIIKs6tziBdJ23HKVBW+pJh kBvBghfNKg6qsWas9V8rY3ug/JJI1/XJqN1w7lM3LVEdpO7e7Pp28oE2adKdKRzHXLHX OYw8dtdSB91F2nnp0bjxcAdn2ps2JFUg45WzNLpiBQBk+Rz1ke+SLmuO85dAl1wpUXNw +CAoSW6ygYpIXSfK2FZ8w7rkLJAxxQ6SMnSQPOtoV3P8OANLSf29zIyc7vrn/vIVFlkD cfRw== 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 g14-20020a056402090e00b00448ed997cc5si1693294edz.300.2022.09.01.06.26.40; Thu, 01 Sep 2022 06:27:05 -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 S234321AbiIANZf (ORCPT + 99 others); Thu, 1 Sep 2022 09:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234382AbiIANYU (ORCPT ); Thu, 1 Sep 2022 09:24:20 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0A529C81; Thu, 1 Sep 2022 06:24:09 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MJMCZ3kgBzHnV3; Thu, 1 Sep 2022 21:22:18 +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:06 +0800 From: Zhang Yi To: , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v2 10/14] udf: replace ll_rw_block() Date: Thu, 1 Sep 2022 21:35:01 +0800 Message-ID: <20220901133505.2510834-11-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(). We also switch to new bh_readahead_batch() helper for the buffer array readahead path. Signed-off-by: Zhang Yi --- fs/udf/dir.c | 2 +- fs/udf/directory.c | 2 +- fs/udf/inode.c | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/udf/dir.c b/fs/udf/dir.c index cad3772f9dbe..be640f4b2f2c 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -130,7 +130,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx) brelse(tmp); } if (num) { - ll_rw_block(REQ_OP_READ | REQ_RAHEAD, num, bha); + bh_readahead_batch(num, bha, REQ_RAHEAD); for (i = 0; i < num; i++) brelse(bha[i]); } diff --git a/fs/udf/directory.c b/fs/udf/directory.c index a2adf6293093..16bcf2c6b8b3 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -89,7 +89,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, brelse(tmp); } if (num) { - ll_rw_block(REQ_OP_READ | REQ_RAHEAD, num, bha); + bh_readahead_batch(num, bha, REQ_RAHEAD); for (i = 0; i < num; i++) brelse(bha[i]); } diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 8d06daed549f..dce6ae9ae306 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1211,13 +1211,7 @@ struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block, if (!bh) return NULL; - if (buffer_uptodate(bh)) - return bh; - - ll_rw_block(REQ_OP_READ, 1, &bh); - - wait_on_buffer(bh); - if (buffer_uptodate(bh)) + if (bh_read(bh, 0) >= 0) return bh; brelse(bh); -- 2.31.1