if (lock_mode == LCK_UNLOCK) {
+ DEBUGLOG("PRE: UNLOCK\n");
lkid = (int)(long)dm_hash_lookup(lock_hash, lockname);
- if (lkid == 0)
+ if (lkid == 0) {
+ DEBUGLOG("lock not found in table\n");
return EINVAL;
+ }
status = sync_unlock(lockname, lkid);
if (status)
dm_hash_remove(lock_hash, lockname);
}
else {
+ DEBUGLOG("PRE: LOCK\n");
/* Read locks need to be PR; other modes get passed through */
if (lock_mode == LCK_READ)
lock_mode = LCK_PREAD;
int pipe_fd = client->bits.localsock.pipe;
DEBUGLOG("in sub thread: client = %p\n", client);
+ pthread_mutex_lock(&client->bits.localsock.mutex);
/* Don't start until the LVM thread is ready */
pthread_mutex_lock(&lvm_start_mutex);
}
/* We may need to wait for the condition variable before running the post command */
- pthread_mutex_lock(&client->bits.localsock.mutex);
DEBUGLOG("Waiting to do post command - state = %d\n",
client->bits.localsock.state);
pthread_cond_wait(&client->bits.localsock.cond,
&client->bits.localsock.mutex);
}
- pthread_mutex_unlock(&client->bits.localsock.mutex);
DEBUGLOG("Got post command condition...\n");
next_pre:
DEBUGLOG("Waiting for next pre command\n");
- pthread_mutex_lock(&client->bits.localsock.mutex);
if (client->bits.localsock.state != PRE_COMMAND &&
!client->bits.localsock.finished) {
pthread_cond_wait(&client->bits.localsock.cond,
&client->bits.localsock.mutex);
}
- pthread_mutex_unlock(&client->bits.localsock.mutex);
DEBUGLOG("Got pre command condition...\n");
}
+ pthread_mutex_unlock(&client->bits.localsock.mutex);
DEBUGLOG("Subthread finished\n");
pthread_exit((void *) 0);
}