Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1138682ybl; Fri, 13 Dec 2019 10:12:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzjYRQ/xYqPkYHX4EyGvM8DfEzqZILQ6eEcA82y1VaOoKLHc8EU8q0NywVgGgu/l1hxdY8t X-Received: by 2002:a9d:413:: with SMTP id 19mr16212231otc.11.1576260747236; Fri, 13 Dec 2019 10:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576260747; cv=none; d=google.com; s=arc-20160816; b=CDtEibNGd8WdhqqdtrpQxTT+yw6vhzOyMuNUw4d5pF0UDoe9a+HuS70E+x7HPUXp5y zbQgDTJa/JTw6wDX51gasRfEK8DwaPjoJuEmw27DphlGhAJyZWWLhCKLlj1T02DLxxHA 44nMZSpDyXUZWfTTym6pHDLiXA4nWZEDWqyk8jzae8otQ8702Vo0I0BuLdFRfQro8ai5 iU0HUoXHWFYP74v49DQ8agGuepM4m3TtPqU1svs0+yEW9cFEM4760G04UvV+cJ3SQQ8t xbLXR4jBZ75jsrdY5Y0uLZQ28pBEHpnaFQRZRaneH75I6lXSc4xbJYsn5yVoxvfrZPAZ SuOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zYPYNQC53+CxeOZMSLaSXNleC2alunHbsG33GQacSz4=; b=LXfgM4dSOBxkUd/rdQxpl4jMzDshWrN/PVmrOu5TfCb21vBcLxTYd1k7NaP4bQLjWC 9itOPl1pN31qn1laEahTV1nDU0cWNGgU+cSuIWf6I/1+MKEyK5ZgmQbOu13MXlCrbKx7 xgaLPYdnFesGsaaJ1JozcZhnmIgriVozzhYGqOJIO01m8Bp8g+7OrKKsk7X73OsNrivK uKMgBuVKuNKRbg+NmCLfpjvxxqS0It1u0pfV0B2H9mxEOo9IxLj0by0hEgofJ1o2FsDZ KH/Y9kUzNLqur0qaeGmv2+EPep93UYrX2mhpDDhu/sCYRa9KTA3+tk4ohX1rnTMi2XAc Yn6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VoZOlw8a; 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 o4si5337099otp.200.2019.12.13.10.12.07; Fri, 13 Dec 2019 10:12:27 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VoZOlw8a; 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 S1728670AbfLMSMC (ORCPT + 99 others); Fri, 13 Dec 2019 13:12:02 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:36945 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728659AbfLMSMC (ORCPT ); Fri, 13 Dec 2019 13:12:02 -0500 Received: by mail-qk1-f193.google.com with SMTP id m188so332083qkc.4 for ; Fri, 13 Dec 2019 10:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zYPYNQC53+CxeOZMSLaSXNleC2alunHbsG33GQacSz4=; b=VoZOlw8aTRJ5130OpGd/2QPPeJVLXlpFsO6lMnt0ZVol+swiG2OufkT5eZ5bZNX1t7 6uq3Wh9ztEg6X4u9wTAPnozLL7VzKAPoXn1vpSn2db+we4rYrwIknRm5sY6suY68VX6z qT12MybJIwhfdsNBRT2iKWvDh8hJH5RCDmfsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zYPYNQC53+CxeOZMSLaSXNleC2alunHbsG33GQacSz4=; b=Ts3UBFBEUgCp1przGD3QfwEbni3c5Q6KpW+EXGbSpDKLCpDgPGeaOb8cv7AcfS0J7Q FnOgc/EXxuH/21oQ/jUHGuRkfx0slyP+/lqUETwkFjBVT7rO/fpKXfC1BBSP7YKX7UBR MrCe4nz1P4pokX50+7GzETs97/z22yXYTeMSTQmVa0XVxrWzEZM2OXN9/kMOiuSzoSQj iYz7LE2dZpQw3znqwyvfgWtQzP+IEAWU8iekMr54W+bS5avFil4Cr5T8FcFsUMRe1CPy dO92lU5iULAWXIsembFm1a2yAvdqmV1rEEbfC7h0feSC+LviGVUFZN1CkOE7iXj0y92I zwng== X-Gm-Message-State: APjAAAW2RAPuM46ML6jvOcgu1soah4RTp2cwCbd1UP8MBj/l8JnBvgQP SeyU5fACd38fiPF9fm4Vcaw7PdR/Valq05UXxfyxEA== X-Received: by 2002:a37:514:: with SMTP id 20mr14328531qkf.321.1576260721379; Fri, 13 Dec 2019 10:12:01 -0800 (PST) MIME-Version: 1.0 References: <20191213113510.GG15474@quack2.suse.cz> <20191213153306.30744-1-tranmanphong@gmail.com> In-Reply-To: <20191213153306.30744-1-tranmanphong@gmail.com> From: Joel Fernandes Date: Fri, 13 Dec 2019 10:11:50 -0800 Message-ID: Subject: Re: [PATCH V2] ext4: use rcu API in debug_print_tree To: Phong Tran Cc: Jan Kara , "Theodore Y. Ts'o" , adilger.kernel@dilger.ca, "Paul E. McKenney" , linux-ext4@vger.kernel.org, LKML , linux-kernel-mentees@lists.linuxfoundation.org, rcu , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Dec 13, 2019 at 7:39 AM 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] * > > Reviewed-by: Jan Kara > Signed-off-by: Phong Tran Thanks Phong! Looks like a real bug fix caught thanks to Sparse. So let us mark for stable as well? - Joel > --- > fs/ext4/block_validity.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > --- > change log: > V2: Add Reviewed-by: Jan Kara > > 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 >