Ticket #5719 (closed defect: fixed)
Deleting a large file from a USB stick copies it into NAND (often filling NAND)
|Reported by:||gnu||Owned by:||tomeu|
|Keywords:||review?||Cc:||wmb@…, jg, mstone|
|Deployments affected:||Blocked By:|
WARNING: If your file is larger than the amount of free NAND space you have left, this will leave your laptop unbootable, due to #5317. It can be recovered by a full wipe, so it's not a total brick, but you lose all your data.
Put a 200+MB file onto a FAT-formatted USB key on a real Linux machine (I used a copy of os542.img called "deleteme.pls"). Unmount it and move it to an XO. Go to the terminal. Do "df -h". Note the free space in your NAND.
Now go to the Journal, click on the USB logo, find the file, go into its detail view, and press the "-" in a circle to "Erase" the file. Watch it take a long time; watch the USB access light blink a lot.
Go back to the terminal while it's doing this. Run "df -h" again. Note that the NAND is filling up.
I did strace on the sugar-datastore process; it was in a read/write copy loop. J'accuse!
After it was done, I noticed:
- The file was still there on the USB key, undeleted.
- There were TWO copies of it in /home/olpc/.sugar/default/data, one complete copy called "deleteme.pls", and one partial copy called "deleteme(1).pls".
- I had only 11 Mbytes free in my NAND.
- The Journal showed no change from before I tried deleting the file - neither in the USB page nor in the Journal page.
I was VERY CAREFUL to remove those two files from where Sugar copied them, and check "df -h" again, before rebooting my system.
Deleting a file should never INCREASE the amount of space occupied. (Other than possibly adding tiny housekeeping records.)
Deleting a file from one filesystem (e.g. USB) should never result in copying that file to another filesystem (e.g. NAND).
Deleting a file should actually remove the file from the place that it was deleted from.
This bug was reported by donor Pamela Dallas as a suspicion (rt# 2962), and verified by me (John Gilmore) on build 650 on a B4.