From 82f2c02510043927e73926ce52ab4b813e7bc40c Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 4 May 2022 14:12:50 +0200 Subject: kernel/proc: leave the vfs_request when killing a WAITS4FS proc ...instead of letting the hwole process stay around. This could end up a bit more complex, I have no idea how to test killing processes during vfs requests. The upside of this is that I can remove all the deathbed/deadparent weirdness now. --- src/kernel/vfs/request.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/kernel/vfs') diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index edb1fce..7c1861d 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -83,17 +83,22 @@ int vfs_request_finish(struct vfs_request *req, int ret) { // open() calls need special handling // we need to wrap the id returned by the VFS in a handle passed to // the client - assert(req->caller); - handle_t handle = process_find_handle(req->caller, 0); - if (handle < 0) - panic_invalid_state(); // we check for free handles before the open() call - - struct handle *backing = handle_init(HANDLE_FILE); - backing->file.backend = req->backend; - req->backend->refcount++; - backing->file.id = ret; - req->caller->handles[handle] = backing; - ret = handle; + if (req->caller) { + handle_t handle = process_find_handle(req->caller, 0); + if (handle < 0) + panic_invalid_state(); // we check for free handles before the open() call + + struct handle *backing = handle_init(HANDLE_FILE); + backing->file.backend = req->backend; + req->backend->refcount++; + backing->file.id = ret; + req->caller->handles[handle] = backing; + ret = handle; + } else { + // caller got killed + // TODO write tests & implement + panic_unimplemented(); + } } if (req->input.kern) -- cgit v1.2.3