summaryrefslogtreecommitdiff
path: root/tmpfs
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-10 22:05:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-10 22:05:09 +0200
commitb14e0100f5295abd950eef636fa16df181504401 (patch)
tree8335e68359360ae50064e7164b0a25277fb33ee0 /tmpfs
parent7c3323a25bc1d5844feb7f9ed241fdbdb4819739 (diff)
Do not cache the R/O proxy
We cannot properly detect when to release the ro_proxy, so let's just not cache it.
Diffstat (limited to 'tmpfs')
-rw-r--r--tmpfs/node.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/tmpfs/node.c b/tmpfs/node.c
index 1a73a164..ed04a8df 100644
--- a/tmpfs/node.c
+++ b/tmpfs/node.c
@@ -73,11 +73,9 @@ diskfs_free_node (struct node *np, mode_t mode)
switch (np->dn->type)
{
case DT_REG:
+ if (np->dn->u.reg.memobj != MACH_PORT_NULL) {
/* XXX GNU Mach will terminate the object, and thus existing mappings
* will get SIGBUS. */
- if (np->dn->u.reg.ro_memobj != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), np->dn->u.reg.ro_memobj);
- if (np->dn->u.reg.memobj != MACH_PORT_NULL) {
vm_deallocate (mach_task_self (), np->dn->u.reg.memref, 4096);
mach_port_deallocate (mach_task_self (), np->dn->u.reg.memobj);
}
@@ -567,7 +565,7 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
if (prot & VM_PROT_WRITE)
right = np->dn->u.reg.memobj;
- else if (np->dn->u.reg.ro_memobj == MACH_PORT_NULL)
+ else
{
vm_offset_t offset = 0;
vm_offset_t start = 0;
@@ -576,21 +574,17 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot)
VM_PROT_READ | VM_PROT_EXECUTE,
&np->dn->u.reg.memobj, 1,
&offset, 1, &start, 1, &len, 1,
- &np->dn->u.reg.ro_memobj);
+ &right);
if (err)
{
errno = err;
return MACH_PORT_NULL;
}
-
- right = np->dn->u.reg.ro_memobj;
}
- else
- right = np->dn->u.reg.ro_memobj;
/* Add a reference for each call, the caller will deallocate it. */
- err = mach_port_mod_refs (mach_task_self (), right,
- MACH_PORT_RIGHT_SEND, +1);
+ err = mach_port_mod_refs (mach_task_self (), np->dn->u.reg.memobj,
+ MACH_PORT_RIGHT_SEND, +1);
assert_perror_backtrace (err);
return right;