Filesystem stack behaviour after force SD card eject
oliviu.gabor at intel.com
Fri Jul 5 21:05:22 UTC 2019
I have the following questions about using the FAT Filesystem stack
When interfacing with an SD Card, I do these steps:
- open a file on the successfully mounted device
- execute some RW operations on the file
- execute fflush() and fclose()
- manually eject the SD card from the slot
At some point during the shutdown procedure, The FS will call the
fat_fat32_update_fsinfo_sector() to syncronize the fsinfo sector.
Because I didn't manually fsync-ed the device before ejecting the SD
card, the FS will try to do it, issueing read/write commands to the
device, which is no longer present in the card slot. From this point
on, re-insertion of the SD card will fail until the SD controller is
1. should the user be the sole responsible for manually calling fsync()
after RW operations are performed?
2. is it normal that the FS stack crash in case card is ejected without
proper callin fsync()?
This issue does not occur if before ejecting I call fsync().
My point is that regardless if the user loses data in case card is
ejected, the FS stack should still need to be able to be reinitialized
after an unsuccessfull unmount/eject of the device.
More information about the devel