* libamu/xutil.c (clocktime): newly implemented routine. Uses after-clocktime-fixes-61-br
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 17 Sep 2005 22:19:44 +0000 (22:19 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Sat, 17 Sep 2005 22:19:44 +0000 (22:19 +0000)
commit56166bf634b5b5988e6a28f0d754a7b79dac41dc
tree7e455415140952d4e1b4a5d72876b1d8f23014de
parentc491ea804e87fcf6fcb477835f44a265baf1bdfb
* libamu/xutil.c (clocktime): newly implemented routine.  Uses
gettimeofday() each time to return a high-resolution clock time,
and does not "cache" the last time.  Returns time in seconds, just
like the old implementation.  If passed a non-null argument, will
fill it in with the current time in seconds+microseconds.

* libamu/xutil.c: remove actual declaration of clock_valid, and
another never-used declaration for xclock_valid.

* include/am_utils.h: remove defunct definition of clocktime()
macro and clock_valid variable.  Add extern for new definition.

* libamu/mount_fs.c (mount_fs), hlfsd/homedir.c (homedir,
hlfsd_diskspace, hlfsd_getpwent, plt_reset, table_add),
hlfsd/hlfsd.c (main, hlfsd_init, reload, cleanup),
conf/mtab/mtab_mach3.c (open_locked_mtab), conf/mtab/mtab_file.c
(open_locked_mtab), amd/nfs_start.c (do_select, run_rpc),
amd/autil.c (host_normalize): remove defunct clock_valid.

* amd/nfs_subr.c (nfsproc_getattr_2_svc): Print microseconds for
node's mtime.
(fh_to_mp3): use new clocktime() to update mtime and get a better
time resolution.

* amd/mapc.c (mapc_reload_map): change prototype from returning
void to returning an int.  If reloading was needed and succeeded,
return 1; else return 0.
(mapc_sync): update mtime of parent node if needed.  This is a
CRITICAL FIX, to ensure that the kernel flushes its DNLC/dcache
when we run "amq -f" manually or when a map is reloaded.

* amd/map.c (new_ttl): update am_ttl and na_atime in one shot.
(init_map): use new clocktime().
(unmount_mp): if the OS doesn't support a "symttl" option, then
update the mtime of the parent node using the clocktime(); but if
the time hasn't gotten changed because of rapid Amd accesses on
systems that don't have a micro-second NFS-client resolution, then
increment mtime by one arbitrarily (this could, on some systems
and under pathological cases, result in mtime's that are in the
future).

* amd/autil.c (forcibly_timeout_mp): MAJOR BUG FIX: force mtime
update of parent dir, to prevent DNLC/dcache from caching the old
entry, which could result in ESTALE errors, bad symlinks, and
more.
(am_mounted): record mount time, and update am_stats at the same
time, using the double-action redone clocktime() routine.
(am_mounted): update parent's mtime from that of the child.
(am_unmounted): when unmounting an entry, update mtime of parent
node.

* amd/amfs_generic.c (amfs_bgmount): now that clocktime() doesn't
remember it's last non-zero value, save it in a temporary variable
to avoid a TOCTOU problem (between an "if" and a "dlog").

* libamu/xutil.c (show_time_host_and_name),
conf/autofs/autofs_linux.c (autofs_mounted, autofs_timeout_mp),
amd/srvr_nfs.c (nfs_keepalive_callback, nfs_keepalive_timeout)
(find_nfs_srvr), amd/rpc_fwd.c (fwd_alloc), amd/nfs_subr.c
(nfsproc_getattr_2_svc), amd/nfs_start.c (do_select, run_rpc),
amd/mapc.c (root_init), amd/map.c(map_flush_srvr, timeout_mp),
amd/info_ndbm.c (ndbm_init), amd/info_ldap.c (amu_ldap_rebind),
amd/info_file.c (file_open), amd/info_exec.c (fgets_timed,
exec_search), amd/clock.c (timeout, softclock), amd/autil.c
(forcibly_timeout_mp), amd/amfs_generic.c (amfs_retry,
amfs_bgmount, amfs_generic_mount_child), amd/amd.c (main): pass
NULL to clocktime().
25 files changed:
ChangeLog
NEWS
amd/amd.c
amd/amfs_generic.c
amd/autil.c
amd/clock.c
amd/info_exec.c
amd/info_file.c
amd/info_ldap.c
amd/info_ndbm.c
amd/map.c
amd/mapc.c
amd/nfs_start.c
amd/nfs_subr.c
amd/rpc_fwd.c
amd/srvr_nfs.c
conf/autofs/autofs_linux.c
conf/mtab/mtab_file.c
conf/mtab/mtab_mach3.c
hlfsd/hlfsd.c
hlfsd/homedir.c
include/am_utils.h
libamu/mount_fs.c
libamu/xutil.c
vers.m4