Comments
Patch
@@ -1045,7 +1045,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
ubi_assert(ubi_num == ubi->ubi_num);
ubi_notify_all(ubi, UBI_VOLUME_REMOVED, NULL);
dbg_msg("detaching mtd%d from ubi%d", ubi->mtd->index, ubi_num);
- ubi_update_fastmap(ubi);
/*
* Before freeing anything, we have to stop the background thread to
@@ -1054,6 +1053,10 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
if (ubi->bgt_thread)
kthread_stop(ubi->bgt_thread);
+ /* If no fastmap is present on the FLASH write one. */
+ if (!ubi->fm)
+ ubi_update_fastmap(ubi);
+
/*
* Get a reference to the device in order to prevent 'dev_release()'
* from freeing the @ubi object.
Write a fastmap only if currently no fastmap is present on the FLASH. Also write it after the UBI thread has stopped. Signed-off-by: Richard Weinberger <richard@nod.at> --- drivers/mtd/ubi/build.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)