Open thewonderidiot opened 4 years ago
I do agree there is a disconnect here. Even in OSAL 4.2.1a the OS_mkfs and OS_initfs differed only in whether they formatted the newly-allocated ramdisk. I concur that it if OS_initfs fails then OS_mkfs will surely fail too, because it does the same exact steps plus an extra one (format).
All that being said, the approach I would take is to deprecate the OS_initfs/OS_mkfs calls. They don't really make sense for cross-platform applicability. The PSP should handle setting up the filesystems before even starting CFE and it can more easily do this job in a platform-specific manner.
My preference would be to remove this logic from ES and have the PSP set up all filesystems prior to the system starting. ES would just use the file systems however the PSP set them up.
@acudmore might have other thoughts on this?
@acudmore @jphickey any updates on this in the context of Caelum? If not are we OK deferring it?
I think it is sort of broken but it has been broken for quite some time, even before CFE 6.5/ OSAL 4.2. To fix it probably requires some finer-grained OSAL APIs - because mkfs/initfs do too much. (And fixing that part should be done with some new ID-based APIs in nasa/osal#719)
So while not exactly correct - AFAICT it hasn't been an issue that has actually interfered with operations at all. If OS_initfs()
fails after processor reset the ultimate path is to reboot again in a poweron reset mode. It's not ideal and could be cleaned up for sure, but given the Caelum timeframe maybe we continue living with it for now.
Describe the bug cFE 6.7.0+ still retain the original logic for setting up
/ram
. For poweron resets it works fine, however I think the logic may now be outdated for processor resets. On a processor reset, the flow is:OS_initfs()
.OS_mkfs()
.This logic may have made sense for older OSALs, but I don't see how it is helpful with OSAL 5.0+. In the new OSAL, both
OS_initfs()
andOS_mkfs()
callOS_FileSys_Initialize()
, with only the final argumentshould_format
differing. Both callOS_FileSysStartVolume_Impl()
to initialize the ram disk. ForOS_initfs()
, this is the only Impl function called. In theOS_mkfs()
case,should_format
is only checked ifOS_FileSysStartVolume_Impl()
succeeded, and only if it did, thenOS_FileSysFormatVolume_Impl()
is called.Because the two OSAL functions follow exactly the same path up until the check for
should_format
, it seems to me that ifOS_initfs()
fails, thenOS_mkfs()
cannot possibly succeed. In other worse, ifOS_initfs()
fails, then the cFE will inevitably panic instead of actually attempting to reformat/ram
.To Reproduce n/a
Expected behavior I think the intended logic in the cFE start up was to attempt to initialize an existing
/ram
filesystem on a processor reset, but reformat it if that failed and continue to boot. With the current OSAL, the only way I can see for that to work would be something like this:OS_initfs()
. If that fails, panic.OS_mount()
.OS_rmfs()
to remove it, and then callOS_mkfs()
.OS_mount()
. If that fails, panic.The other possible change for this to work as I think it is intended would be to make
OS_initfs()
fail if given an invalid filesystem. But as written for that to happen,OS_FileSysStartVolume_Impl()
would need to fail, which would also makeOS_mkfs()
always fail.Code snips cFE RAM disk creation on processor reset:
OS_FileSys_Initialize() logic:
System observed on:
Additional context It's very possible that I'm misunderstanding something here, in which case I apologize in advance for the noise!
Reporter Info Mike Stewart, Capella Space Corporation