Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp358558rwe; Wed, 31 Aug 2022 04:12:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ysY5+NZKV9elMBnUKg8zlWkXN4q0Ak4Kj1J5hBoSCg3rlRVvZRZQGOvHw5i4tg70v7pSH X-Received: by 2002:a17:90a:3942:b0:1fb:1d3d:cf24 with SMTP id n2-20020a17090a394200b001fb1d3dcf24mr2857427pjf.72.1661944369984; Wed, 31 Aug 2022 04:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661944369; cv=none; d=google.com; s=arc-20160816; b=mgCzhSfuPzGe+4ZPg1jVkslciIvziT1yGbynXtdcwgMU7c4Jo/Dq9p9gn6LiyHoBLS wj3bAZSAY1pnGllBlCfOnFDEnwYWwpQjZ5pS327rUJlOl04fHOD9kVe1YdWtduihhmRx I5dbD037s6TCS7HTFPUlhFF+RYx9qDOwAbssio76QVNr26H/fs45VUXmP9qIfCn8FQfB AQ0cX5bWy0jiTN7Isej9UyKV2lJL+PmOP9gjOcsU1J5r/n16NNjLrboP832ucG1fGGbg PU8FBcQwuvW8VHEgRmv6AtspXm/yToC2Mzykf2t82MwH7oCQ6sES7FvJj53PkDsR9/Mb L/aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=wjFNeuDmnSdi4atjC35RmIYpin0KTe8MFHXFLhg136I=; b=Pke+CCk4QqhEWjhcJ3wnUOuTkW+Ins3ukseGEGBx7fcXKslg/ecghORiyIpEG3QNR0 d+P8yEmdkVjwofJjH9ZZzG4xyjBI2J2n8l3vTDFXD6e36AzuRoIxypku0aAfN3itj3tz lOXf9cWQor93mheGQMea0DOhzzL6GTQ5x4nWZJPHAsWi7TAvSaiA/Diel1UTYN6zgK62 aGG2IqG8cUy1m3JTGcyDxJpMcDkyOG4RPluonBtAY48VLGwlkhBU3cbpqhkbGD6S8HLK ue/tTFBYHT9nISJOSUnYdxfQH79CavKGrCN/mzNCwXLBF2D3J3y+2OSYCy1Wr3IX3z91 61GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="eh/mtM7O"; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je7-20020a170903264700b0016f5e7d0febsi9517022plb.244.2022.08.31.04.12.28; Wed, 31 Aug 2022 04:12:49 -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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="eh/mtM7O"; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbiHaLFr (ORCPT + 99 others); Wed, 31 Aug 2022 07:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbiHaLFq (ORCPT ); Wed, 31 Aug 2022 07:05:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38D874B48E; Wed, 31 Aug 2022 04:05:43 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B3E581F893; Wed, 31 Aug 2022 11:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661943941; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wjFNeuDmnSdi4atjC35RmIYpin0KTe8MFHXFLhg136I=; b=eh/mtM7OvdKM100QKHqjnEnIeTvSh7jPvX6F39ozEjvde8Dd+ndhdMppBWba/sJ1tnzFdf ewlMfhj5VaCXrOBwKGzIXCxnxFIrtVFY4CivK/tntKqVIuBTKX4Zo2E2eFXyxxJABECRKz Lgneaa/EaYURl2bbQylWiSQIGnw4t/Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661943941; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wjFNeuDmnSdi4atjC35RmIYpin0KTe8MFHXFLhg136I=; b=/X6EjebPK/nXjdXs0OkjNJJCQa9lrq6MrM4FOvrkmtBBl0K4x7HHQHNTru+hzyjfCCPSAp cFjSgDUKZJqweqBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9EFF013A7C; Wed, 31 Aug 2022 11:05:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1iXRJoVAD2PscwAAMHmgww (envelope-from ); Wed, 31 Aug 2022 11:05:41 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 2F62EA067B; Wed, 31 Aug 2022 13:05:41 +0200 (CEST) Date: Wed, 31 Aug 2022 13:05:41 +0200 From: Jan Kara To: Zhang Yi Cc: 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, tytso@mit.edu, akpm@linux-foundation.org, axboe@kernel.dk, viro@zeniv.linux.org.uk, rpeterso@redhat.com, agruenba@redhat.com, almaz.alexandrovich@paragon-software.com, mark@fasheh.com, dushistov@mail.ru, hch@infradead.org, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH 10/14] udf: replace ll_rw_block() Message-ID: <20220831110541.gq4pqyb2b2kc5avt@quack3> References: <20220831072111.3569680-1-yi.zhang@huawei.com> <20220831072111.3569680-11-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220831072111.3569680-11-yi.zhang@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Wed 31-08-22 15:21:07, Zhang Yi 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(). We also switch to > new bh_readahead_batch() helper for the buffer array readahead path. > > Signed-off-by: Zhang Yi Looks good to me. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/udf/dir.c | 2 +- > fs/udf/directory.c | 2 +- > fs/udf/inode.c | 5 +---- > 3 files changed, 3 insertions(+), 6 deletions(-) > > diff --git a/fs/udf/dir.c b/fs/udf/dir.c > index cad3772f9dbe..15a98aa33aa8 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(bha, num, 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..469bc22d6bff 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(bha, num, 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..0971f09d20fc 100644 > --- a/fs/udf/inode.c > +++ b/fs/udf/inode.c > @@ -1214,10 +1214,7 @@ struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block, > 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)) > return bh; > > brelse(bh); > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR