@henrygab
I made 2 significant changes to the implementation of the storage ownership.
One is resolving the race condition. I believe it isn’t a big deal because it does not affect storage corruption. I believe that re ordering the flag latch_ejected with the main side effect solved it.
I also marked all of the variables in the file msc_disk.c that are accessed by both cores as volatile. It is more for the code readers/writers than for the compiler as it can’t falsely elide reads in the current version of the code
The second change concerns about seeing the RAM FS exposed temporarily to the USB host.
My repo with the proposed code changes are here I would be grateful if you could take a look.