Age | Commit message (Collapse) | Author |
|
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.
|
|
* libihash/ihash.c (hurd_ihash_add): Remove dead code.
|
|
Currently fshelp_get_identity uses ports_class_iterate to de-duplicate
the identity ports. Use a hash table instead.
* libfshelp/get-identity.c (struct idspec): Remove field fileno.
(struct idspec): Add field id_hashloc.
(id_clean): New function.
(id_initialize): Use id_clean as cleanup function for idclass.
(fshelp_get_identity): Use a hash table to de-duplicate the identity
ports.
|
|
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.
|
|
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.
* utils/fakeauth.c (auth_demuxer): Improve the demuxer function.
|
|
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.
* auth/auth.c (auth_demuxer): Improve the demuxer function.
|
|
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.
* pflocal/pflocal.c (pf_demuxer): Improve the demuxer function.
* pflocal/sserver.c (sock_demuxer): Likewise.
|
|
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.
* pfinet/main.c (pfinet_demuxer): Improve the demuxer function.
|
|
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.
* proc/main.c (message_demuxer): Improve the demuxer function.
|
|
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.
Furthermore, move the exec_startup_server_routine to the end of the
chain, as the startup related functions are only needed at system
bootstrap time.
* exec/main.c (exec_demuxer): Improve the demuxer function.
|
|
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.
* libtriv/demuxer.c (trivfs_demuxer): Improve the demuxer function.
|
|
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.
* libnetfs/demuxer.c (netfs_demuxer): Improve the demuxer function.
|
|
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.
Furthermore, move diskfs_exec_startup_server_routine to the end of the
chain, as the startup related functions are only needed at system
bootstrap time in the root filesystem.
* libdiskfs/demuxer.c (diskfs_demuxer): Improve the demuxer function.
|
|
* libports/manage-multithread.c (adjust_priority): Deallocate host
right before returning.
|
|
Properly deallocate all ports and terminate the started translator if
an error occurs.
* libfshelp/start-translator-long.c (fshelp_start_translator_long):
Improve error handling.
|
|
* proc/host.c (S_proc_getprivports): Adapt accordingly.
* proc/main.c (main): Store the device master port in _hurd_device_master.
* proc/proc.h (master_device_port): Remove unused variable.
|
|
Store the privileged host port in _hurd_host_priv like it is done in
the root filesystem. This fixes the thread priority adjustment in the
proc server. Prior to this fix, a warning message "unable to adjust
libports thread priority" sometimes appeared early in the boot
process.
* proc/host.c (S_proc_getprivports): Adapt accordingly.
(S_proc_register_version): Likewise.
* proc/mgt.c (add_tasks): Likewise.
* proc/msg.c (tickle_init): Likewise.
* proc/main.c (main): Store the privileged host port in _hurd_host_priv.
* proc/proc.h: Remove unused variable master_host_port.
fixup_store_priv_port
|
|
By using error instead of perror, the warning can be proprely
attributed to the process.
* libports/manage-multithread.c (adjust_priority): Use error instead
of perror to print the warning.
|
|
* libdiskfs/disk-pager.c (diskfs_start_disk_pager): Improve error reporting.
|
|
* libports/transfer-right.c (ports_transfer_right): Improve error handling.
|
|
* libports/reallocate-from-external.c (ports_reallocate_from_external):
Improve error handling.
|
|
* libports/reallocate-port.c (ports_reallocate_port): Improve error
handling.
|
|
* proc/main.c (main): Update comment. The proc server is no longer PID 0.
* proc/proc.h: Likewise.
|
|
* init/init.c (S_startup_essential_task): Fix port leak.
|
|
Deallocate the device port after creating the mapping. The mapping is
independent of the device port.
* libshouldbeinlibc/maptime.c (maptime_map): Deallocate device port.
|
|
* libports/manage-multithread.c (adjust_priority): Deallocate processor set
rights before returning.
|
|
Found using the Clang Static Analyzer.
* libshouldbeinlibc/maptime.c (maptime_map): Fix error handling.
|
|
* mach-defpager/default_pager.c: Drop register qualifiers.
* mach-defpager/kalloc.c: Likewise.
* mach-defpager/queue.h: Likewise.
* mach-defpager/wiring.c: Likewise.
|
|
If either atime or mtime is NULL, the respective time should be set to
the current time.
Found using the Clang Static Analyzer.
* usermux/node.c (netfs_attempt_utimes): Use flags in call to
fshelp_touch.
|
|
Found using the Clang Static Analyzer.
* nfsd/ops.c (op_remove): Fix error handling.
|
|
Found using the Clang Static Analyzer.
* fatfs/dir.c (diskfs_get_directs): Fix error handling.
|
|
Found using the Clang Static Analyzer.
* fatfs/dir.c (diskfs_lookup_hard): Fix error handling.
|
|
Found using the Clang Static Analyzer.
* libps/spec.c (fprint_frac_value): Fix computation of value_len.
|
|
Found using the Clang Static Analyzer.
* utils/frobauth.c (posix_parse_opt): Fix dead initialization.
(no_ugids_parse_opt): Likewise.
|
|
|
|
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.
|
|
ports_manage_port_operations_multithread uses two values, totalthreads
and nreqthreads, to manage the threads it creates. Previously a lock
was used to synchronize the access to them. Use atomic operations
instead.
* libports/manage-multithread.c (ports_manage_port_operations_multithread):
Use atomic operations instead of a lock to synchronize the access to
totalthreads and nreqthreads.
|
|
* libihash/ihash.c: Clean up the included header files.
* libshouldbeinlibc/cacheq.c: Likewise.
* libshouldbeinlibc/canon-host.c: Likewise.
* libshouldbeinlibc/fsysops.c: Likewise.
* libshouldbeinlibc/idvec-auth.c: Likewise.
* libshouldbeinlibc/idvec.c: Likewise.
* libshouldbeinlibc/idvec.h: Likewise.
* libshouldbeinlibc/localhost.c: Likewise.
* libshouldbeinlibc/maptime.c: Likewise.
* libshouldbeinlibc/nullauth.c: Likewise.
* libshouldbeinlibc/portxlate.c: Likewise.
* libshouldbeinlibc/shared-dom.c: Likewise.
* libshouldbeinlibc/ugids-argp.c: Likewise.
* libshouldbeinlibc/ugids-auth.c: Likewise.
* libshouldbeinlibc/ugids-imply.c: Likewise.
* libshouldbeinlibc/ugids-merge.c: Likewise.
* libshouldbeinlibc/ugids-subtract.c: Likewise.
* libshouldbeinlibc/ugids-verify-auth.c: Likewise.
* libshouldbeinlibc/ugids-verify.c: Likewise.
* libshouldbeinlibc/ugids.c: Likewise.
* libshouldbeinlibc/ugids.h: Likewise.
* libshouldbeinlibc/wire.c: Likewise.
|