Skip to content

Commit bd22811

Browse files
authored
[FIX]Locking for dfs_dentry_dump must be consistent with that of all other dentry functions.
1 parent f52fb60 commit bd22811

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

components/dfs/dfs_v2/src/dfs_dentry.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,16 +499,19 @@ int dfs_dentry_dump(int argc, char** argv)
499499
{
500500
int index = 0;
501501
struct dfs_dentry *entry = RT_NULL;
502+
rt_err_t ret = dfs_file_lock();
502503

503-
dfs_lock();
504-
for (index = 0; index < DFS_DENTRY_HASH_NR; index ++)
504+
if (ret == RT_EOK)
505505
{
506-
rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
506+
for (index = 0; index < DFS_DENTRY_HASH_NR; index ++)
507507
{
508-
printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
508+
rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
509+
{
510+
printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
511+
}
509512
}
513+
dfs_file_unlock();
510514
}
511-
dfs_unlock();
512515

513516
return 0;
514517
}

0 commit comments

Comments
 (0)