diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c index 09b52f2..fdd5552 100644 --- a/kernel/fs/vfs.c +++ b/kernel/fs/vfs.c @@ -80,7 +80,13 @@ int vfs_describe (const char* mountpoint, const char* path, struct fs_desc_buffe if (vmp == NULL) return -VFS_NOT_FOUND; - return vmp->driver_ops.describe (vmp, path, desc); + spin_lock (&vmp->lock); + + int ret = vmp->driver_ops.describe (vmp, path, desc); + + spin_unlock (&vmp->lock); + + return ret; } int vfs_read (const char* mountpoint, const char* path, uint8_t* buffer, size_t off, size_t size) { @@ -89,7 +95,13 @@ int vfs_read (const char* mountpoint, const char* path, uint8_t* buffer, size_t if (vmp == NULL) return -VFS_NOT_FOUND; - return vmp->driver_ops.read (vmp, path, buffer, off, size); + spin_lock (&vmp->lock); + + int ret = vmp->driver_ops.read (vmp, path, buffer, off, size); + + spin_unlock (&vmp->lock); + + return ret; } void vfs_init (void) {