Age | Commit message (Collapse) | Author |
|
* trans/Makefile: Add ifsock-MIGSFLAGS.
* trans/ifsock.c (S_ifsock_getsockaddr): Fix receiver lookup.
|
|
Previously, the mig mutator functions were in migsupport.c, preventing
them from being inlined into the mig-generated server functions. Put
them in mig-decls.h instead. Rename mutations.h to mig-mutate.h.
This is the naming convention used for pflocal.
* libtrivfs/fsmutations.h: Rename to mig-mutate.h, adopt imports.
* libtrivfs/Makefile: Adopt accordingly.
* libtrivfs/migsupport.c: Rename to mig-decls.h.
* libtrivfs/trivfs.h: Move dynamic classes/buckets declarations to
mig-decls.h, remove superfluous imports.
* exec/execmutations.h: Fix import.
* pfinet/mig-mutate.h: Likewise.
* trans/Makefile: Likewise.
|
|
|
|
Previously, map_device_to_path mapped unknown device strings to
"none". Return a copy of the original source string instead so that
e.g. nfs mount point points are properly handled.
* trans/mtab.c (map_device_to_path): Do not map unknown source strings
to "none".
|
|
Previously, the mtab translator would guess the source of a filesystem
translator from its last argument. This made all kinds of
non-filesystem translators appear in /proc/mounts, causing severe
problems due to umount --all removing vital passive translator
records.
Fix this by ignoring all translators that do not explicitly implement
file_get_source.
* trans/mtab.c (mtab_populate): Ignore translators that do not
implement file_get_source.
|
|
* hurd/fs.defs: Add file_get_children and file_get_source.
* hurd/fsys.defs: Remove fsys_get_children and fsys_get_source.
* libdiskfs/fsys-get-children.c: Rename and adapt accordingly.
* libdiskfs/fsys-get-source.c: Likewise.
* libnetfs/fsys-get-children.c: Likewise.
* libnetfs/fsys-get-source.c: Likewise.
* libtrivfs/fsys-get-children.c: Likewise.
* libtrivfs/fsys-get-source.c: Likewise.
* libdiskfs/diskfs.h: Adapt prototype and comment.
* libnetfs/netfs.h: Likewise.
* libtrivfs/trivfs.h: Likewise.
* libdiskfs/get-source.c: Adapt default implementation, provide
diskfs_disk_name by default.
* libnetfs/netfs.h: Adapt default implementation.
* libtrivfs/get-source.c: Likewise.
* libdiskfs/Makefile: Adapt accordingly.
* libnetfs/Makefile: Likewise.
* libtrivfs/Makefile: Likewise.
* trans/symlink.c: Likewise.
* trans/mtab.c: Likewise.
|
|
When a client finds a node from the hash table, it could happen that
another thread is still holding one reference on it before the current
thread has acquired its own. Simply checking for a non zero refcount isn't
enough, the new client must atomically acquire its own reference.
* trans/fakeroot.c (netfs_S_dir_lookup): Find and acquire node reference
while holding netfs_node_refcnt_lock.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Fix node dereference.
|
|
Instead of the FAKE_REFERENCE flag, rework node caching so that nodes are
retained only if their attributes are actually changed. In addition, don't
remove unreferenced nodes from the hash table at protid release, since
their reference counter is unstable. Do it on node destruction, once the
reference counter has reached 0. This means lookups can return nodes not
referenced (other than by the hash table), a condition for which a check
is added. By never acquiring a reference on such nodes, their counter is
guaranteed to remain stable once unreferenced.
* trans/fakeroot.c (FAKE_REFERENCE): Remove macro.
(FAKE_DEFAULT): New macro.
(set_default_attributes): New function.
(set_faked_attribute): Likewise.
(netfs_node_norefs): Remove node from hash table, properly taking care
of all the locks involved.
(fakeroot_netfs_release_protid): Remove node handling code, merely call
netfs_release_protid.
(netfs_S_dir_lookup): Handle unreferenced nodes, call set_default_attributes
on node creation, remove call to netfs_attempt_chown.
(netfs_attempt_chown): Call set_faked_attribute instead of accessing faked
flags directly.
(netfs_attempt_chauthor): Likewise.
(netfs_attempt_chmod): Likewise.
(main): Likewise.
|
|
Unconditionally relay chmod requests instead of filtering those that
don't change the executable bit.
* trans/fakeroot.c (netfs_attempt_chmod): Unconditionally call file_chmod
with an unaltered mode.
|
|
This reverts commit 672005782e57e049c7c8f4d6d0b2a80c0df512b4.
That change is apparently not needed and introduced a deadlock.
* trans/fakeroot.c (netfs_attempt_mkfile): Unlock directory node before
creating new node.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Deallocate rights to intermediate
file systems.
|
|
Use translation functions instead of doing the lookup manually.
* trans/Makefile (password-MIGSFLAGS): Add mutators.
* trans/password.c (S_password_check_user): Update accordingly.
(S_password_check_group): Likewise.
|
|
Traditionally, /proc/mounts includes only filesystem mount points.
Previously though, the mtab translator included any kind of
translator, like all /hurd/storeio translators. This causes problems
with umount --all as this would remove the passive translator records
from nodes in /dev.
Fix this by only listing filesystem-like translators by default.
Filesystem-like translators are identified by their response to
dir_readdir messages sent to their root node.
* trans/mtab.c (all_translators): New variable.
(options): Add flag to preserve the old behavior.
(parse_opt): Handle the new flag.
(is_filesystem_translator): New function.
(mtab_populate): Skip non-filesystem translators by default.
|
|
* trans/mtab.c (main): Use ports_manage_port_operations_multithread.
|
|
* trans/mtab.c (struct mtab): Add lock.
(open_hook): Initialize lock.
(close_hook): Destroy lock.
(trivfs_S_io_read): Lock mtab object, adjust error handling accordingly.
(trivfs_S_io_seek): Likewise.
(trivfs_S_io_readable): Likewise.
|
|
Previously the mtab detector tried to detect whether it talks to
itself by comparing the control port of the translator it currently
visits with its own. This was done to prevent deadlocks. However, this
did not detect non-trivial loops, i.e. two mtab translators would
still dead-lock each other.
Now that it is safe to actually file_name_lookup the root node of a
mtab translator without triggering the generation of content, this
logic can just be omitted.
* trans/mtab.c (mtab_populate): Remove the loop detection logic.
|
|
Previously the mtab content was generated in the open hook. Delay this
until the data is needed. A follow up patch will take advantage of
this to both simplify the logic in mtab_populate and make it more
robust at the same time.
* trans/mtab.c (open_hook): Do not eagerly populate the mtab.
(trivfs_S_io_read): Populate the mtab struct on demand.
(trivfs_S_io_seek): Likewise.
(trivfs_S_io_readable): Likewise.
|
|
Previously, fakeroot would not exit if a process outlived the original
process started by settrans. This caused bugs like this:
% fakeroot-hurd /bin/sh -c 'sleep 1&' 2>&1 | tee
<hangs>
Fix this by exiting if the last client of fakeroot goes away.
If noone has a right to any control or protid port, noone can ever
reacquire any such right. So it is safe to shutdown the fakeroot
translator in that case.
* trans/fakeroot.c (fakeroot_netfs_release_protid): Shutdown the
translator if the last protid object is destroyed and no control port
is around either.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Remove dead code.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Remove dead code.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Drop else.
|
|
Previously, files created in the fakeroot environment were created
with the uid and gid of the user running fakeroot:
% fakeroot-hurd /bin/sh -c 'touch /tmp/$$; stat --format=%u:%g /tmp/$$'
1000:1000
* trans/fakeroot.c (netfs_S_dir_lookup): Fix ownership of newly
created files.
|
|
When a node has faked attributes, we cannot drop our node.
Reinitialize the lock box as if the node was dropped. This fixes the
following bug:
% fakeroot-hurd /bin/sh -c 'touch /tmp/$$.lock
chown 0 /tmp/$$.lock
l(){ flock /tmp/$$.lock true; }; l; l'
<hangs>
* trans/fakeroot.c (fake_node_dropweak): Unlock the node if the last
real reference is dropped but we keep a fake one.
|
|
Previously the node was not correctly torn down if adding the newly
created netnode to the hash table failed. Fix this by rearranging the
code, doing the hash table modification first because it is easier to
undo.
* trans/fakeroot.c (new_node): Fix the error handling.
|
|
The function new_node creates virtual nodes using netfs_make_node.
Nodes created with netfs_make_node already have a reference count of
one. Currently another reference is added in new_node. This prevents
the destruction of the node causing bugs like this:
% fakeroot-hurd sh -c 'l(){ flock /tmp/$$.lock true; }; l; l'
<hangs>
* trans/fakeroot.c (new_node): Fix reference count of newly created
nodes.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Fix locking.
|
|
Previously, fakeroot tried to do too much in netfs_node_norefs. This
function is meant to deallocate nodes. Fakeroot however also tries to
remove the node from the hash table and to prolong the lifetime of the
node object by re-referencing it.
Removing the object from the hash table is highly problematic, because
at this point we already have the node locked. With proper locking in
netfs_S_dir_lookup, acquiring the hash table lock while we hold the
node locked results in dead-locks, releasing the node lock before
acquiring the hash table lock results in a race condition.
Prolonging the lifetime of the node by re-acquiring a reference is
clearly a hack that surprisingly works to some degree. The nodes
transbox, however, is already gone at this point.
This code was never actually run because of a reference-counting bug
in fakeroot.
Fix this by installing our own clean routine in the
netfs_protid_class. This function is called without the associated
node being locked, allowing us to acquire the locks in the proper
order and to keep the hash table locked while the node is being
destroyed.
* trans/fakeroot.c (netfs_node_norefs): Just free the associated
resources.
(fakeroot_netfs_release_protid): New function doing cleanly what
netfs_node_norefs did before.
(netfs_S_dir_lookup): Reuse the fake reference.
(main): Install fakeroot_netfs_release_protid as clean routine.
fixup_fix_refc_destruction
|
|
* trans/fakeroot.c (new_node): Acquire the nodes lock before releasing
the idport_ihash_lock. Return nodes locked.
(netfs_S_dir_lookup): Drop lock.
(netfs_attempt_mkfile): Likewise.
(main): Likewise.
|
|
* trans/fakeroot.c (netfs_attempt_mkfile): Keep dir locked until the
new node is created.
|
|
* trans/fakeroot.c (netfs_S_dir_lookup): Handle invalid responses to
dir_lookup requests.
|
|
Previously any FS_RETRY_NORMAL requests were handed back to the
client. Redo the lookup ourself instead. This saves us the burden to
create a fake node for the intermediate step, hand it back to the
client and handle another request from the client.
With this change there is no need to fiddle with the permission bits
as it was previously done.
* trans/fakeroot.c (netfs_S_dir_lookup): Redo the lookup transparently
for the user if FS_RETRY_NORMAL is requested.
fixup_improve_perf
|
|
Previously a pointer to the node was stored in the hash table. This
writes the locp pointer into the node object overwriting the next
pointer there. Store the pointer to the netnode instead.
* trans/fakeroot.c (struct netnode): Add field np.
(new_node): Initialize field np.
(new_node): Store nn instead of np into the hash table.
(netfs_S_dir_lookup): Adjust accordingly.
|
|
Previously fakeroot did not explicitly proxy io_identity requests, so
the default implementation from libnetfs handled them. But as the fsys
identity port returned was always netfs_fsys_identity, this broke the
getcwd logic (assuming /media/scratch is a translator):
% cd /media/scratch/foo && fakeroot-hurd pwd
/foo
Fix this by proxying io_identity requests. Since then no-one is
handing out our netfs_fsys_identity port anymore, an optimization in
netfs_fsys_identity is made obsolete by this change.
* trans/fakeroot.c (netfs_S_dir_lookup): Adjust code accordingly.
(netfs_S_io_identity): New function.
|
|
When looking up files, fakeroot intercepts reauthentication requests
and executes io_reauthenticate and auth_user_authenticate
transparently for the client. This, however, makes the client
incorrectly assume that the lookup is finished (assuming
/media/scratch is a translator):
% cd /media/scratch && fakeroot-hurd pwd
pwd: reading directory `..': Bad file descriptor
Make the reauthentication completely transparent to the client by
re-doing the lookup ourselves.
* trans/fakeroot.c (netfs_S_dir_lookup): Fix transparent reauthentication.
|
|
Previously, fakeroot failed to create files in certain circumstances,
e. g. assuming /tmp is a tmpfs and /tmp/some_file does not exist:
% cd /tmp && fakeroot-hurd /bin/sh -c ':>/tmp/some_file'
/bin/sh: 1: cannot create /tmp/some_file: Is a directory
Fix this by sanitizing the flags value not to contain O_WRITE if we're
not at the last path component.
* trans/fakeroot.c (netfs_S_dir_lookup): Strip O_WRITE from flags when
looking up all but the last path component.
|
|
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection "Handling Multiple Request
Types". This avoids initializing the reply message in every X_server
function. The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.
* trans/fakeroot.c (netfs_demuxer): Improve the demuxer function.
|
|
Any messages we do not intercept are forwarded to the underlying file.
* trans/fakeroot.c (netfs_demuxer): Remove unused declaration of
function netfs_ifsock_server.
|
|
Just like it always is in libnetfs' normal netfs_S_dir_lookup.
* trans/fakeroot.c (netfs_S_dir_lookup): Call netfs_validate_stat after
calling new_node.
|
|
Rename the global variable "path" to "target_path" to make it more
unambiguous.
* trans/mtab.c: Rename global variable "path".
|
|
* libdiskfs/file-set-size.c (diskfs_S_file_set_size): Return EINVAL if
size is negative.
* libnetfs/file-set-size.c (netfs_S_file_set_size): Likewise.
* libtreefs/s-file.c (treefs_S_file_set_size): Likewise.
* storeio/io.c (trivfs_S_file_set_size): Likewise.
* term/users.c (trivfs_S_file_set_size): Likewise.
* trans/null.c (trivfs_S_file_set_size): Likewise.
* trans/streamio.c (trivfs_S_file_set_size): Likewise.
|
|
* trans/Makefile (OBJS): Remove fsysUser.o.
|
|
The mtab translator provides an mtab file that is dynamically created
on demand. It is populated with information about active translators
bound below the given path that is accumulated by traversing the
translator tree. It can also be invoked as normal program that prints
the requested information to stdout.
* trans/mtab.c: New file.
* trans/Makefile: Build mtab.
|
|
Create a server function returning EOPNOTSUPP.
* trans/symlink.c (S_fsys_get_source): New function.
|
|
Create a server function returning EOPNOTSUPP.
* trans/symlink.c (S_fsys_get_children): New function.
|
|
Register any symlink translators running as root as important
processes at the proc server.
* trans/symlink.c (main): Mark us as important.
|
|
* trans/null.c (main): Drop privileges.
|
|
|
|
This change fixes a problem that can occur with non-blocking (and also
blocking for very short times) select/poll calls. The problem occurs because
the timeout is implemented at the client side. For a non-blocking call, this
means that (depending on the code path taken in the C library) the client
could get a timeout without a full RPC round-trip to the server. Moving the
implementation of the timeout to the servers guarantees a full round-trip,
and correct results for non-blocking calls.
The modifications in this change depend on the availability of the recently
added pthread_hurd_cond_timedwait_np function in libpthread.
* boot/boot.c (io_select_common): New static function.
(S_io_select): Use io_select_common.
(S_io_select_timeout): New function which makes use of io_select_common.
* console-client/kbd-repeat.c (repeater_select): Add a timeout parameter.
* console-client/pc-mouse.c (repeater_select): Likewise.
* console-client/trans.c (io_select_common): New static function.
(netfs_S_io_select): Use io_select_common.
(netfs_S_io_select_timeout): New function which makes use of io_select_common.
* console-client/trans.h (struct consnode): Add a timeout parameter.
* hurd/io.defs (io_select_timeout): New MIG routine.
* hurd/io_reply.defs (io_select_timeout_reply): New MIG simpleroutine.
* hurd/io_request.defs (io_select_timeout_request): Likewise.
* libdiskfs/io-select.c (diskfs_S_io_select_timeout): New function.
* libnetfs/io-select.c (netfs_S_io_select_timeout): Likewise.
* libpipe/pipe.c (pipe_pair_select): Add a timeout parameter.
* libpipe/pipe.h (pipe_select_readable): Likewise.
(pipe_select_writable): Likewise.
(pipe_pair_select): Likewise.
* libpipe/pq.h: Include <hurd/hurd_types.h>.
* libtrivfs/io-select.c (trivfs_S_io_select_timeout): New function.
* pfinet/glue-include/linux/sched.h: Include <errno.h>.
(interruptible_sleep_on): Function removed, replaced with ...
(interruptible_sleep_on_timeout): New function.
(schedule): Update to use interruptible_sleep_on_timeout.
(schedule_timeout): Likewise.
* pfinet/io-ops.c (io_select_common): New static function.
(S_io_select): Use io_select_common.
(S_io_select_timeout): New function which makes use of io_select_common.
* pfinet/tunnel.c (io_select_common): New static function.
(trivfs_S_io_select): Use io_select_common.
(trivfs_S_io_select_timeout): New function which makes use of io_select_common.
* pflocal/connq.c (connq_listen): Replace noblock with a timeout parameter.
* pflocal/connq.h: Include <hurd/hurd_types.h>.
(connq_listen): Update declaration to replace noblock with a timeout parameter.
* pflocal/io.c (io_select_common): New static function.
(S_io_select): Use io_select_common.
(S_io_select_timeout): New function which makes use of io_select_common.
* pflocal/socket.c (S_socket_accept): Update call to connq_listen to match new
declaration.
* storeio/io.c (trivfs_S_io_select_timeout): New function.
* term/ptyio.c (pty_io_select): Add a timeout parameter.
* term/term.h (pty_io_select): Likewise.
* term/users.c (io_select_common): New static function.
(trivfs_S_io_select): Use io_select_common.
(trivfs_S_io_select_timeout): New function which makes use of io_select_common.
* trans/fifo.c (io_select_common): New static function.
(trivfs_S_io_select): Use io_select_common.
(trivfs_S_io_select_timeout): New function which makes use of io_select_common.
* trans/firmlink.c (trivfs_S_io_select_timeout): New function.
* trans/new-fifo.c (io_select_common): New static function.
(trivfs_S_io_select): Use io_select_common.
(trivfs_S_io_select_timeout): New function which makes use of io_select_common.
* trans/null.c (trivfs_S_io_select_timeout): New function.
* trans/streamio.c (io_select_common): New static function.
(trivfs_S_io_select): Use io_select_common.
(trivfs_S_io_select_timeout): New function which makes use of io_select_common.
|
|
Properly use pthread_mutex_destroy as equivalent for cthreads' mutex_clear, instead of pthread_mutex_init.
Issue kindly reported by Nick Lloyd, thanks!
* trans/hello-mt.c (close_hook): Call pthread_mutex_destroy instead of
pthread_mutex_init.
|