Age | Commit message (Collapse) | Author |
|
* libdiskfs/node-lastref.c: New file
* libdiskfs/Makefile (OTHERSRCS): Add node-lastref.c
* libdiskfs/libdiskfs/node-nput.c (diskfs_nput): Replace last hard reference
code with a call to _diskfs_lastref.
* libdiskfs/node-nrele.c (diskfs_nrele): Likewise.
|
|
Follow-up on 5ab5d98fa515cd19a64e8d5868fcbae85eec9dc5 ('libdiskfs: fix
removal of socket nodes'), for diskfs_nrele.
* libdiskfs/node-nrele.c (diskfs_nrele): Deallocate right to socket
address when cleaning light references.
|
|
So that static linking of e.g. console.static can work.
* libdiskfs/io-stubs.c (diskfs_S_io_readsleep, diskfs_S_io_eofnotify,
diskfs_S_io_postnotify, diskfs_S_io_readnotify): Mark weak.
* libnetfs/fsstubs.c (netfs_S_file_notice_changes, netfs_S_file_getfh,
netfs_S_ifsock_getsockaddr): Likewise.
* libnetfs/fsysstubs.c (netfs_S_fsys_getfile: netfs_S_fsys_getpriv,
netfs_S_fsys_init, netfs_S_fsys_forward, netfs_S_fsys_startup):
Likewise.
* libpager/stubs.c (_pager_S_memory_object_copy,
_pager_S_memory_object_data_write,
_pager_S_memory_object_supply_completed): Likewise.
* libtrivfs/fsys-stubs.c (trivfs_S_fsys_startup, trivfs_S_fsys_getpriv,
trivfs_S_fsys_init, trivfs_S_fsys_getfile): Likewise.
* libtrivfs/io-stubs.c (trivfs_S_io_map_cntl, trivfs_S_io_get_conch,
trivfs_S_io_release_conch, trivfs_S_io_eofnotify, trivfs_S_io_prenotify,
trivfs_S_io_postnotify, trivfs_S_io_readsleep, trivfs_S_io_sigio,
trivfs_S_io_readnotify): Likewise.
|
|
Thanks Kalle Olavi Niemitalo for the notice.
* libdiskfs/file-utimes.c (diskfs_S_file_utimes): Call diskfs_set_node_times
before setting node timestamps.
|
|
* libdiskfs/node-nrele.c (diskfs_nrele): Call diskfs_set_node_times when
there are no hard refs any more, like diskfs_nput does.
|
|
* libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): When
setting a short-circuited translator, clear the translator record
first. Improve error handling.
This notably fixes a crash in ext2fs when setting a symlink on a node
with an existing translator record.
|
|
It is just a warning, not a fatal error.
* libdiskfs/init-startup.c (_diskfs_init_completed): Prefix warning about
requesting shutdown nofication with "warning:".
* random/random.c (main): Likewise.
|
|
* libdiskfs/dir-rmdir.c (diskfs_S_dir_rmdir): Initialize 'np'.
|
|
* libdiskfs/io-restrict-auth.c (diskfs_S_io_restrict_auth): Do not
lock the associated node. No operation here needs synchronization.
* libnetfs/io-restrict-auth.c (netfs_S_io_restrict_auth): Likewise.
|
|
* libdiskfs/dir-lookup.c (short_circuited_callback1): Move function to
libfshelp.
(diskfs_S_dir_lookup): Use the function from libfshelp instead.
* libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Adapt accordingly.
* libdiskfs/trans-callback.c (_diskfs_translator_callback2_fn): Likewise.
* libfshelp/fetch-root.c (fshelp_short_circuited_callback1): New function.
* libfshelp/fshelp.h (struct fshelp_stat_cookie): New definition.
(fshelp_short_circuited_callback1): New prototype.
* libnetfs/dir-lookup.c (short_circuited_callback1): Drop function.
(netfs_S_dir_lookup): Use the function from libfshelp instead.
* libnetfs/fsys-getroot.c (netfs_S_fsys_getroot): Adapt accordingly.
* libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Likewise.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Rename identifiers to
be more idiomatic and closer to libnetfs and the interface
specification. Massage the code so that it aligns closer with the
dir_lookup server function in libnetfs. It should not change the
behavior.
|
|
vm_offset_t (used by pager_memcpy) is not 64bit-ready yet. Reject requests
which go further than this.
* libdiskfs/io-seek.c (diskfs_S_io_seek): Return EFBIG when requested offset
is beyond limits of vm_offset_t.
* libdiskfs/rdwr-internal.c (_diskfs_rdwr_internal): Return EFBIG when
request goes beyond limits of vm_offset_t.
|
|
* libdiskfs/boot-start.c (diskfs_start_bootstrap): Improve error
handling.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): When following a symlink,
if mustbedir is true, always append a slash to the symlink target, not only
when the target is absolute. Reset mustbedir to 0 before continuing the
lookup loop.
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): When following a symlink,
if mustbedir is true, append a slash to the symlink target. Reset mustbedir
to 0 before continuing the lookup loop.
* libtreefs/dir-lookup.c (_treefs_s_dir_lookup): Likewise.
|
|
* libnetfs/node-nput.c: Do not unlock the node since it will be unlocked
later.
* libnetfs/node-nrele.c: Do not lock the node twice if not needed.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): If mustbedir, make sure
entry is a directory by retrying "/", or starting the translator and
retrying "/".
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
|
|
|
|
Replace the hand-written hash table in the node cache with libihash.
Libihash is a self-tuning hash table, whereas the previous code used a
fixed number of buckets.
* libdiskfs/Makefile (HURDLIBS): Link to `ihash'.
* libdiskfs/diskfs.h (struct node): Remove bucket list, add slot pointer.
* libdiskfs/node-cache.c (nodecache): New ihash table replacing the
old `nodehash'.
(lookup): Drop function.
(diskfs_cached_lookup_context): Adapt accordingly.
(diskfs_cached_ifind): Likewise.
(diskfs_try_dropping_softrefs): Likewise.
(diskfs_node_iterate): Likewise.
|
|
* libdiskfs/name-cache.c: Move the Murmur3 algorithm...
* libihash/murmur3.c: ... here, and properly attribute the code.
* libihash/ihash.h (hurd_ihash_hash32): New prototype.
* libihash/Makefile (SRCS): Add new file.
|
|
* libdiskfs/boot-start.c (diskfs_start_bootstrap): fflush stdout when
pausing for /hurd/startup.
|
|
* libdiskfs/boot-start.c (start_execserver): fflush stdout when pausing.
|
|
* libdiskfs/boot-start.c (start_execserver): Improve error handling.
|
|
On some systems, ext2fs.static would regularly hang at startup, as a
race condition meant it would process paging requests while remounting.
To fix this, libpager has been altered to allow inhibiting and resuming
its worker threads, and ext2fs uses this to inhibit paging while
remounting.
* console/pager.c (pager_requests): New variable.
(user_pager_init): Updated call to pager_start_workers to use new
pager_requests variable.
* daemons/runsystem.sh: Removed artificial delay working around the race
condition.
* ext2fs/ext2fs.c (diskfs_reload_global_state): Call new
inhibit_ext2_pager and resume_ext2_pager functions, and leave sblock as
non-NULL so it will be munmapped.
* ext2fs/ext2fs.h (inhibit_ext2_pager,resume_ext2_pager): New functions.
* ext2fs/pager.c (file_pager_requests): New variable.
(create_disk_pager): Updated call to pager_start_workers to use new
file_pager_requests variable.
(inhibit_ext2_pager,resume_ext2_pager): New functions.
* fatfs/fatfs.h (inhibit_fat_pager,resume_fat_pager): New functions.
* fatfs/pager.c (file_pager_requests): New variable.
(create_fat_pager): Updated call to pager_start_workers to use new
file_pager_requests variable.
(inhibit_fat_pager,resume_fat_pager): New functions.
* libdiskfs/disk-pager.c (diskfs_disk_pager_requests): New variable.
(diskfs_start_disk_pager): Updated call to pager_start_workers to use
new diskfs_disk_pager_requests variable.
* libdiskfs/diskfs-pager.h (diskfs_disk_pager_requests): New variable.
* libpager/demuxer.c (struct pager_requests): Renamed struct requests to
struct pager_requests. Replaced queue with queue_in and queue_out
pointers. Added inhibit_wakeup field.
(pager_demuxer): Updated to use new queue_in/queue_out pointers. Only
wake up workers if not inhibited.
(worker_func): Updated to use new queue_in/queue_out pointers. Final
worker thread to sleep notifies the inhibit_wakeup condition variable.
(pager_start_workers): Added out parameter for the requests instance.
Allocate heap space shared by both queues. Initialise new inhibit_wakeup
condition.
(pager_inhibit_workers,pager_resume_workers): New functions.
* libpager/pager.h (struct pager_requests): Public forward definition.
(pager_start_workers): Added out parameter for the requests instance.
(pager_inhibit_workers,pager_resume_workers): New functions.
* libpager/queue.h (queue_empty): New function.
* storeio/pager.c (pager_requests): New variable.
(init_dev_paging): Updated call to pager_start_workers to use new
pager_requests variable.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Rename `error' to `err'.
* libdiskfs/file-getcontrol.c (diskfs_S_file_getcontrol): Likewise.
* libdiskfs/file-syncfs.c (diskfs_S_file_syncfs): Likewise.
|
|
* libdiskfs/diskfs.h (diskfs_node_disknode): Add missing declaration.
(diskfs_disknode_node): Likewise.
|
|
* libdiskfs/diskfs.h: Fix typo.
|
|
* libdiskfs/name-cache.c (diskfs_check_lookup_cache): Drop stray negation.
|
|
* libdiskfs/io-reauthenticate.c (diskfs_S_io_reauthenticate): Release the node
lock while blocking on the auth server and client.
* libnetfs/io-reauthenticate.c (netfs_S_io_reauthenticate): Likewise.
* pfinet/io-ops.c (S_io_reauthenticate): Likewise.
|
|
* libdiskfs/node-cache.c (diskfs_node_iterate): Do not print a message
on ENOMEM.
|
|
Previously, file permissions and ownership of the target directory
were ignored when renaming a directory:
% mkdir a b
% chmod 555 a
% mv b a
% ls a
b
* libdiskfs/dir-renamed.c (diskfs_rename_dir): Fix error handling.
|
|
Previously, all users of libdiskfs implemented a node cache on their
own. Move the node cache from ext2fs into libdiskfs. We preserve the
previous API by marking all functions that we pull from ext2fs as
weak, so that users like tmpfs can still implement their own node
cache.
* ext2fs/dir.c (diskfs_lookup_hard): Adjust accordingly.
* ext2fs/ext2fs.c (main): Don't call `inode_init'.
* ext2fs/ext2fs.h (struct disknode): Drop `hnext', `hprevp'.
* ext2fs/inode.c: Move the node cache into diskfs.
(diskfs_user_make_node): New function.
(diskfs_try_dropping_softrefs): Rename to `diskfs_user_try_dropping_softrefs'.
(read_node): Rename to `diskfs_user_read_node'. Also move a chunk of
code dealing with generations from `diskfs_cached_lookup' here.
* libdiskfs/Makefile (OTHERSRCS): Add `node-cache.c'.
* libdiskfs/diskfs.h (struct node): Add `hnext', `hprevp'.
Amend existing comments, add forward declarations.
* libdiskfs/node-cache.c: New file.
|
|
* libdiskfs/diskfs.h (diskfs_node_disknode, diskfs_disknode_node):
Declare functions as `extern inline' so that we can use them in other
functions declared as `extern inline'.
|
|
* libdiskfs/node-make.c (init_node): Initialize flag `author_tracks_uid'.
|
|
* libdiskfs/diskfs.h (struct node): Drop unused fields from struct
node.
|
|
* libdiskfs/diskfs.h (struct node): Turn flags into a bit field.
|
|
* libdiskfs/diskfs.h (struct node): Use refcounts_t for reference counting.
(diskfs_node_refcnt_lock): Remove.
(diskfs_node_norefs,diskfs_drop_node): Change comments accordingly.
* libdiskfs/init-init.c: Adjust accordingly.
* libdiskfs/node-drop.c: Likewise.
* libdiskfs/node-make.c: Likewise.
* libdiskfs/node-nput.c: Likewise.
* libdiskfs/node-nputl.c: Likewise.
* libdiskfs/node-nref.c: Likewise.
* libdiskfs/node-nrefl.c: Likewise.
* libdiskfs/node-nrele.c: Likewise.
* libdiskfs/node-nrelel.c: Likewise.
* ext2fs/inode.c: Likewise.
* fatfs/inode.c: Likewise.
* isofs/inode.c: Likewise.
* tmpfs/node.c: Likewise.
* doc/hurd.texi: Likewise.
|
|
|
|
* libdiskfs/boot-start.c (get_console): Deallocate `device_master'.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Match "." path as being the
root directory.
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
|
|
* ext2fs/inode.c: Replace `bcopy' with `memcpy' or `memmove' as
appropriate.
* ext2fs/pager.c: Likewise.
* isofs/lookup.c: Likewise.
* isofs/main.c: Likewise.
* isofs/rr.c: Likewise.
* libdiskfs/file-get-trans.c: Likewise.
* libiohelp/return-buffer.c: Likewise.
* libpager/pagemap.c: Likewise.
* libpipe/pq.c: Likewise.
* libpipe/pq.h: Likewise.
* libstore/unzipstore.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/ethernet.c: Likewise.
* pfinet/tunnel.c: Likewise.
* storeio/dev.c: Likewise.
|
|
For reference, this patch was created using the following semantic
patch, and then manually applying the change in all functions
containing nested functions, as those are not supported by Coccinelle.
@@
expression A, B;
@@
- bzero (A, B)
+ memset (A, 0, B)
* auth/auth.c: Replace `bzero' with `memset'.
* boot/boot.c: Likewise.
* defpager/defpager.c: Likewise.
* exec/exec.c: Likewise. Also, drop `safe_bzero' and just use
`hurd_safe_memset' directly.
* ext2fs/ext2fs.c: Likewise.
* ext2fs/getblk.c: Likewise.
* ext2fs/pager.c: Likewise.
* fatfs/pager.c: Likewise.
* ftpfs/dir.c: Likewise.
* ftpfs/netfs.c: Likewise.
* isofs/inode.c: Likewise.
* isofs/pager.c: Likewise.
* libdiskfs/file-getfh.c: Likewise.
* libdiskfs/file-statfs.c: Likewise.
* libfshelp/fetch-root.c: Likewise.
* libfshelp/start-translator.c: Likewise.
* libftpconn/create.c: Likewise.
* libftpconn/open.c: Likewise.
* libftpconn/unix.c: Likewise.
* libpipe/pipe.c: Likewise.
* libps/procstat.c: Likewise.
* libps/spec.c: Likewise.
* libshouldbeinlibc/cacheq.c: Likewise.
* libshouldbeinlibc/idvec.c: Likewise.
* libshouldbeinlibc/ugids.c: Likewise.
* libstore/argp.c: Likewise.
* libstore/enc.c: Likewise.
* libstore/kids.c: Likewise.
* libthreads/alpha/thread.c: Likewise.
* libtreefs/fsys.c: Likewise.
* libtrivfs/file-statfs.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/glue-include/asm/uaccess.h: Likewise.
* pfinet/io-ops.c: Likewise.
* pfinet/options.c: Likewise.
* pfinet/socket.c: Likewise.
* pfinet/timer-emul.c: Likewise.
* pflocal/io.c: Likewise.
* startup/startup.c: Likewise.
* storeio/storeio.c: Likewise.
* sutils/fstab.c: Likewise.
* usermux/usermux.c: Likewise.
* utils/fakeauth.c: Likewise.
* utils/frobauth.c: Likewise.
* utils/login.c: Likewise.
* utils/x.c: Likewise.
|
|
* libdiskfs/diskfs.h (diskfs_begin_using_protid_payload): New function.
(diskfs_begin_using_control_payload): Likewise.
(diskfs_begin_using_bootinfo_payload): Likewise.
* libdiskfs/fsmutations.h: Add mutators.
|
|
* libdiskfs/dir-init.c (diskfs_init_dir): Fix fabrication of protid.
|
|
Previously, the Hurd (ab)used the fact that the startup server speaks
all protocols on its message port. Any server that wished to register
for shutdown notifications would use proc_getmsgport to get a port to
the startup server.
This hardcodes the PID of /hurd/startup, and does not allow one to
point a server to ones own startup server (e.g. using remap).
Bind the startup server to /servers/startup instead. Use this to
contact the startup server.
* exec/main.c (S_exec_init): Use /servers/startup. Fall back to the
old method so that the system still boots when the node
/servers/startup is missing.
* hurd/paths.h (_SERVERS_STARTUP): New macro.
* libdiskfs/boot-start.c (diskfs_S_fsys_init): Use /servers/startup.
* libdiskfs/init-startup.c (_diskfs_init_completed): Likewise.
* pfinet/main.c (arrange_shutdown_notification): Likewise.
* startup/Makefile (OBJS): Add fsysServer.o.
* startup/startup.c (demuxer): Handle the fsys protocol.
(main): Bind to /servers/startup.
(S_fsys_getroot): Implement fsys_getroot. Stub out the rest.
|
|
This patch series splits /hurd/init into two programs. As a first
step, this patch renames /hurd/init to /hurd/startup. It is called
startup because it speaks the startup protocol.
* startup: Rename init to startup. Adjust accordingly.
* Makefile (prog-subdirs): Likewise.
* doc/hurd.texi (Server Bootstrap): Likewise.
* hurd/paths.h (_HURD_STARTUP): Likewise.
* libdiskfs/boot-start.c (diskfs_boot_init_program): Likewise.
* libdiskfs/opts-std-startup.c (startup_options): Likewise.
|
|
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Prepend current path to
the relative path before recording the active translator.
|
|
Some versions of gnumach actually take address as a mapping hint, and would fail
if the hint is bogus. Make sure to pass 0 for those versions.
* console/pager.c (user_pager_create): Make sure to set *user to 0 before
calling vm_map.
* libdiskfs/disk-pager.c (diskfs_start_disk_pager): Make sure to set *image to 0
before calling vm_map.
* libpager/pager-memcpy.c (pager_memcpy): Set window to 0 before calling
vm_map.
* tmpfs/node.c (diskfs_get_filemap): Make sure to set np->dn->u.reg.memref to 0
before calling vm_map.
|
|
Previously, libpager used an unbounded number of threads to receive
messages from the pager bucket. It used sequence barriers to execute
the requests to order requests to each object.
The sequence barriers are implemented in seqnos.c. A server function
uses _pager_wait_for_seqno to wait for its sequence number and
_pager_release_seqno to release it, or it uses _pager_update_seqno to
do both operations in one step.
These sequence barriers divide each server function in three parts: A,
B, and C. A_i happens "before" the sequence barrier i, B_i happens
"in order", C_i happens "after" the sequence barrier. This partial
order < has the following properties:
* This order is *per object*. Requests to different objects are not
ordered.
* A_i < B_i, B_i < C_i (due to the structure of the code)
* B_i < B_{i+1} (this is due to the sequence barriers)
* Note that only the B parts are ordered by the sequence numbers, we
are free to execute C_i and C_{i+1} in any possible order. The same
argument applies to the A parts.
The sequence barriers are implemented using a very simple ticket
algorithm. Every request, even the invalid ones, is processed by a
thread, and waits until the ticket count reaches its seqno, does some
work in-order, then increments the ticket and awakes all threads that
have piled up up to this moment. All of them except one will then
discover that it's not their turn yet and go to sleep again.
Creating one thread per request has proven to be problematic as
memory_object requests often arrive in large batches.
This patch does two things:
* Use a single thread to receive messages from the port bucket. All
incoming request are put into a queue.
* Use a fixed-number of threads (though even one is actually enough)
to execute the the server functions. If multiple threads are used,
a work-delegation mechanism ensures that the per object order < is
preserved.
For reference, I used the following command to create workloads that
highlight the problem this patch is addressing:
% settrans t .../ext2fs --sync=30 /dev/sd2s1
...
% /usr/bin/time zsh -c 'for ((i=0; i < 1500; i++)); do
dd if=/dev/zero of=t/src/$i bs=4k count=290 2>/dev/null
echo -n .
if ((i % 100 == 0)) ; then echo -n $i; fi
done'
* libpager/queue.h: New file.
* libpager/demuxer.c: Manage a queue of requests received from the
port bucket.
(pager_demuxer): Just decode the server function and enqueue the
request.
(worker_func): New function that consumes and executes the requests
from the queue.
(service_paging_requests): New function.
(pager_start_workers): Likewise.
* libpager/data-request.c: Remove the seqno barriers.
* libpager/data-return.c: Likewise.
* libpager/data-unlock.c: Likewise.
* libpager/chg-compl.c: Likewise.
* libpager/lock-completed.c: Likewise.
* libpager/no-senders.c: Likewise.
* libpager/notify-stubs.c: Likewise.
* libpager/object-init.c: Likewise.
* libpager/object-terminate.c: Likewise.
* libpager/seqnos.c: Remove file.
* libpager/stubs.c: Likewise.
* libpager/pager.h (pager_demuxer): Drop declaration.
(pager_start_workers): New declaration.
* libpager/priv.h: Remove the _pager_seqno declarations.
* libpager/Makefile (SRCS): Drop seqnos.c.
* console/pager.c (user_pager_init): Call pager_start_workers.
* libdiskfs/disk-pager.c: Likewise.
* storeio/pager.c: Likewise.
* ext2fs/pager.c (service_paging_requests): Remove function.
(create_disk_pager): Start separate file pager using
`pager_start_workers'.
* fatfs/pager.c (service_paging_requests): Remove function.
(create_fat_pager): Start separate file pager using
`pager_start_workers'.
|
|
* libcons/extra-version.c (cons_extra_version): Add weak attribute.
* libcons/vcons-add.c (cons_vcons_add): Likewise.
* libcons/vcons-remove.c (cons_vcons_remove): Likewise.
* libdiskfs/extra-version.c (diskfs_extra_version): Likewise.
* libdiskfs/get-source.c (diskfs_get_source): Likewise.
* libdiskfs/readonly-changed.c (diskfs_readonly_changed): Likewise.
* libdiskfs/sync-default.c (diskfs_default_sync_interval): Likewise.
* libdiskfs/validate-author.c (diskfs_validate_author_change): Likewise.
* libdiskfs/validate-flags.c (diskfs_validate_flags_change): Likewise.
* libdiskfs/validate-group.c (diskfs_validate_group_change): Likewise.
* libdiskfs/validate-mode.c (diskfs_validate_mode_change): Likewise.
* libdiskfs/validate-owner.c (diskfs_validate_owner_change): Likewise.
* libdiskfs/validate-rdev.c (diskfs_validate_rdev_change): Likewise.
* libnetfs/file-get-storage-info-default.c (netfs_file_get_storage_info):
Likewise.
* libnetfs/get-source.c (netfs_get_source): Likewise.
* libnetfs/set-get-trans.c (netfs_set_translator, netfs_get_translator):
Likewise.
* libtrivfs/get-source.c (trivfs_get_source): Likewise.
|
|
* libdiskfs/lookup.c (cache_misses): Remove.
(cm_lock): Likewise.
(diskfs_lookup): Do not count cache misses.
|