Patch "btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling" has been added to the 5.14-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

    btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling

to the 5.14-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:
     btrfs-replace-bug_on-in-btrfs_csum_one_bio-with-prop.patch
and it can be found in the queue-5.14 subdirectory.

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



commit 4f01fadd9d982316fb2b237a1befbfa39858bccf
Author: Qu Wenruo <wqu@xxxxxxxx>
Date:   Tue Aug 17 07:55:40 2021 +0800

    btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling
    
    [ Upstream commit bbc9a6eb5eec03dcafee266b19f56295e3b2aa8f ]
    
    There is a BUG_ON() in btrfs_csum_one_bio() to catch code logic error.
    It has indeed caught several bugs during subpage development.
    But the BUG_ON() itself will bring down the whole system which is
    an overkill.
    
    Replace it with a WARN() and exit gracefully, so that it won't crash the
    whole system while we can still catch the code logic error.
    
    Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
    Reviewed-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index df6631eefc65..5e8a56113b23 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -666,7 +666,18 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_inode *inode, struct bio *bio,
 
 		if (!ordered) {
 			ordered = btrfs_lookup_ordered_extent(inode, offset);
-			BUG_ON(!ordered); /* Logic error */
+			/*
+			 * The bio range is not covered by any ordered extent,
+			 * must be a code logic error.
+			 */
+			if (unlikely(!ordered)) {
+				WARN(1, KERN_WARNING
+			"no ordered extent for root %llu ino %llu offset %llu\n",
+				     inode->root->root_key.objectid,
+				     btrfs_ino(inode), offset);
+				kvfree(sums);
+				return BLK_STS_IOERR;
+			}
 		}
 
 		nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info,



[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