inode: only check for population after lock
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
4fff0f4d62
commit
72cca62821
1 changed files with 5 additions and 2 deletions
|
|
@ -11,10 +11,13 @@ static mem_cache_t *dirent_slab = NULL;
|
||||||
|
|
||||||
int inode_populate_dirents(inode_t *inode)
|
int inode_populate_dirents(inode_t *inode)
|
||||||
{
|
{
|
||||||
if (inode->dirents.head != NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
write_lock(&inode->rwlock);
|
write_lock(&inode->rwlock);
|
||||||
|
|
||||||
|
if (inode->dirents.head != NULL) {
|
||||||
|
write_unlock(&inode->rwlock);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
dirent_t *dents;
|
dirent_t *dents;
|
||||||
ssize_t n = inode->i_ops.get_dents(inode, &dents);
|
ssize_t n = inode->i_ops.get_dents(inode, &dents);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue