Просмотр исходного кода

[FIX]Locking for dfs_dentry_dump must be consistent with that of all other dentry functions.

AngryProton 2 недель назад
Родитель
Сommit
7384a8e035
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      components/dfs/dfs_v2/src/dfs_dentry.c

+ 8 - 5
components/dfs/dfs_v2/src/dfs_dentry.c

@@ -499,16 +499,19 @@ int dfs_dentry_dump(int argc, char** argv)
 {
     int index = 0;
     struct dfs_dentry *entry = RT_NULL;
+    rt_err_t ret = dfs_file_lock();
 
-    dfs_lock();
-    for (index = 0; index < DFS_DENTRY_HASH_NR; index ++)
+    if (ret == RT_EOK)
     {
-        rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
+        for (index = 0; index < DFS_DENTRY_HASH_NR; index ++)
         {
-            printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
+            rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
+            {
+                printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
+            }
         }
+        dfs_file_unlock();
     }
-    dfs_unlock();
 
     return 0;
 }