diff --git a/fs/vfs/inode.c b/fs/vfs/inode.c index 3672f43..dd1570a 100644 --- a/fs/vfs/inode.c +++ b/fs/vfs/inode.c @@ -11,10 +11,13 @@ static mem_cache_t *dirent_slab = NULL; int inode_populate_dirents(inode_t *inode) { - if (inode->dirents.head != NULL) - return -EINVAL; write_lock(&inode->rwlock); + if (inode->dirents.head != NULL) { + write_unlock(&inode->rwlock); + return -EINVAL; + } + dirent_t *dents; ssize_t n = inode->i_ops.get_dents(inode, &dents);