From ec81fa16d837f430add92b4d2ee4bd3727ca6c6d Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 11 Jan 2023 19:35:44 +0100 Subject: kernel: return EPIPE when fs_waiting on a dead filesystem --- src/kernel/vfs/mount.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/kernel/vfs/mount.c') diff --git a/src/kernel/vfs/mount.c b/src/kernel/vfs/mount.c index aa73acb..2815bb9 100644 --- a/src/kernel/vfs/mount.c +++ b/src/kernel/vfs/mount.c @@ -14,8 +14,8 @@ void vfs_root_register(const char *path, void (*accept)(struct vfs_request *)) { struct vfs_mount *mount = kmalloc(sizeof *mount); *backend = (struct vfs_backend) { .is_user = false, - .potential_handlers = 1, - .refcount = 1, + .usehcnt = 1, + .provhcnt = 1, .kern.accept = accept, }; *mount = (struct vfs_mount){ @@ -55,11 +55,15 @@ void vfs_mount_remref(struct vfs_mount *mnt) { if (--(mnt->refs) > 0) return; struct vfs_mount *prev = mnt->prev; - if (mnt->backend) - vfs_backend_refdown(mnt->backend); - if (mnt->prefix_owned) + if (mnt->backend) { + vfs_backend_refdown(mnt->backend, true); + } + if (mnt->prefix_owned) { kfree((void*)mnt->prefix); + } kfree(mnt); - if (prev) vfs_mount_remref(prev); + if (prev) { + vfs_mount_remref(prev); + } } -- cgit v1.2.3