[PATCH 03/13] ubi: auto re-size after UBI thread is ready

Richard Weinberger richard at nod.at
Mon May 30 05:04:24 PDT 2016


As all work is now done within the UBI thread
re-size cannot performed before UBI thread is ready.

Signed-off-by: Richard Weinberger <richard at nod.at>
---
 drivers/mtd/ubi/build.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index ee3c833..1448f05 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -989,12 +989,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
 		goto out_free;
 	}
 
-	if (ubi->autoresize_vol_id != -1) {
-		err = autoresize(ubi, ubi->autoresize_vol_id);
-		if (err)
-			goto out_detach;
-	}
-
 	err = uif_init(ubi, &ref);
 	if (err)
 		goto out_detach;
@@ -1039,10 +1033,18 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
 	wake_up_process(ubi->bgt_thread);
 	spin_unlock(&ubi->wl_lock);
 
+	if (ubi->autoresize_vol_id != -1) {
+		err = autoresize(ubi, ubi->autoresize_vol_id);
+		if (err)
+			goto out_kthread;
+	}
+
 	ubi_devices[ubi_num] = ubi;
 	ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
 	return ubi_num;
 
+out_kthread:
+	kthread_stop(ubi->bgt_thread);
 out_debugfs:
 	ubi_debugfs_exit_dev(ubi);
 out_uif:
-- 
2.7.3




More information about the linux-mtd mailing list