Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp719499ybl; Fri, 13 Dec 2019 03:35:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwQp5EEX+OLefssjeeSdOaCWoeN5zKJQzK8z3DmVv8eju/4l2UAI1eq/TaYsO3DaA9dfMAy X-Received: by 2002:a05:6830:1582:: with SMTP id i2mr14737235otr.50.1576236925639; Fri, 13 Dec 2019 03:35:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576236925; cv=none; d=google.com; s=arc-20160816; b=uQlgv8OnCl0L4j+q5V5MwWW481mzwN9XWFZpcAdTCauc8668U6vBR+5bjyba/EeiZf yu6ibC7ZFnVtZswGywEbYdBUYvR1rxtbnzsWB4pN2MW31uFjvtfxXqF+y9B7/BTHyzHB O2LYGgh9U7+cn9cNs+k58sDp5n9LnLHT4CRShJyRX9WnjK/ivwJeUYftcaxwlWBPyrtQ QuOSDwES8R/8jPsx6jTdknkPow6Bk34GqsMLb36LDnFr6NDudGlPY1SskqvIUaIby1n5 paCog2BLeBsQv/Jr22V+TAiKoNXV8zMwG8vOTlb1qE5R8EVLe1qgEbp9Pxkb0GkET7dF zmJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tTcJTWV1yxqT2O7BYyLbbIA04fgF/hVY3qcr5ijVdx4=; b=SL7slOxH13ZzL5kz6wNDU5NJvRMvhutSPE08kuoS9GuSCD/mZ4myBOZ9L+Igy4HCni l9ihS/cmN1hK9Pry064oREXiNojgaBHH9nfJPjtmYYKzkd6EvNaoDwQpS8leHHzW+h9m llKPMW5RZGgeQRJQy85WXFuVn8dtufnkt2CRAviU375aUuWhbLcjvLPnMoylGhFyTkYj yAg21zHaAkhg85ByK3JocFbQjVKZ07xxTSXVPwi3t1aJwMDFuBUzdzIhmKR2CLITGJ+F bkskhnVwG5ckVneyuPsDv20cJRxW7zjK65tstrhQOoKZYfeazSF1JSwrPEGSLEFztOwi H8sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si4956811oti.246.2019.12.13.03.35.14; Fri, 13 Dec 2019 03:35:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725946AbfLMLfN (ORCPT + 99 others); Fri, 13 Dec 2019 06:35:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:33890 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725945AbfLMLfN (ORCPT ); Fri, 13 Dec 2019 06:35:13 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 724F5ACD9; Fri, 13 Dec 2019 11:35:11 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id E5FC21E0CAF; Fri, 13 Dec 2019 12:35:10 +0100 (CET) Date: Fri, 13 Dec 2019 12:35:10 +0100 From: Jan Kara To: Phong Tran Cc: tytso@mit.edu, adilger.kernel@dilger.ca, paulmck@kernel.org, joel@joelfernandes.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, rcu@vger.kernel.org Subject: Re: [PATCH] ext4: use rcu API in debug_print_tree Message-ID: <20191213113510.GG15474@quack2.suse.cz> References: <20191201035107.24355-1-tranmanphong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191201035107.24355-1-tranmanphong@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun 01-12-19 10:51:07, Phong Tran wrote: > struct ext4_sb_info.system_blks was marked __rcu. > But access the pointer without using RCU lock and dereference. > Sparse warning with __rcu notation: > > block_validity.c:139:29: warning: incorrect type in argument 1 (different address spaces) > block_validity.c:139:29: expected struct rb_root const * > block_validity.c:139:29: got struct rb_root [noderef] * > > Signed-off-by: Phong Tran Thanks for the patch. It looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/block_validity.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c > index d4d4fdfac1a6..1ee04e76bbe0 100644 > --- a/fs/ext4/block_validity.c > +++ b/fs/ext4/block_validity.c > @@ -133,10 +133,13 @@ static void debug_print_tree(struct ext4_sb_info *sbi) > { > struct rb_node *node; > struct ext4_system_zone *entry; > + struct ext4_system_blocks *system_blks; > int first = 1; > > printk(KERN_INFO "System zones: "); > - node = rb_first(&sbi->system_blks->root); > + rcu_read_lock(); > + system_blks = rcu_dereference(sbi->system_blks); > + node = rb_first(&system_blks->root); > while (node) { > entry = rb_entry(node, struct ext4_system_zone, node); > printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ", > @@ -144,6 +147,7 @@ static void debug_print_tree(struct ext4_sb_info *sbi) > first = 0; > node = rb_next(node); > } > + rcu_read_unlock(); > printk(KERN_CONT "\n"); > } > > -- > 2.20.1 > -- Jan Kara SUSE Labs, CR