Fix Multiple close fd when SMP enable
task1: The refs is 0 but the inode has not been released task2: Executing files_duplist, get filep with refs is zero, but the inode has not yet released. [ 0.530600] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: backtrace: [ 0.530800] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4045172>] backtrace_unwind+0x241/0x244 [ 0.531200] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4009150>] sched_backtrace+0x27/0x4c [ 0.531500] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x402f0fa>] sched_dumpstack+0x3d/0xa0 [ 0.531700] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4002c90>] _assert+0x1e3/0x564 [ 0.532000] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x40221f6>] __assert+0x19/0x24 [ 0.532200] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x41fe376>] tcp_stop_monitor+0x61/0x6c [ 0.532500] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x41fe19e>] tcp_close+0xad/0xdc [ 0.532700] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x41ecc18>] inet_close+0x7b/0x8c [ 0.533000] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x41ec374>] psock_close+0x27/0x70 [ 0.533300] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x420b68e>] sock_file_close+0x15/0x3c [ 0.533500] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4206704>] file_close+0x1f/0x80 [ 0.533800] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4205278>] files_duplist+0x39f/0x45c [ 0.534100] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x4000e3c>] group_setuptaskfiles+0x57/0xc0 [ 0.534300] [CPU1] [ 6] [ ALERT] [ap] sched_dumpstack: [ 6] [<0x400bc6c>] nxtask_init+0x5b/0x13c Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
This commit is contained in:
parent
744da99250
commit
0b084308ba
|
@ -73,7 +73,18 @@ static FAR struct file *files_fget_by_index(FAR struct filelist *list,
|
|||
filep = &list->fl_files[l1][l2];
|
||||
if (filep->f_inode != NULL)
|
||||
{
|
||||
filep->f_refs++;
|
||||
/* When the reference count is zero but the inode has not yet been
|
||||
* released, At this point we should return a null pointer
|
||||
*/
|
||||
|
||||
if (filep->f_refs == 0)
|
||||
{
|
||||
filep = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
filep->f_refs++;
|
||||
}
|
||||
}
|
||||
else if (new == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue