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/request.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/kernel/vfs/request.h') diff --git a/src/kernel/vfs/request.h b/src/kernel/vfs/request.h index ef7c83a..4d7fa01 100644 --- a/src/kernel/vfs/request.h +++ b/src/kernel/vfs/request.h @@ -5,15 +5,17 @@ // describes something which can act as an access function struct vfs_backend { - /* references: - * struct vfs_mount - * struct vfs_request - * struct process - * struct handle - */ - size_t refcount; + /* amount of using references + * struct vfs_mount + * struct vfs_request + * struct handle + * once it reaches 0, it'll never increase */ + size_t usehcnt; /* struct vfs_mount */ + /* amount of providing references + * struct process + * 0 - orphaned, will never increase */ + size_t provhcnt; - size_t potential_handlers; // 0 - orphaned struct vfs_request *queue; bool is_user; union { @@ -72,4 +74,6 @@ static inline void vfsreq_finish_short(struct vfs_request *req, long ret) { /** Try to accept an enqueued request */ void vfs_backend_tryaccept(struct vfs_backend *); -void vfs_backend_refdown(struct vfs_backend *); +// TODO the bool arg is confusing. maybe this should just be a function +// that verified the refcount and potentially frees the backend +void vfs_backend_refdown(struct vfs_backend *, bool use); -- cgit v1.2.3