Skip to contentSkip to conversation

Only do read locking in direct case

SEMANAGE Ivan Gyurdiev 1 participant 1 message Jan 17, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Pserver shouldn't do locking, and it will go through those same functions....
Pserver does locking on the server side, where the resource to be locked is located, not on the client side.

libsemanage/src/database.c +6 -2
diff -Naurp --exclude-from excludes old/libsemanage/src/database.c new/libsemanage/src/database.c
@@ -2,6 +2,7 @@
 
 #include <semanage/handle.h>
 #include "semanage_store.h"
+#include "semanage_conf.h"
 #include "database.h"
 #include "debug.h"
 
@@ -28,7 +29,9 @@ static int enter_ro(
 	if (assert_init(handle, dconfig) < 0)
 		goto err;
 
-	if (!handle->is_in_transaction) {
+	if (!handle->is_in_transaction &&
+	     handle->conf->store_type == SEMANAGE_CON_DIRECT) {
+
 		if (semanage_get_active_lock(handle) < 0) {
 			ERR(handle, "could not get the active lock");
 			goto err;
@@ -51,7 +54,8 @@ static inline int exit_ro(
 
 	int commit_num = handle->funcs->get_serial(handle); 
 
-	if (!handle->is_in_transaction) 
+	if (!handle->is_in_transaction && 
+	     handle->conf->store_type == SEMANAGE_CON_DIRECT) 
 		semanage_release_active_lock(handle);
 
 	return commit_num;