File autofs-5.0.6-fix-wait-for-master-source-mutex.patch of Package autofs.import5769
commit 752a866e55a047b2967de84d028a7fc111b60006
Author: Ian Kent <ikent@redhat.com>
Date: Thu Dec 1 15:26:47 2011 +0800
autofs-5.0.6 - fix wait for master source mutex
A previous change that was meant to handle the case where the master map
source mutex read lock count was exceeded was incorrectly done for the
write lock case instead of the read lock case.
Index: autofs-5.0.5/lib/master.c
===================================================================
--- autofs-5.0.5.orig/lib/master.c
+++ autofs-5.0.5/lib/master.c
@@ -536,38 +536,38 @@ void send_map_update_request(struct auto
void master_source_writelock(struct master_mapent *entry)
{
- int retries = 5; /* 1 second maximum */
int status;
- while (retries--) {
- status = pthread_rwlock_wrlock(&entry->source_lock);
- if (status != EAGAIN)
- break;
- else {
- struct timespec t = { 0, 200000000 };
- struct timespec r;
- while (nanosleep(&t, &r) == -1 && errno == EINTR)
- memcpy(&t, &r, sizeof(struct timespec));
- }
- }
-
+ status = pthread_rwlock_wrlock(&entry->source_lock);
if (status) {
logmsg("master_mapent source write lock failed");
fatal(status);
}
-
return;
}
void master_source_readlock(struct master_mapent *entry)
{
+ int retries = 5; /* 1 second maximum */
int status;
- status = pthread_rwlock_rdlock(&entry->source_lock);
+ while (retries--) {
+ status = pthread_rwlock_tryrdlock(&entry->source_lock);
+ if (status != EAGAIN && status != EBUSY)
+ break;
+ else {
+ struct timespec t = { 0, 200000000 };
+ struct timespec r;
+ while (nanosleep(&t, &r) == -1 && errno == EINTR)
+ memcpy(&t, &r, sizeof(struct timespec));
+ }
+ }
+
if (status) {
logmsg("master_mapent source read lock failed");
fatal(status);
}
+
return;
}
Index: autofs-5.0.5/CHANGELOG
===================================================================
--- autofs-5.0.5.orig/CHANGELOG
+++ autofs-5.0.5/CHANGELOG
@@ -86,6 +86,7 @@
- fix LDAP result leaks on error paths.
- fix fix LDAP result leaks on error paths.
- code analysis fixes part 1.
+- fix wait for master source mutex.
03/09/2009 autofs-5.0.5
-----------------------