fs/fs_initialize.c: Sync will only be executed when the add is in reboot state.

In the last change, the assert behavior test was not considered. Therefore, in this change, sync will be performed only when SYS_RESTART/SYS_DOWN situation occurs, avoiding unpredictable results caused by handling locks or semaphores in interrupts.
This commit is contained in:
chenrun1 2023-03-09 16:34:22 +08:00 committed by Petro Karashchenko
parent 7485f1c81d
commit 01cfb3b2db

View File

@ -40,7 +40,11 @@
static int sync_reboot_handler(FAR struct notifier_block *nb,
unsigned long action, FAR void *data)
{
sync();
if (action == SYS_DOWN || action == SYS_RESTART)
{
sync();
}
return 0;
}