Hello, In the latest working design unionmount creates a proxy node (by cloning the netfs_root_node of unionfs translator) and sets the mountee on this proxy. I'm currently trying to implement cfhammar's idea about having the mountee run in orphan mode. To achieve this I call only fshelp_start_translator, with no file_set_translator following. When calling fshelp_start_translator, I have to give a pointer to a function, open_port, which in my case looks like this:
/* Opens the port on which to set the mountee. */ error_t open_port (int flags, mach_port_t * underlying, mach_msg_type_name_t * underlying_type, task_t task, void *cookie) { err = 0; /* Create a port to `np`. */ newpi = netfs_make_protid (netfs_make_peropen (np, flags, NULL), user); if (!newpi) { iohelp_free_iouser (user); return errno; } *underlying = underlying_port = ports_get_send_right (newpi); *underlying_type = MACH_MSG_TYPE_COPY_SEND; ports_port_deref (newpi); return err; } /*open_port */ np is the pointer to the proxy node. If I want to get rid of the proxy node I must somehow avoid keeping references to it. However, in the above code I clearly add a reference to the proxy node by creating a port which goes to the mountee and thus, does not get destroyed immediately. I tried to set *underlying to MACH_PORT_NULL, but it (in a quite expected way) refused to work. I then tried to do *underlying = underlying_node; where underlying_node is a port right describing a port to the underlying node of the unionfs translator. This led to the following error: unionfs: /var/tmp/hurd-20090404/./libports/complete-deallocate.c:29: _ports_complete_deallocate: Assertion `(pi->flags & 0x0001) == 0' failed. /hurd/filterfs: Translator startup failure: fsys_startup: (ipc/mig) server died (lines wrapped by MUA) filterfs is the my own libnetfs-based translator which I use for testing unionmount. Now the question: can the reason for such failure be the fact that the port right stored in underlying_node is used both in unionmount and in the mountee? If so, is there a way to clone the port right? Regards, scolobb