Patch "ubi: fastmap: Fix missed fm_anchor PEB in wear-leveling after disabling fastmap" has been added to the 6.2-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

    ubi: fastmap: Fix missed fm_anchor PEB in wear-leveling after disabling fastmap

to the 6.2-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:
     ubi-fastmap-fix-missed-fm_anchor-peb-in-wear-levelin.patch
and it can be found in the queue-6.2 subdirectory.

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



commit 2778766ee10d4fa090f6f45960792fcec4673f09
Author: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
Date:   Tue Aug 9 15:06:19 2022 +0800

    ubi: fastmap: Fix missed fm_anchor PEB in wear-leveling after disabling fastmap
    
    [ Upstream commit 76f9476ece445a07aeb72df9d896cd563fb5b50f ]
    
    After disabling fastmap(ubi->fm_disabled = 1), fastmap won't be updated,
    fm_anchor PEB is missed being scheduled for erasing. Besides, fm_anchor
    PEB may have smallest erase count, it doesn't participate wear-leveling.
    The difference of erase count between fm_anchor PEB and other PEBs will
    be larger and larger later on.
    
    In which situation fastmap can be disabled? Initially, we have an UBI
    image with fastmap. Then the image will be atttached without module
    parameter 'fm_autoconvert', ubi turns to full scanning mode in one
    random attaching process(eg. bad fastmap caused by powercut), ubi
    fastmap is disabled since then.
    
    Fix it by not getting fm_anchor if fastmap is disabled in
    ubi_refill_pools().
    
    Fetch a reproducer in [Link].
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216341
    Fixes: 4b68bf9a69d22d ("ubi: Select fastmap anchor PEBs considering ...")
    Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
    Signed-off-by: Richard Weinberger <richard@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
index 0ee452275578d..863f571f1adb5 100644
--- a/drivers/mtd/ubi/fastmap-wl.c
+++ b/drivers/mtd/ubi/fastmap-wl.c
@@ -146,13 +146,15 @@ void ubi_refill_pools(struct ubi_device *ubi)
 	if (ubi->fm_anchor) {
 		wl_tree_add(ubi->fm_anchor, &ubi->free);
 		ubi->free_count++;
+		ubi->fm_anchor = NULL;
 	}
 
-	/*
-	 * All available PEBs are in ubi->free, now is the time to get
-	 * the best anchor PEBs.
-	 */
-	ubi->fm_anchor = ubi_wl_get_fm_peb(ubi, 1);
+	if (!ubi->fm_disabled)
+		/*
+		 * All available PEBs are in ubi->free, now is the time to get
+		 * the best anchor PEBs.
+		 */
+		ubi->fm_anchor = ubi_wl_get_fm_peb(ubi, 1);
 
 	for (;;) {
 		enough = 0;



[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