-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fault tolerance issue in FAT12 #14
Comments
Hi, |
@smithBraun , thanks for reporting the issue. We are working on reproducing the issue and will keep you updated. |
HI @TiejunMS |
Similar issue can happen when FAT chain is written when _fx_utility_FAT_flush called by _fx_utility_FAT_entry_write (when FX_FAULT_TOLERANT_STATE_SET_FAT_CHAIN) |
Hi @TiejunMS , |
@smithBraun , did you encounter this issue by analysis or run into this issue in application? Here is my analysis on this issue. Let's say the bytes per sector is 512 and sector per cluster is 1. On FAT12, each sector can hold 341 FAT entries. The original FAT chain of the file is as below. When this file is deleted, in fx_fault_tolerant_cleanup_FAT_chain.c, all these three FAT entries will be cached and deleted from back to front. FAT entry 800 will be deleted first. Due to the sector of FAT entry 400 is different from 800, changes to FAT entries (from 800->END to 800->FREE) will be flushed to disk. If the power off happens before deleting FAT entry 400, the FAT chain will be like this. On next power on, we will do nothing to FAT entry 800 due to it is already freed. Only FAT entries 700 and 400 will be deleted.
I'm not sure about the entry pointing to wrong place. Did you mean FAT entry 400 still pointers to 800? If this example is not suitable for the issue you described, could you share the FAT chain and where the power off happens during deleting the FAT chain? |
@TiejunMS sorry for being not clear enough, I see you understand wrongly the bug I described. did you encounter this issue by analysis or run into this issue in application If this example is not suitable for the issue you described, could you share the FAT chain and where the power off happens during deleting the FAT chain? You can simulate the power down in - |
@smithBraun , thanks for sharing the details! I confirm this is an issue and will come with a solution. I will keep you posted. |
Great, thanks @TiejunMS . |
Hi @TiejunMS , |
@smithBraun , the fix is working in progress. Could you send an email to Azure RTOS support ([email protected])? Once it is ready for test, I can share the source code with you. |
background:
Upon deleting file, there is deletion of the FAT chain of the file from the end to start (in _fx_utility_FAT_flush called by _fx_fault_tolerant_cleanup_FAT_chain).
upon power down, the fault tolerance know just the beginning of the FAT chain, and it searching again till the end of it (which may be shorter now if before the power down it started to be deleted) and continue deleting from end to beginning.
the bug:
in FAT12, FAT entries may be divided into 2 sectors, if the power down occur between writing one sector to the other, after the power down when looking on the chain this entry may point on wrong place, which will cause erasing another non related entries.
The text was updated successfully, but these errors were encountered: