Patch "Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure"" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure"

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-btrfs-call-__btrfs_remove_free_space_cache_locked-on.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From cf21d7d95f6b2ad032412f99603f936ed2111c32 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Oct 2022 12:24:13 +0200
Subject: Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure"

From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

This reverts commit 3ea7c50339859394dd667184b5b16eee1ebb53bc which is
commit 8a1ae2781dee9fc21ca82db682d37bea4bd074ad upstream.

It causes many reported btrfs issues, so revert it for now.

Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
Cc: David Sterba <dsterba@xxxxxxxx>
Cc: Sasha Levin <sashal@xxxxxxxxxx>
Reported-by: Tobias Powalowski <tobias.powalowski@xxxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/CAHfPjO8G1Tq2iJDhPry-dPj1vQZRh4NYuRmhHByHgu7_2rQkrQ@xxxxxxxxxxxxxx
Reported-by: Ernst Herzberg <earny@xxxxxxxx>
Link: https://lore.kernel.org/r/8196dd88-4e11-78a7-8f96-20cf3e886e68@xxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/btrfs/free-space-cache.c |   53 ++++++++++++++++----------------------------
 1 file changed, 20 insertions(+), 33 deletions(-)

--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -48,25 +48,6 @@ static void bitmap_clear_bits(struct btr
 			      struct btrfs_free_space *info, u64 offset,
 			      u64 bytes, bool update_stats);
 
-static void __btrfs_remove_free_space_cache_locked(
-				struct btrfs_free_space_ctl *ctl)
-{
-	struct btrfs_free_space *info;
-	struct rb_node *node;
-
-	while ((node = rb_last(&ctl->free_space_offset)) != NULL) {
-		info = rb_entry(node, struct btrfs_free_space, offset_index);
-		if (!info->bitmap) {
-			unlink_free_space(ctl, info, true);
-			kmem_cache_free(btrfs_free_space_cachep, info);
-		} else {
-			free_bitmap(ctl, info);
-		}
-
-		cond_resched_lock(&ctl->tree_lock);
-	}
-}
-
 static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
 					       struct btrfs_path *path,
 					       u64 offset)
@@ -900,14 +881,7 @@ out:
 	return ret;
 free_cache:
 	io_ctl_drop_pages(&io_ctl);
-
-	/*
-	 * We need to call the _locked variant so we don't try to update the
-	 * discard counters.
-	 */
-	spin_lock(&ctl->tree_lock);
-	__btrfs_remove_free_space_cache_locked(ctl);
-	spin_unlock(&ctl->tree_lock);
+	__btrfs_remove_free_space_cache(ctl);
 	goto out;
 }
 
@@ -1033,13 +1007,7 @@ int load_free_space_cache(struct btrfs_b
 		if (ret == 0)
 			ret = 1;
 	} else {
-		/*
-		 * We need to call the _locked variant so we don't try to update
-		 * the discard counters.
-		 */
-		spin_lock(&tmp_ctl.tree_lock);
 		__btrfs_remove_free_space_cache(&tmp_ctl);
-		spin_unlock(&tmp_ctl.tree_lock);
 		btrfs_warn(fs_info,
 			   "block group %llu has wrong amount of free space",
 			   block_group->start);
@@ -3002,6 +2970,25 @@ static void __btrfs_return_cluster_to_fr
 	btrfs_put_block_group(block_group);
 }
 
+static void __btrfs_remove_free_space_cache_locked(
+				struct btrfs_free_space_ctl *ctl)
+{
+	struct btrfs_free_space *info;
+	struct rb_node *node;
+
+	while ((node = rb_last(&ctl->free_space_offset)) != NULL) {
+		info = rb_entry(node, struct btrfs_free_space, offset_index);
+		if (!info->bitmap) {
+			unlink_free_space(ctl, info, true);
+			kmem_cache_free(btrfs_free_space_cachep, info);
+		} else {
+			free_bitmap(ctl, info);
+		}
+
+		cond_resched_lock(&ctl->tree_lock);
+	}
+}
+
 void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl)
 {
 	spin_lock(&ctl->tree_lock);


Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are

queue-6.0/revert-btrfs-call-__btrfs_remove_free_space_cache_locked-on.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux