Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp882365rwe; Thu, 1 Sep 2022 09:01:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6h18SJVknFqT61kRQegjoSlTCD5F466VeTwQj21Bc39gEsRG15qMUGG5V1PuEJh+Hdq9eO X-Received: by 2002:a05:6402:1943:b0:443:5ffb:b04e with SMTP id f3-20020a056402194300b004435ffbb04emr4658536edz.230.1662048107389; Thu, 01 Sep 2022 09:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662048107; cv=none; d=google.com; s=arc-20160816; b=LScDgQ+N9WNHMyQEM2PCGM+QHdfxvBuYmz45fD4i9+WGixj+zkpX+n9gjD6vwVzZTn lhW2mLmHQdiY9t0AekfaDGfGwmALazX2uhuUFXAFuFp7Xwkv8hbqBARvWqusqJ+du/ko 2FSPOVz1k+83Pe3grjxOKZvP+E398AjlG7u4Qj1yGN1Kxrs24NNItzSwDd5BHx8q47dJ Qbc8QSNqRMaER0sZLIpTKLaCw3dmn9fIoM8OaPrMeUmnmGixzXw72xUoxL9uYd4c4+Oa KY4N2pS5eeq7FypHMUA+hbw0gefRFfYAxdE4xdV4/JiQQYb6Cey+OKTkIw+nzSUckoHD etEw== 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=5I0mKqUw3QSCLqCj5YIpAi2jtZ5obLRbYrhgg3fEUoY=; b=KE6j0AovLapS3ek8+GQf787tGnTJMqDFNdqUEKGUUoMXPZsaO+40n4o1ng/arc79mw cYTkOeYWU4C4rft2G264C/afPqBuhc+Kp/RQ2pmXLDHQUtWRXGBF9i7freil7H0Qz95E FbC03WHvnpJELTYxwZslizn0lJ8+YFmhhDE/Z0T6VQLr64UDU2DGMtY50ZEuCMZkcqpq XB5ihFPClemKNwrKnxzH/OG3CdJoMVkbcpNQ6i8wzSMeV4bdGxc3rdKraUJ4uzMsQwzE 8nigN5i5/Ulu7qjI5LYDvmAcwWff2ujXQR7QZFwAEx4RVLgx/g4J6GkiCUhuvW5/Bx+9 eZ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=U7Un8DCO; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=Yk5d8Gzm; 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 s16-20020a056402521000b00446984e6dc2si2349825edd.60.2022.09.01.09.01.16; Thu, 01 Sep 2022 09:01:47 -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=U7Un8DCO; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=Yk5d8Gzm; 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 S232107AbiIAPvV (ORCPT + 99 others); Thu, 1 Sep 2022 11:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbiIAPvJ (ORCPT ); Thu, 1 Sep 2022 11:51:09 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC2580E81; Thu, 1 Sep 2022 08:51:07 -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 E8EA9201E1; Thu, 1 Sep 2022 15:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662047465; 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=5I0mKqUw3QSCLqCj5YIpAi2jtZ5obLRbYrhgg3fEUoY=; b=U7Un8DCOE4vHaNWAjnV1RHJvIkAJvwVTD1iy5tLgzFzn0yi3st4XwSnjHZ/fW2kX5uI0R+ 8giwSrL7sQmTu8X13dL0oCRXv81or0G6HiV5h4tVqsSN1kkb7nNO8hOshvQBw2Jv9VtVKb asX++mLhndXWdZAcD15WQ2NnJi/AApA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662047465; 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=5I0mKqUw3QSCLqCj5YIpAi2jtZ5obLRbYrhgg3fEUoY=; b=Yk5d8GzmcdpIlqYUaOt3CYZpv7xi85ztTzS8BwutP7VVFVQTqz0Tihub+VeK5FtVBlJBXC wJZX9dP1SI+QWQDQ== 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 D724C13A89; Thu, 1 Sep 2022 15:51:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ux2CNOnUEGNsBAAAMHmgww (envelope-from ); Thu, 01 Sep 2022 15:51:05 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 44971A067C; Thu, 1 Sep 2022 17:51:05 +0200 (CEST) Date: Thu, 1 Sep 2022 17:51:05 +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 v2 08/14] ocfs2: replace ll_rw_block() Message-ID: <20220901155105.q56thxo7hcudwgrx@quack3> References: <20220901133505.2510834-1-yi.zhang@huawei.com> <20220901133505.2510834-9-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220901133505.2510834-9-yi.zhang@huawei.com> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu 01-09-22 21:34:59, 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() in ocfs2. > > Signed-off-by: Zhang Yi Looks good to me. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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; > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR