From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9103128698 for ; Wed, 20 Sep 2023 11:52:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15739C433C8; Wed, 20 Sep 2023 11:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695210749; bh=o1KffXENgiohHCvgPczxBY7I33546zUOIx18S4Q8Mz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y8GedO2bKa+QRwxMQRatThj7OK60kYZHdnNxxhMMHFzCWpK3pYtELzhqNwOANIJBi VB/Sl72CIEoTXDXEXqOqp9uG/zST3i375z8ddlzBlhTvEKJQbNGKdcSm3/5G7eaxZ0 Pk/OFtWhAfOp7EVgd1jD9o+U7iJ4pxepPQblQl64= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Filipe Manana , Josef Bacik , David Sterba Subject: [PATCH 6.5 183/211] btrfs: check for BTRFS_FS_ERROR in pending ordered assert Date: Wed, 20 Sep 2023 13:30:27 +0200 Message-ID: <20230920112851.548592017@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112845.859868994@linuxfoundation.org> References: <20230920112845.859868994@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik commit 4ca8e03cf2bfaeef7c85939fa1ea0c749cd116ab upstream. If we do fast tree logging we increment a counter on the current transaction for every ordered extent we need to wait for. This means we expect the transaction to still be there when we clear pending on the ordered extent. However if we happen to abort the transaction and clean it up, there could be no running transaction, and thus we'll trip the "ASSERT(trans)" check. This is obviously incorrect, and the code properly deals with the case that the transaction doesn't exist. Fix this ASSERT() to only fire if there's no trans and we don't have BTRFS_FS_ERROR() set on the file system. CC: stable@vger.kernel.org # 4.14+ Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/ordered-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -635,7 +635,7 @@ void btrfs_remove_ordered_extent(struct refcount_inc(&trans->use_count); spin_unlock(&fs_info->trans_lock); - ASSERT(trans); + ASSERT(trans || BTRFS_FS_ERROR(fs_info)); if (trans) { if (atomic_dec_and_test(&trans->pending_ordered)) wake_up(&trans->pending_wait);