1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix thread shutdown race which could cause clvmd to hang in pthread_join.

This commit is contained in:
Patrick Caulfield 2005-02-08 09:05:58 +00:00
parent 5937664052
commit ceda2b1426
2 changed files with 4 additions and 5 deletions

View File

@ -4,6 +4,7 @@ Version 2.01.04 -
Remove unused -f from pvmove.
Gulm clvmd doesn't report "connection refused" errors.
clvmd does a basic config file sanity check at startup.
Fix potential thread shutdown race in clvmd.
Version 2.01.03 - 1st February 2005
===================================

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -719,7 +719,7 @@ static int read_from_local_sock(struct local_client *thisfd)
if (thisfd->bits.localsock.threadid) {
DEBUGLOG("Waiting for child thread\n");
pthread_mutex_lock(&thisfd->bits.localsock.mutex);
thisfd->bits.localsock.state = POST_COMMAND;
thisfd->bits.localsock.state = PRE_COMMAND;
pthread_cond_signal(&thisfd->bits.localsock.cond);
pthread_mutex_unlock(&thisfd->bits.localsock.mutex);
pthread_kill(thisfd->bits.localsock.threadid, SIGUSR2);
@ -1336,14 +1336,12 @@ static void *pre_and_post_thread(void *arg)
DEBUGLOG("Got post command condition...\n");
/* POST function must always run, even if the client aborts */
status = 0;
do_post_command(client);
write(pipe_fd, &status, sizeof(int));
if (client->bits.localsock.finished)
break;
DEBUGLOG("Waiting for next pre command\n");
pthread_mutex_lock(&client->bits.localsock.mutex);