fs/vfs/symlink: fix the inode information update outside of lock

For re-enter case, the inode information may unlock with not filled,
and get by other user. that lead to the error behavior.
Especially SMP scene.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen
2025-07-16 12:14:33 +08:00
committed by Xiang Xiao
parent 3650636e39
commit d3e5e756c5
+9 -5
View File
@@ -146,6 +146,15 @@ int symlink(FAR const char *path1, FAR const char *path2)
inode_lock();
ret = inode_reserve(path2, 0777, &inode);
if (ret >= 0)
{
/* Initialize the inode */
INODE_SET_SOFTLINK(inode);
inode->u.i_link = newpath2;
}
inode_unlock();
if (ret < 0)
{
@@ -153,11 +162,6 @@ int symlink(FAR const char *path1, FAR const char *path2)
errcode = -ret;
goto errout_with_search;
}
/* Initialize the inode */
INODE_SET_SOFTLINK(inode);
inode->u.i_link = newpath2;
}
/* Symbolic link successfully created */