Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp383477rwe; Wed, 31 Aug 2022 04:39:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR45CqAfSFeNRQqaBCA956WEZJoPa4/O5spyqyQeCEj3xuhZXs/i/DHJLQTDLPxh9B2Wd/tU X-Received: by 2002:a05:6402:510e:b0:448:9d4b:c760 with SMTP id m14-20020a056402510e00b004489d4bc760mr9512774edd.156.1661945949613; Wed, 31 Aug 2022 04:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661945949; cv=none; d=google.com; s=arc-20160816; b=LzEYvdi4I78A1vK3NWqtbDkyHjTT69sBMZc04zFnf98zn1a/G5epnlNbzRuJxet8cK HzKIwdc9He33ih3qn8D+bLSxaCfjMh+RaCRpVkbnm58mAD0axy9BI7nkwH4gGg+iQOlH sORd+psK10OikgW2Uv1Qz1zoGrrtdYdB5CGHisZsJf3j5N21M4TstNbUmzSc0KzUBjIr rYhDYenfcFypyGUyh2FjJrx9kY0oCo7xYaosgt6USpwfEAAke3iknFZA0oIK0Qywh28B hvB754ILIXqtKaEMGZ77y3+JqUWnvI7MGZ3voY6K/yd6LLEHLaS/U+00eBEmhrhfFcHO bbmg== 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=XrNkIM9koqnVx0iIIXA2kZMeNNiavp0FWSmtqMYA0AU=; b=DEESGHxTS8nkRuff52OXkKl7dt8h9DvFi6JkM13tdlB3b6/yoJ3XiYcOUXRciW/UZs tXUbS/xO+LUwoROucuZ/9tkotiUAh4l570OjOSFkhOt46hQcQzJtBj8zALrZk5zjEHpK pFfbDWhbes05++KH1ngA9excqf4VWOoR5WPsVQbnB3egMaAwpSqhPOENZaQN8kkYyeeb pkkxBruq0Z6gVMhf0fzvsIzBN8vLUGyq3+1hxnBSk12lYanhySPCV+onAMtOFl3EbOhE S9pOieDA0Z4CJkONlzJPV+efCoTyYgafy/AyqSnfgAMUuI4DJzGAeNLddnkh2XxOnBHe shQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=j090jyCm; dkim=neutral (no key) header.i=@suse.cz header.b=tPMWSP1a; 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 w14-20020a056402268e00b00446b90b1ee4si11879480edd.29.2022.08.31.04.38.44; Wed, 31 Aug 2022 04:39:09 -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=j090jyCm; dkim=neutral (no key) header.i=@suse.cz header.b=tPMWSP1a; 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 S230154AbiHaLbi (ORCPT + 99 others); Wed, 31 Aug 2022 07:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiHaLbh (ORCPT ); Wed, 31 Aug 2022 07:31:37 -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 9F9FCA1A60; Wed, 31 Aug 2022 04:31:36 -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 584321F893; Wed, 31 Aug 2022 11:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661945495; 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=XrNkIM9koqnVx0iIIXA2kZMeNNiavp0FWSmtqMYA0AU=; b=j090jyCm7ljBjfs584BrGreYmQ2T034+Z8td5gv5FfrZdYMc/nlY8I/aSz4C3omfWXI7/r ZEOzi6UQXDB/dteLKZnnp6hc6sOMCOwq5e58CzzpQlUY6ftrhpOKAPFxsdKIx1CgNfMFzA Hj4TA31NoNrPyxjPQrg5GzRWQRMIkIk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661945495; 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=XrNkIM9koqnVx0iIIXA2kZMeNNiavp0FWSmtqMYA0AU=; b=tPMWSP1a01IN2kwdj3whXjAztjKIlV4ffC1mOQYyySOtBL6HO9DkoW/WjMWwVHqCAYhxCh O+LRuPOxKQsV1wBg== 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 422571332D; Wed, 31 Aug 2022 11:31:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JKAjEJdGD2NefwAAMHmgww (envelope-from ); Wed, 31 Aug 2022 11:31:35 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id D7D52A067B; Wed, 31 Aug 2022 13:31:34 +0200 (CEST) Date: Wed, 31 Aug 2022 13:31:34 +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 08/14] ocfs2: replace ll_rw_block() Message-ID: <20220831113134.fdmklqore4uglz7g@quack3> References: <20220831072111.3569680-1-yi.zhang@huawei.com> <20220831072111.3569680-9-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220831072111.3569680-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 Wed 31-08-22 15:21:05, 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 > --- > fs/ocfs2/aops.c | 2 +- > fs/ocfs2/super.c | 5 +---- > 2 files changed, 2 insertions(+), 5 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..4050f35bbd0c 100644 > --- a/fs/ocfs2/super.c > +++ b/fs/ocfs2/super.c > @@ -1763,10 +1763,7 @@ static int ocfs2_get_sector(struct super_block *sb, > lock_buffer(*bh); > 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_locked(*bh, 0)) { > mlog_errno(-EIO); > brelse(*bh); > *bh = NULL; I would just use bh_read() here and drop bh_read_locked() altogether... Honza -- Jan Kara SUSE Labs, CR