This is the mail archive of the lvm2-cvs@sourceware.org mailing list for the LVM2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LVM2/daemons/clvmd clvmd.c


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-11 09:56:45

Modified files:
	daemons/clvmd  : clvmd.c 

Log message:
	Add some fixme locking
	
	Code here is using thread write protected variable without locking.
	So add locking, for proper synchronization and a FIXME, since the
	code needs closer look.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115

--- LVM2/daemons/clvmd/clvmd.c	2011/10/11 09:54:39	1.114
+++ LVM2/daemons/clvmd/clvmd.c	2011/10/11 09:56:44	1.115
@@ -747,12 +747,16 @@
 				send_local_reply(sock_client, status,
 						 sock_client->fd);
 			else {
+				/* FIXME: closer inspect this code since state is write thread protected */
+				pthread_mutex_lock(&sock_client->bits.localsock.mutex);
 				if (sock_client->bits.localsock.state ==
 				    POST_COMMAND) {
+					pthread_mutex_unlock(&sock_client->bits.localsock.mutex);
 					send_local_reply(sock_client, 0,
 							 sock_client->fd);
 				} else	// PRE_COMMAND finished.
 				{
+					pthread_mutex_unlock(&sock_client->bits.localsock.mutex);
 					if (
 					    (status =
 					     distribute_command(sock_client)) !=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]