Ruka-CFW / rk3128-cfw

*** DEPRECATED - DON'T USE *** Rockchip RK3128 Custom Firmware for Powkiddy A12/A13 & AIWO retro-consoles
Other
44 stars 14 forks source link

File changes do not always sync #6

Closed alpgarcia closed 3 years ago

alpgarcia commented 3 years ago

When a file is modified either in the sd card or in the userdata partition, changes are not always persisted.

As a workaround, forcing sync explicitly works.

It is worth exploring whether the filesystems are mounted using the sync flag and if they aren't, test whether it could solve the problem without affecting performance.

alpgarcia commented 3 years ago

I did some tests. I added the following script to the sd card: create_files.sh:

#!/bin/sh

for i in 1 2 3 4 5; do
  echo ${i} >> ${i}
done

The test consisted of the following steps:

  1. Power on the console.
  2. cd /sdcard
  3. ./created_files.sh
  4. Check the files with ls and cat.
  5. Power off via button.
  6. Power on the console again.
  7. cd /sdcard
  8. Check the files with ls and cat.
  9. Reset the test, rm 1 2 3 4 5 (or whatever files were actually created).
  10. Power off the console.

I repeated it 5 times. Step 4 always returned 5 files with their expected content. Step 8 returned a different set of unexpected results:

Then, I did the same but instead of powering off via button in step 5, I powered off the console via poweroff command. Again 5 times:

At this point seems to be clear that poweroff command works as expected and the buffers are flushed during the shutdown process.

Next test was repeating the same initial steps as described above, but adding the following one before step 2:

  1. Power on the console. 1.1. mount -o remount,sync /mnt/sdcard/
  2. cd /sdcard
  3. ./created_files.sh
  4. Check the files with ls and cat.
  5. Power off via button.
  6. Power on the console again.
  7. cd /sdcard
  8. Check the files with ls and cat.
  9. Reset the test, rm 1 2 3 4 5 (or whatever files were actually created).
  10. Power off the console.

The results were:

So the next steps are: