list: change locking discipline
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
2cf76fd225
commit
071a5651e0
11 changed files with 61 additions and 15 deletions
|
|
@ -30,6 +30,8 @@ int dirent_populate_children(dirent_t *dir)
|
|||
return n;
|
||||
}
|
||||
|
||||
list_lock(&inode->dirents);
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
dirent_t *dent = dents + i;
|
||||
dirent_t *insert = dirent_dup(dent);
|
||||
|
|
@ -45,6 +47,7 @@ int dirent_populate_children(dirent_t *dir)
|
|||
}
|
||||
}
|
||||
|
||||
list_unlock(&inode->dirents);
|
||||
write_unlock(&inode->rwlock);
|
||||
kfree(dents);
|
||||
return 0;
|
||||
|
|
@ -62,6 +65,7 @@ cleanup:
|
|||
item = next;
|
||||
}
|
||||
}
|
||||
list_unlock(&inode->dirents);
|
||||
write_unlock(&inode->rwlock);
|
||||
kfree(dents);
|
||||
return -ENOMEM;
|
||||
|
|
@ -121,6 +125,8 @@ inode_t *inode_create(void)
|
|||
|
||||
void inode_free(inode_t *inode)
|
||||
{
|
||||
list_lock(&inode->dirents);
|
||||
|
||||
while (inode->dirents.head) {
|
||||
list_item_t *item = inode->dirents.head;
|
||||
dirent_t *dent = item->ptr;
|
||||
|
|
@ -132,6 +138,8 @@ void inode_free(inode_t *inode)
|
|||
}
|
||||
}
|
||||
|
||||
list_unlock(&inode->dirents);
|
||||
|
||||
kfree(inode->data);
|
||||
slab_free(inode_slab, inode);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue