bugfix:the inode may have been removed by other core in SMP

The inode may has been unlinked from the tree in other core, but it is not yet freed.

Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
guohao15
2025-04-09 11:34:16 +08:00
committed by Alan C. Assis
parent 560aed72a4
commit 99ca0dbf9d
2 changed files with 12 additions and 9 deletions
+6 -4
View File
@@ -153,12 +153,14 @@ int file_mq_unlink(FAR const char *mq_name)
ret = inode_remove(fullpath);
/* inode_remove() should always fail with -EBUSY because we hae a reference
* on the inode. -EBUSY means that the inode was, indeed, unlinked but
* thatis could not be freed because there are references.
/* The inode may has been unlinked from the tree in other core,
* but it is not yet freed.
*/
DEBUGASSERT(ret >= 0 || ret == -EBUSY);
if (ret < 0 && ret != -EBUSY)
{
goto errout_with_lock;
}
/* Now we do not release the reference count in the normal way (by calling
* inode release. Rather, we call mq_inode_release(). mq_inode_release
+6 -5
View File
@@ -118,13 +118,14 @@ int nxsem_unlink(FAR const char *name)
ret = inode_remove(fullpath);
/* inode_remove() should always fail with -EBUSY because we hae a reference
* on the inode. -EBUSY means that the inode was, indeed, unlinked but
* thatis could not be freed because there are references.
/* The inode may has been unlinked from the tree in other core,
* but it is not yet freed.
*/
DEBUGASSERT(ret >= 0 || ret == -EBUSY);
UNUSED(ret);
if (ret < 0 && ret != -EBUSY)
{
goto errout_with_lock;
}
/* Now we do not release the reference count in the normal way (by calling
* inode release. Rather, we call sem_close(). sem_close will decrement