Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp659947img; Fri, 22 Mar 2019 06:06:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6yreiYSMF5bdPRr0VgYw8yT9wonfaRsjaXCLl/v1t0q0LYCIlZ/LFp2krNMKy1zzyM5+S X-Received: by 2002:a63:c242:: with SMTP id l2mr8870762pgg.138.1553259990333; Fri, 22 Mar 2019 06:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259990; cv=none; d=google.com; s=arc-20160816; b=CzdE3ONH/GuqL45TWr57Wkhb48reKw9q02d6jT9m5Mi3opTzw3R0IFyoiCBZp2hZ6e Mq+BEh93fpGTK+Jd3UtczXxlO35bak+xWGVJVJq+XSQHjfPGojp8EAs8WakzH8ETwXgD wBfXRpXpid6CXuSXNR/NxLWVFkBEXtzzXyXWMa5N3VrwkqOmcW4+6HVKBbUQpTqubY7g YzPnEoH+KG+ri53QNPFFXJzlFvSvldrmcRTjOnh0j2GxIpfbh9i1Y2dctjPQR9CCU2zx NGf/KfrmDrRmTaorzNusVQni+i/4ojq0fPvN9OgCM/KU8x11OBXUwLAhQI7WkWXUrwoO m/WA== 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=h05L8lToKGJWZ83I6h/fjPaegIb4k3qmNa/pigYPfRo=; b=MBnRONYSX0rIhHE3ECT56sm/1Z2HeVBAeOHEIrqpYZAm/nKDgusyFCnSSB23UuOQK7 7Fwi9Va2z/35yNFAXaEaN/KIigp1OLis9G7xqRBOnZPiYrypM7Hfn5kX+kNXl52AYqE9 4CmBe88Q3wSeEqXtePT76ZsXKiVhAJESLxiISNsjcm7UuJuKFinvdGTI8EaP7MlRn9lX 0/9TBdmv2jyyGEa9bwkkf5rShQYXKtAFwWetgvYnPI8gV06LRTq0L5HlllKkf0Zqy+kF aKrtapDLdicdUHLzJd6l3iXUayq+kbnrVBuNgbKZPECooRNUqmzpza40WTN5TGkKT2Lf r9qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=07yWAicm; 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 r201si6125533pgr.445.2019.03.22.06.06.12; Fri, 22 Mar 2019 06:06:30 -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=07yWAicm; 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 S1731045AbfCVLiz (ORCPT + 99 others); Fri, 22 Mar 2019 07:38:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:40436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731035AbfCVLix (ORCPT ); Fri, 22 Mar 2019 07:38:53 -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 6BB112183E; Fri, 22 Mar 2019 11:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254731; bh=DXoT2AOza4eLUNi7essRUblbdjdDiDYU4vqS5hul7RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07yWAicm4uyEdwFNjK+0hYXbvoVYPdD9Vnvyebc/ajxAdIF8wgxXjrMacokIBR4Or 4vGyi14t9OzfzzZY8tu6UtkRK1luKXxbp9vyseIh/aHPylFlGiJ1Qs3asdXCdxxiAp DZlHNo1DSSo1ez9yF0VmTR0KcLVJ7UAgG9fS/S0M= 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.4 208/230] jbd2: fix compile warning when using JBUFFER_TRACE Date: Fri, 22 Mar 2019 12:15:46 +0100 Message-Id: <20190322111251.486122442@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111236.796964179@linuxfoundation.org> References: <20190322111236.796964179@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.4-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 @@ -1215,11 +1215,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 @@ -1336,15 +1337,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 @@ -1378,9 +1381,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) {