Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp648144img; Fri, 22 Mar 2019 05:54:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGKADycP3pwb11CDGFx8xi7Wc88mQzvQ4Ns1XGIzza/RpzcqjvTD6IApfOuFCh+oFmvNhB X-Received: by 2002:a63:4f61:: with SMTP id p33mr8744202pgl.303.1553259240500; Fri, 22 Mar 2019 05:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259240; cv=none; d=google.com; s=arc-20160816; b=xOfijzkskATFGZ99Yd+icIZlV1jVeI55DjYFiNcffFzGkFdkhSXmMHusIF/IaaAW70 A+2mHtM30rCIrE23gWCVmZC/iYhGGlx+cUYJRrdIaj1IUOvdSWhmk0XCpsqweh7oOM6N 3b1+TzFOpNNK562SR+b+7wCI1e76H+VCqw8Ph/9p2nS6ggMnkjESTdbmAwAvKNAr8oZS X6o210vo2UJ5GnCCacOy7LwQewQvnjh+UnXHnr7JCtVeOXdflEFcE9DSs0ALzq/veem0 m2gqHuHYvGX9sAbwi6BsvV8r2DyHhe5xPEXJIZxwQe3VlOqBdjDdWGuyWu8y9BQMXnG/ SL8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=upoeJ1BXEUrR72xVG42GZA7fKxe5bYSUMS+xRyZLDGk=; b=al3CtZV73VRbXO7v8hv5v4w5VNDoL2GJ3wkninJm+dHOljkjhfD2iTbMwvuOP366I9 5txjAmTnZ+pX/2k124OHT1TCXzhMrBD9mWuIZVNO3A73VYbfskRPp8wtyo62kv+AX+bk 9wP3WRVFzNToPsdHDT9FMXYSYfEgp8V75u9ZKRanaFr1TcK6B4FA6Whc6OAGlejL1Kcs y9jmKptKas1IdA8vDE2hcggB09Lq1+YSiBM65UxCd6xSzReCmmtf+ONSPsAot3FZcKaq /dnZmO/yN/CAguBe/4O0HThBfdUOM85mOf7S9wb5yrTI43G1oKorWgMOwYLhQ3UNCY/C 84DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="JRY/rxte"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 y7si6432371pfe.248.2019.03.22.05.53.45; Fri, 22 Mar 2019 05:54:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b="JRY/rxte"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387441AbfCVMv4 (ORCPT + 99 others); Fri, 22 Mar 2019 08:51:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733127AbfCVLyF (ORCPT ); Fri, 22 Mar 2019 07:54:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2406721916; Fri, 22 Mar 2019 11:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255644; bh=kwTdIg5YRjJgKUE7RHl6EmYrASBf7zczISOjhBIzy5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRY/rxteOTnr1DMzRUUH/yFrZO4i/3y6SY3637rwEizPjBAsdbxmor4DBASBsfvE+ GKdAioIqzzVdEyVhDdHr1xwdeYbOC0gLC6CDLj33XHJ9fiUoKGsXDH+ediMUYuliCh j84yuseOMlXnsrCDy5ZCgSp0z9DMFqZEjx2BbGI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "zhangyi (F)" , Theodore Tso , Jan Kara Subject: [PATCH 4.14 136/183] jbd2: fix compile warning when using JBUFFER_TRACE Date: Fri, 22 Mar 2019 12:16:04 +0100 Message-Id: <20190322111251.613794660@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111241.819468003@linuxfoundation.org> References: <20190322111241.819468003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: zhangyi (F) commit 01215d3edb0f384ddeaa5e4a22c1ae5ff634149f upstream. The jh pointer may be used uninitialized in the two cases below and the compiler complain about it when enabling JBUFFER_TRACE macro, fix them. In file included from fs/jbd2/transaction.c:19:0: fs/jbd2/transaction.c: In function ‘jbd2_journal_get_undo_access’: ./include/linux/jbd2.h:1637:38: warning: ‘jh’ is used uninitialized in this function [-Wuninitialized] #define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0) ^ fs/jbd2/transaction.c:1219:23: note: ‘jh’ was declared here struct journal_head *jh; ^ In file included from fs/jbd2/transaction.c:19:0: fs/jbd2/transaction.c: In function ‘jbd2_journal_dirty_metadata’: ./include/linux/jbd2.h:1637:38: warning: ‘jh’ may be used uninitialized in this function [-Wmaybe-uninitialized] #define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0) ^ fs/jbd2/transaction.c:1332:23: note: ‘jh’ was declared here struct journal_head *jh; ^ Signed-off-by: zhangyi (F) Signed-off-by: Theodore Ts'o Cc: stable@vger.kernel.org Reviewed-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/transaction.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1224,11 +1224,12 @@ int jbd2_journal_get_undo_access(handle_ struct journal_head *jh; char *committed_data = NULL; - JBUFFER_TRACE(jh, "entry"); if (jbd2_write_access_granted(handle, bh, true)) return 0; jh = jbd2_journal_add_journal_head(bh); + JBUFFER_TRACE(jh, "entry"); + /* * Do this first --- it can drop the journal lock, so we want to * make sure that obtaining the committed_data is done @@ -1339,15 +1340,17 @@ int jbd2_journal_dirty_metadata(handle_t if (is_handle_aborted(handle)) return -EROFS; - if (!buffer_jbd(bh)) { - ret = -EUCLEAN; - goto out; - } + if (!buffer_jbd(bh)) + return -EUCLEAN; + /* * We don't grab jh reference here since the buffer must be part * of the running transaction. */ jh = bh2jh(bh); + jbd_debug(5, "journal_head %p\n", jh); + JBUFFER_TRACE(jh, "entry"); + /* * This and the following assertions are unreliable since we may see jh * in inconsistent state unless we grab bh_state lock. But this is @@ -1381,9 +1384,6 @@ int jbd2_journal_dirty_metadata(handle_t } journal = transaction->t_journal; - jbd_debug(5, "journal_head %p\n", jh); - JBUFFER_TRACE(jh, "entry"); - jbd_lock_bh_state(bh); if (jh->b_modified == 0) {