-
Notifications
You must be signed in to change notification settings - Fork 866
lfs_deorphan may enter infinity loop. #98
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
Comments
Hi @kneko715 thanks for opening an issue. You're right we should probably make that loop terminate. Although, littlefs should never really end up that state. What do you mean by hardware reset? Even if power is lost in the middle of a filesystem operation littlefs should be able to recover. If you still have the broken disk image around, could you send me a copy so I can see if I can figure out that cause? |
Patch here to break out of the inifinite loop #103 Thinking about possible failure cases, it's possible this could have happened if you interrupt lfs_format with a power failure. Do you think that might have been the source of the problem? |
Just a sidenote about the fix in #103 - the fixed behaviour won't be far from "infinite loop" on a very large device (several GB of SD card). |
@getky thanks for reply and creating patch. Sorry, broken disk image has already lost. "unexpected hardware reset" means unexpected power failure. The patch is effective for our device. Thank you. |
@FreddieChopin, good point. It seems like at least > 4 hours on a 4 GB SD card... It's the best solution I can think for the short term. At least in 2.0, format will only need to create 1 metadata pair, so it should be no longer possible to create this infinite loop during format. |
After some unexpected hardware reset, lfs_deorphan() entered an infinite loop and not return forever.
In that time, cwd.pair / cwd.head / cwd.d.tail took following value.
cwd.pair[0]=2; cwd.pair[1]=3;
cwd.head[0]=0; cwd.head[1]=0;
cwd.d.tail[0]=2; cwd.d.tail[1]=3;
I know root cause is unexpected hardware reset, but lfs_deorphan() should detect infinity loop and return error code for caller.
Thank you.
The text was updated successfully, but these errors were encountered: