Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3864129pxb; Tue, 17 Nov 2020 05:41:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/GKpqR9ttVkXjTV/+COmUBIBj5zGowpK4X39JeGhPmCM1i0p6jONomu51Tz2COq0xCsId X-Received: by 2002:a17:906:3a8d:: with SMTP id y13mr2555617ejd.542.1605620513629; Tue, 17 Nov 2020 05:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620513; cv=none; d=google.com; s=arc-20160816; b=eMBX+T3otRn8dRWVRTg8N9K5C14gLb2Ra1LDM+V9BefX56bQwjR1A6jThEP8DirX+K Zn257LLlMwbotJ2PlxrC/0Cw+OiSEkGguEY9WO5mQ+KJBwVE0uf4X/DBRWygy8xKZFar C4J1UqPj0BFViRHHzVQzMLusVlyJIaeM/TjU1PU8JB4b/Be9mqL8mSeGEEoscSUQWuDe 7LQeO+VqDCm+R3TAv21R2Sf+kmj32OpXhjh+GCJ8oHrhLdnZ8fuYJmS2AHSXfoEpBsrT CMDHBMqD9d3XgWeA/UtN/rHQgeAZUQxxAm71bkEYAOk8f9VSuzE0pOkHAqtY8+jBoWGZ /oYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PBSUs6x5lqNi8tDWKNL885BCYlkDKu62skdicgZvuMA=; b=earyL1K6yKjhnfNtJNo/NlTiuAbDr6qFEAaE2GXgQuNN9E4C5yhoSngjmbDqgnXgZB PJ06dAe8DAurp4JcVIZNUwn4HJn1E/75FrxaHfJ6FkvMAc1e336M6E2mHo7/K0wrBTHx e7XmkKzHIrEDvbpefjTFxY8jMPPq9NBNpWHFmnLS1DlduzIUJ4KWx89R642HSblwQSm9 k2MXDCCGzc1Xo6flF/ZNLgZFf8Q5huqcemQQS/80vJ6sv+q0NA5Yfux+7Mf91OLo2Oxn DdjCU804HppS2HQcZ/Spn+z9EYQ/uIN67d5OafvgjPfKiCQRHk52+gooxrhw4CjUpZrp Cyfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JWy+DRX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si5078321ejb.73.2020.11.17.05.41.31; Tue, 17 Nov 2020 05:41:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JWy+DRX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732815AbgKQNkK (ORCPT + 99 others); Tue, 17 Nov 2020 08:40:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:51956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732592AbgKQNkG (ORCPT ); Tue, 17 Nov 2020 08:40:06 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 431C120870; Tue, 17 Nov 2020 13:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620405; bh=3XWmxn9U1xhRWFyf9fS5ZKgz6mrzoLAAH9/EoQzrKbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWy+DRX2Yw0lkZ3K8QOQgFpLW6qmb86lIX6OjfgWwZFIDEU3s1sthUcCb1F0NZ4JB d9m9MCErCztJrlGN/K75MKR/rMUyzTfHJPCoKLorjJsJg6JuHQXzmwle/7/fLsYa4l WcY29b11HJJhs9XVOTZt/5M3mvQq5v/CfuCjLnHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Theodore Tso Subject: [PATCH 5.9 207/255] jbd2: fix up sparse warnings in checkpoint code Date: Tue, 17 Nov 2020 14:05:47 +0100 Message-Id: <20201117122149.006290360@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Theodore Ts'o commit 05d5233df85e9621597c5838e95235107eb624a2 upstream. Add missing __acquires() and __releases() annotations. Also, in an "this should never happen" WARN_ON check, if it *does* actually happen, we need to release j_state_lock since this function is always supposed to release that lock. Otherwise, things will quickly grind to a halt after the WARN_ON trips. Fixes: 96f1e0974575 ("jbd2: avoid long hold times of j_state_lock...") Cc: stable@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/checkpoint.c | 2 ++ fs/jbd2/transaction.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -106,6 +106,8 @@ static int __try_to_free_cp_buf(struct j * for a checkpoint to free up some space in the log. */ void __jbd2_log_wait_for_space(journal_t *journal) +__acquires(&journal->j_state_lock) +__releases(&journal->j_state_lock) { int nblocks, space_left; /* assert_spin_locked(&journal->j_state_lock); */ --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -195,8 +195,10 @@ static void wait_transaction_switching(j DEFINE_WAIT(wait); if (WARN_ON(!journal->j_running_transaction || - journal->j_running_transaction->t_state != T_SWITCH)) + journal->j_running_transaction->t_state != T_SWITCH)) { + read_unlock(&journal->j_state_lock); return; + } prepare_to_wait(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); read_unlock(&journal->j_state_lock);