Patch "ext4: get block from bh in ext4_free_blocks for fast commit replay" has been added to the 5.10-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

    ext4: get block from bh in ext4_free_blocks for fast commit replay

to the 5.10-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:
     ext4-get-block-from-bh-in-ext4_free_blocks-for-fast-commit-replay.patch
and it can be found in the queue-5.10 subdirectory.

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


>From 11b6890be0084ad4df0e06d89a9fdcc948472c65 Mon Sep 17 00:00:00 2001
From: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Date: Sat, 3 Jun 2023 23:03:16 +0800
Subject: ext4: get block from bh in ext4_free_blocks for fast commit replay

From: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>

commit 11b6890be0084ad4df0e06d89a9fdcc948472c65 upstream.

ext4_free_blocks will retrieve block from bh if block parameter is zero.
Retrieve block before ext4_free_blocks_simple to avoid potentially
passing wrong block to ext4_free_blocks_simple.

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxx
Reviewed-by: Ojaswin Mujoo <ojaswin@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230603150327.3596033-9-shikemeng@xxxxxxxxxxxxxxx
Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/ext4/mballoc.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5634,12 +5634,6 @@ void ext4_free_blocks(handle_t *handle,
 
 	sbi = EXT4_SB(sb);
 
-	if (sbi->s_mount_state & EXT4_FC_REPLAY) {
-		ext4_free_blocks_simple(inode, block, count);
-		return;
-	}
-
-	might_sleep();
 	if (bh) {
 		if (block)
 			BUG_ON(block != bh->b_blocknr);
@@ -5647,6 +5641,13 @@ void ext4_free_blocks(handle_t *handle,
 			block = bh->b_blocknr;
 	}
 
+	if (sbi->s_mount_state & EXT4_FC_REPLAY) {
+		ext4_free_blocks_simple(inode, block, count);
+		return;
+	}
+
+	might_sleep();
+
 	if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
 	    !ext4_inode_block_valid(inode, block, count)) {
 		ext4_error(sb, "Freeing blocks not in datazone - "


Patches currently in stable-queue which might be from shikemeng@xxxxxxxxxxxxxxx are

queue-5.10/ext4-fix-wrong-unit-use-in-ext4_mb_new_blocks.patch
queue-5.10/ext4-fix-wrong-unit-use-in-ext4_mb_clear_bb.patch
queue-5.10/ext4-get-block-from-bh-in-ext4_free_blocks-for-fast-commit-replay.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