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/proc.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) mode change 100644 => 100755 src/kernel/proc.c (limited to 'src/kernel/proc.c') diff --git a/src/kernel/proc.c b/src/kernel/proc.c old mode 100644 new mode 100755 index 36e6004..408e3d0 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -79,8 +79,8 @@ struct process *process_fork(struct process *parent, int flags) { if ((flags & FORK_NEWFS) == 0 && parent->controlled) { child->controlled = parent->controlled; - child->controlled->potential_handlers++; - child->controlled->refcount++; + assert(child->controlled->provhcnt); + child->controlled->provhcnt++; } child->mount = parent->mount; @@ -123,24 +123,12 @@ void process_kill(struct process *p, int ret) { if (proc_alive(p)) { if (p->controlled) { // TODO vfs_backend_user_handlerdown - assert(p->controlled->potential_handlers > 0); - p->controlled->potential_handlers--; - if (p->controlled->potential_handlers == 0) { - // orphaned - struct vfs_request *q = p->controlled->queue; - while (q) { - struct vfs_request *q2 = q->queue_next; - vfsreq_finish_short(q, -1); - q = q2; - } - p->controlled->queue = NULL; - } + assert(p->controlled->provhcnt > 0); if (p->controlled->user.handler == p) { assert(p->state == PS_WAITS4REQUEST); p->controlled->user.handler = NULL; } - - vfs_backend_refdown(p->controlled); + vfs_backend_refdown(p->controlled, false); p->controlled = NULL; } -- cgit v1.2.3