Skip to content

Commit

Permalink
files_getlist:Handling the situation when tcb's grouplist is empty
Browse files Browse the repository at this point in the history
Summary:
  When the device reboot through reboot_notify to notify the task fsync time, if there is a task in the exit process, there may be priority robbed off the phenomenon, and at this time the group->tg_filelist crefs has been 0, resulting in the ASSERT

Signed-off-by: chenrun1 <[email protected]>
  • Loading branch information
crafcat7 committed Oct 8, 2024
1 parent 99b364c commit 677b27b
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions fs/inode/fs_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ static void task_fssync(FAR struct tcb_s *tcb, FAR void *arg)
int j;

list = files_getlist(tcb);
if (list == NULL)
{
return;
}

for (i = 0; i < list->fl_rows; i++)
{
for (j = 0; j < CONFIG_NFILE_DESCRIPTORS_PER_BLOCK; j++)
Expand Down Expand Up @@ -442,12 +447,19 @@ void files_dumplist(FAR struct filelist *list)

FAR struct filelist *files_getlist(FAR struct tcb_s *tcb)
{
FAR struct filelist *list = &tcb->group->tg_filelist;
FAR struct filelist *list;

DEBUGASSERT(list->fl_crefs >= 1);
list->fl_crefs++;
if (tcb->group != NULL)
{
list = &tcb->group->tg_filelist;
if (list->fl_crefs > 0)
{
list->fl_crefs++;
return list;
}
}

return list;
return NULL;
}

/****************************************************************************
Expand Down

0 comments on commit 677b27b

Please sign in to comment.