fs/mount: move inode_lock to before bind to avoid deadlock(nsh and rptun)

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-07-05 23:07:16 +08:00 committed by Xiang Xiao
parent b733030532
commit c6815bba3b

View File

@ -298,7 +298,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
struct inode_search_s desc;
#endif
void *fshandle = NULL;
FAR void *fshandle = NULL;
int ret;
/* Verify required pointer arguments */
@ -442,6 +442,8 @@ int nx_mount(FAR const char *source, FAR const char *target,
}
#endif
inode_unlock();
/* On failure, the bind method returns -errorcode */
#if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT)
@ -449,6 +451,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
#else
ret = mops->bind(NULL, data, &fshandle);
#endif
DEBUGVERIFY(inode_lock() >= 0);
if (ret < 0)
{
/* The inode is unhappy with the driver for some reason. Back out