notify:do not noitfy when in signal context

Some signal handler may opreate files, that will cause deadlock
when the thread holding file system lock

Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
guohao15 2024-02-01 16:45:41 +08:00 committed by Xiang Xiao
parent 048415f407
commit 3df638971f

View File

@ -40,6 +40,7 @@
#include <libgen.h> #include <libgen.h>
#include "inode/inode.h" #include "inode/inode.h"
#include "sched/sched.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -879,11 +880,14 @@ static void notify_queue_path_event(FAR const char *path, uint32_t mask)
static int notify_check_inode(FAR struct file *filep) static int notify_check_inode(FAR struct file *filep)
{ {
FAR struct tcb_s *tcb = this_task();
/* We only apply notify on mount points (f_inode won't be NULL). */ /* We only apply notify on mount points (f_inode won't be NULL). */
if (!INODE_IS_MOUNTPT(filep->f_inode) && if ((tcb->flags & TCB_FLAG_SIGNAL_ACTION) ||
(!INODE_IS_MOUNTPT(filep->f_inode) &&
!INODE_IS_PSEUDODIR(filep->f_inode) && !INODE_IS_PSEUDODIR(filep->f_inode) &&
!INODE_IS_DRIVER(filep->f_inode)) !INODE_IS_DRIVER(filep->f_inode)))
{ {
return -EBADF; return -EBADF;
} }