From 7556c3170e43e541f1ffaa79e7b194cf344a80d3 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Sun, 5 Jul 2026 14:40:09 +0200 Subject: [PATCH] vfs: fix deadlock in vfs_creat Signed-off-by: Michael Shaw --- fs/vfs/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/vfs/vfs.c b/fs/vfs/vfs.c index 63e784e..d116b28 100644 --- a/fs/vfs/vfs.c +++ b/fs/vfs/vfs.c @@ -184,8 +184,6 @@ int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t if (len > 255) return -ENAMETOOLONG; - write_lock(&ino->rwlock); - dirent_t *test = NULL; res = inode_find_dirent(ino, name, &test); @@ -199,6 +197,8 @@ int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t goto out_err; } + write_lock(&ino->rwlock); + /* create inode */ fs_t *fs = parent->fs; inode_t *new_ino;