This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 048415f4075a1d6b036b4241c1d8fdee5e990544 Author: guohao15 <[email protected]> AuthorDate: Tue Jan 30 10:44:12 2024 +0800 notify: change inode type check out of the lock Signed-off-by: guohao15 <[email protected]> --- fs/notify/inotify.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/notify/inotify.c b/fs/notify/inotify.c index 8053ac62da..f74d15a087 100644 --- a/fs/notify/inotify.c +++ b/fs/notify/inotify.c @@ -870,16 +870,16 @@ static void notify_queue_path_event(FAR const char *path, uint32_t mask) } /**************************************************************************** - * Name: notify_get_path + * Name: notify_check_inode * * Description: - * Get the path from the file pointer. + * Check if the inode is a mount point. * ****************************************************************************/ -static int notify_get_path(FAR struct file *filep, FAR char *path) +static int notify_check_inode(FAR struct file *filep) { - /* We only apply file lock 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) && !INODE_IS_PSEUDODIR(filep->f_inode) && @@ -888,7 +888,7 @@ static int notify_get_path(FAR struct file *filep, FAR char *path) return -EBADF; } - return file_fcntl(filep, F_GETPATH, path); + return OK; } /**************************************************************************** @@ -904,8 +904,14 @@ static inline void notify_queue_filep_event(FAR struct file *filep, { int ret; + ret = notify_check_inode(filep); + if (ret < 0) + { + return; + } + nxmutex_lock(&g_inotify_hash_lock); - ret = notify_get_path(filep, g_inotify_temp_buffer[0]); + ret = file_fcntl(filep, F_GETPATH, g_inotify_temp_buffer[0]); if (ret < 0) { nxmutex_unlock(&g_inotify_hash_lock);
