fix:解决disk资源未释放导致的资源泄露问题
主干存在该问题,还未解决. 因为对于热插入的sd卡,如果被其中一个线程操作拿住锁资源, 热插拔会导致disk资源状态未修改为UNUSED,造成资源泄露 现在修改为在拔出sd卡时,销毁disk锁资源之前,先将disk状态修改成UNUSED Close #I3ZOIO Signed-off-by: dong-yiqun <dongyiqun@huawei.com>
This commit is contained in:
parent
3e6bab5158
commit
d39ed70c65
|
@ -1279,20 +1279,20 @@ static INT32 DiskDeinit(los_disk *disk)
|
|||
#endif
|
||||
|
||||
disk->dev = NULL;
|
||||
DISK_UNLOCK(&disk->disk_mutex);
|
||||
|
||||
(VOID)unregister_blockdriver(disk->disk_name);
|
||||
if (disk->disk_name != NULL) {
|
||||
LOS_MemFree(m_aucSysMem0, disk->disk_name);
|
||||
disk->disk_name = NULL;
|
||||
}
|
||||
DISK_UNLOCK(&disk->disk_mutex);
|
||||
disk->disk_status = STAT_UNUSED;
|
||||
ret = pthread_mutex_destroy(&disk->disk_mutex);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("%s %d, mutex destroy failed, ret = %d\n", __FUNCTION__, __LINE__, ret);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
disk->disk_status = STAT_UNUSED;
|
||||
|
||||
return ENOERR;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue