Эх сурвалжийг харах

Fixed missing cache flush in lfs_migrate

The data written to the prog cache would make littlefs internally
consistent, but because this was never written to disk, the filesystem
would become unmountable.

Unfortunately, this wasn't found during testing because caches automatically
flush if data is written up to a program boundary (maybe this was a mistake?).

Found by rojer
Christopher Haster 6 жил өмнө
parent
commit
36973d8fd5
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  1. 5 0
      lfs.c

+ 5 - 0
lfs.c

@@ -4399,6 +4399,11 @@ int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg) {
                     goto cleanup;
                 }
             }
+
+            err = lfs_bd_flush(lfs, &lfs->pcache, &lfs->rcache, true);
+            if (err) {
+                goto cleanup;
+            }
         }
 
         // Create new superblock. This marks a successful migration!