Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
autofs.5460
autofs-5-1-1-use-monotonic-clock-for-direct-mou...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File autofs-5-1-1-use-monotonic-clock-for-direct-mount-condition.patch of Package autofs.5460
From: Yu Ning <ning.yu@ubuntu.com> Subject: autofs-5.1.1 - use monotonic clock for direct mount condition Git-repo: git://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git Git-commit: ebfd6834999c3dd25e1b323bdd4908c77caef930 Patch-mainline: 5.1.2 References: bsc#1046493 The time returned by gettimeofday() is affected by discontinuous jumps in the system time, so it causes an issue that autofs may not auto unmount a mount point if system time is manually changed by the system administrator. To fix the issue we need to convert to using a monotonic clock source instead of the clock source used by gettimeofday(). Change the direct mount and expire thread creation to use a monotonic clock source. Signed-off-by: Yu Ning <ning.yu@ubuntu.com> Signed-off-by: Ian Kent <raven@themaw.net> Acked-by: Jeff Mahoney <jeffm@suse.com> --- daemon/direct.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) --- a/daemon/direct.c +++ b/daemon/direct.c @@ -1041,7 +1041,6 @@ int handle_packet_expire_direct(struct a char buf[MAX_ERR_BUF]; pthread_t thid; struct timespec wait; - struct timeval now; int status, state; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); @@ -1111,9 +1110,7 @@ int handle_packet_expire_direct(struct a return 1; } - status = pthread_cond_init(&mt->cond, NULL); - if (status) - fatal(status); + pending_cond_init(mt); status = pthread_mutex_init(&mt->mutex, NULL); if (status) @@ -1159,9 +1156,8 @@ int handle_packet_expire_direct(struct a mt->signaled = 0; while (!mt->signaled) { - gettimeofday(&now, NULL); - wait.tv_sec = now.tv_sec + 2; - wait.tv_nsec = now.tv_usec * 1000; + clock_gettime(CLOCK_MONOTONIC, &wait); + wait.tv_sec += 2; status = pthread_cond_timedwait(&mt->cond, &mt->mutex, &wait); if (status && status != ETIMEDOUT) fatal(status); @@ -1296,7 +1292,6 @@ int handle_packet_missing_direct(struct char buf[MAX_ERR_BUF]; int status = 0; struct timespec wait; - struct timeval now; int ioctlfd, len, state; unsigned int kver_major = get_kver_major(); unsigned int kver_minor = get_kver_minor(); @@ -1427,9 +1422,7 @@ int handle_packet_missing_direct(struct } memset(mt, 0, sizeof(struct pending_args)); - status = pthread_cond_init(&mt->cond, NULL); - if (status) - fatal(status); + pending_cond_init(mt); status = pthread_mutex_init(&mt->mutex, NULL); if (status) @@ -1478,9 +1471,8 @@ int handle_packet_missing_direct(struct mt->signaled = 0; while (!mt->signaled) { - gettimeofday(&now, NULL); - wait.tv_sec = now.tv_sec + 2; - wait.tv_nsec = now.tv_usec * 1000; + clock_gettime(CLOCK_MONOTONIC, &wait); + wait.tv_sec += 2; status = pthread_cond_timedwait(&mt->cond, &mt->mutex, &wait); if (status && status != ETIMEDOUT) fatal(status);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor