Message ID | 20200210132635.50072-2-houtao1@huawei.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2,1/2] UBI: Fastmap: free unused fastmap anchor peb during detach | expand |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index af2fe77eb66f..87ff4e51cb8c 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1879,7 +1879,8 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) goto out_free; #ifdef CONFIG_MTD_UBI_FASTMAP - ubi_ensure_anchor_pebs(ubi); + if (!ubi->ro_mode && !ubi->fm_disabled) + ubi_ensure_anchor_pebs(ubi); #endif return 0;
Don't produce the initial anchor PEB when ubi device is read-only or fastmap is disabled, else the resulting PEB will be unusable to any volume. Signed-off-by: Hou Tao <houtao1@huawei.com> --- drivers/mtd/ubi/wl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)