From 72cca628210784a70f2ebc314bb26af628206ae6 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Sun, 5 Jul 2026 14:36:04 +0200 Subject: [PATCH] inode: only check for population after lock Signed-off-by: Michael Shaw --- fs/vfs/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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);