mirror of
https://github.com/apache/nuttx.git
synced 2026-10-07 14:25:25 +00:00
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:
parent
3650636e39
commit
d3e5e756c5
1 changed files with 9 additions and 5 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue