summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
authordzwdz2023-01-11 19:35:44 +0100
committerdzwdz2023-01-11 19:37:46 +0100
commitec81fa16d837f430add92b4d2ee4bd3727ca6c6d (patch)
tree43c91abe8d6a76fcec006fe67c1b585573d3662f /src/kernel/proc.c
parentc178ab5d5ca328d5b0072d54e3dc66d1b198df7b (diff)
kernel: return EPIPE when fs_waiting on a dead filesystem
Diffstat (limited to 'src/kernel/proc.c')
-rwxr-xr-x[-rw-r--r--]src/kernel/proc.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 36e6004..408e3d0 100644..100755
--- 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;
}