Fix file system racing and ext2 directory insertion (#58)
authorLunaixsky <lunaixsky@qq.com>
Sun, 4 May 2025 18:33:51 +0000 (19:33 +0100)
committerGitHub <noreply@github.com>
Sun, 4 May 2025 18:33:51 +0000 (19:33 +0100)
commitec4ff182252b6d7b3cb81f4fa783c5348a6c30fd
tree3f4f83ff40580908f61e8e171a03561bc6048d31
parent14046412dd248f8ae504cf75788edc480f2313d0
Fix file system racing and ext2 directory insertion (#58)

* fix: ext2 directory insertion; racing on inode create

use nesting lock for v_inode and v_dnode locking.

hold the lock on the parent directory upon creating inode
prevent contention across multiple process that partakes
similar actions

fix the edge case of dirent insertion with data block
boundary crossing.

fix the incorrect calculation between fsblock index and
ext2 data block/inode index.

new test case: fragfile - random file spammer

* add locks to the shared objects of ext2 fs

* fix missing locks in the vfs subsystem

* add locks to dnode and inode cache
* add locks to fdtable for resolving inter-threads contentions

* scale up the fragfile sample size
19 files changed:
lunaix-os/includes/lunaix/ds/mutex.h
lunaix-os/includes/lunaix/ds/rwlock.h
lunaix-os/includes/lunaix/ds/spinlock.h
lunaix-os/includes/lunaix/fs.h
lunaix-os/kernel/ds/mutex.c
lunaix-os/kernel/fs/LConfig
lunaix-os/kernel/fs/ext2/LConfig [new file with mode: 0644]
lunaix-os/kernel/fs/ext2/alloc.c
lunaix-os/kernel/fs/ext2/dir.c
lunaix-os/kernel/fs/ext2/ext2.h
lunaix-os/kernel/fs/ext2/file.c
lunaix-os/kernel/fs/ext2/group.c
lunaix-os/kernel/fs/ext2/inode.c
lunaix-os/kernel/fs/ext2/mount.c
lunaix-os/kernel/fs/mount.c
lunaix-os/kernel/fs/vfs.c
lunaix-os/kernel/process/fork.c
lunaix-os/usr/LBuild
lunaix-os/usr/fragfile.c [new file with mode: 0644]