summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-locks.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-locks.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 0737a731e..d2601ebb8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -26,17 +26,17 @@
#include <signal.h>
-static dict_t *vol_lock;
+static dict_t *mgmt_v3_lock;
-/* Initialize the global vol-lock list(dict) when
+/* Initialize the global mgmt_v3 lock list(dict) when
* glusterd is spawned */
int32_t
-glusterd_vol_lock_init ()
+glusterd_mgmt_v3_lock_init ()
{
int32_t ret = -1;
- vol_lock = dict_new ();
- if (!vol_lock) {
+ mgmt_v3_lock = dict_new ();
+ if (!mgmt_v3_lock) {
ret = -1;
goto out;
}
@@ -46,29 +46,29 @@ out:
return ret;
}
-/* Destroy the global vol-lock list(dict) when
+/* Destroy the global mgmt_v3 lock list(dict) when
* glusterd cleanup is performed */
void
-glusterd_vol_lock_fini ()
+glusterd_mgmt_v3_lock_fini ()
{
- if (vol_lock)
- dict_destroy (vol_lock);
+ if (mgmt_v3_lock)
+ dict_destroy (mgmt_v3_lock);
}
int32_t
-glusterd_get_vol_lock_owner (char *volname, uuid_t *uuid)
+glusterd_get_mgmt_v3_lock_owner (char *key, uuid_t *uuid)
{
- int32_t ret = -1;
- vol_lock_obj *lock_obj = NULL;
- uuid_t no_owner = {"\0"};
+ int32_t ret = -1;
+ mgmt_v3_lock_obj *lock_obj = NULL;
+ uuid_t no_owner = {"\0"};
- if (!volname || !uuid) {
- gf_log ("", GF_LOG_ERROR, "volname or uuid is null.");
+ if (!key || !uuid) {
+ gf_log ("", GF_LOG_ERROR, "key or uuid is null.");
ret = -1;
goto out;
}
- ret = dict_get_bin(vol_lock, volname, (void **) &lock_obj);
+ ret = dict_get_bin(mgmt_v3_lock, key, (void **) &lock_obj);
if (!ret)
uuid_copy (*uuid, lock_obj->lock_owner);
else
@@ -81,7 +81,7 @@ out:
}
int32_t
-glusterd_multiple_volumes_unlock (dict_t *dict, uuid_t uuid)
+glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid)
{
int32_t ret = -1;
int32_t op_ret = 0;
@@ -116,7 +116,7 @@ glusterd_multiple_volumes_unlock (dict_t *dict, uuid_t uuid)
goto out;
}
- ret = glusterd_volume_unlock (volname, uuid);
+ ret = glusterd_mgmt_v3_unlock (volname, uuid);
if (ret) {
gf_log ("", GF_LOG_ERROR,
"Failed to release lock for %s. ", volname);
@@ -131,7 +131,7 @@ out:
}
int32_t
-glusterd_multiple_volumes_lock (dict_t *dict, uuid_t uuid)
+glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid)
{
int32_t ret = -1;
int32_t i = -1;
@@ -166,13 +166,13 @@ glusterd_multiple_volumes_lock (dict_t *dict, uuid_t uuid)
goto out;
}
- ret = glusterd_volume_lock (volname, uuid);
+ ret = glusterd_mgmt_v3_lock (volname, uuid);
if (ret) {
gf_log ("", GF_LOG_ERROR,
"Failed to acquire lock for %s "
- "on behalf of %s. Unlocking "
- "other volumes locked by this "
- "transaction", volname, uuid_utoa(uuid));
+ "on behalf of %s. Reversing "
+ "this transaction", volname,
+ uuid_utoa(uuid));
break;
}
locked_volcount ++;
@@ -193,7 +193,7 @@ glusterd_multiple_volumes_lock (dict_t *dict, uuid_t uuid)
goto out;
}
- ret = glusterd_volume_unlock (volname, uuid);
+ ret = glusterd_mgmt_v3_unlock (volname, uuid);
if (ret)
gf_log ("", GF_LOG_ERROR,
"Failed to release lock for %s.",
@@ -208,26 +208,26 @@ out:
}
int32_t
-glusterd_volume_lock (char *volname, uuid_t uuid)
+glusterd_mgmt_v3_lock (char *key, uuid_t uuid)
{
- int32_t ret = -1;
- vol_lock_obj *lock_obj = NULL;
- uuid_t owner = {0};
+ int32_t ret = -1;
+ mgmt_v3_lock_obj *lock_obj = NULL;
+ uuid_t owner = {0};
- if (!volname) {
- gf_log (THIS->name, GF_LOG_ERROR, "volname is null.");
+ if (!key) {
+ gf_log (THIS->name, GF_LOG_ERROR, "key is null.");
ret = -1;
goto out;
}
gf_log (THIS->name, GF_LOG_TRACE,
"Trying to acquire lock of %s for %s",
- volname, uuid_utoa (uuid));
+ key, uuid_utoa (uuid));
- ret = glusterd_get_vol_lock_owner (volname, &owner);
+ ret = glusterd_get_mgmt_v3_lock_owner (key, &owner);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
- "Unable to get volume lock owner");
+ "Unable to get mgmt_v3 lock owner");
goto out;
}
@@ -235,13 +235,13 @@ glusterd_volume_lock (char *volname, uuid_t uuid)
* we fail */
if (!uuid_is_null (owner)) {
gf_log (THIS->name, GF_LOG_ERROR, "Lock for %s held by %s",
- volname, uuid_utoa (owner));
+ key, uuid_utoa (owner));
ret = -1;
goto out;
}
- lock_obj = GF_CALLOC (1, sizeof(vol_lock_obj),
- gf_common_mt_vol_lock_obj_t);
+ lock_obj = GF_CALLOC (1, sizeof(mgmt_v3_lock_obj),
+ gf_common_mt_mgmt_v3_lock_obj_t);
if (!lock_obj) {
ret = -1;
goto out;
@@ -249,18 +249,18 @@ glusterd_volume_lock (char *volname, uuid_t uuid)
uuid_copy (lock_obj->lock_owner, uuid);
- ret = dict_set_bin (vol_lock, volname, lock_obj,
- sizeof(vol_lock_obj));
+ ret = dict_set_bin (mgmt_v3_lock, key, lock_obj,
+ sizeof(*lock_obj));
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR,
- "Unable to set lock owner in volume lock");
+ "Unable to set lock owner in mgmt_v3 lock");
if (lock_obj)
GF_FREE (lock_obj);
goto out;
}
gf_log (THIS->name, GF_LOG_DEBUG, "Lock for %s successfully held by %s",
- volname, uuid_utoa (uuid));
+ key, uuid_utoa (uuid));
ret = 0;
out:
@@ -269,30 +269,30 @@ out:
}
int32_t
-glusterd_volume_unlock (char *volname, uuid_t uuid)
+glusterd_mgmt_v3_unlock (char *key, uuid_t uuid)
{
int32_t ret = -1;
uuid_t owner = {0};
- if (!volname) {
- gf_log (THIS->name, GF_LOG_ERROR, "volname is null.");
+ if (!key) {
+ gf_log (THIS->name, GF_LOG_ERROR, "key is null.");
ret = -1;
goto out;
}
gf_log (THIS->name, GF_LOG_TRACE, "Trying to release lock of %s for %s",
- volname, uuid_utoa (uuid));
+ key, uuid_utoa (uuid));
- ret = glusterd_get_vol_lock_owner (volname, &owner);
+ ret = glusterd_get_mgmt_v3_lock_owner (key, &owner);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
- "Unable to get volume lock owner");
+ "Unable to get mgmt_v3 lock owner");
goto out;
}
if (uuid_is_null (owner)) {
gf_log (THIS->name, GF_LOG_ERROR,
- "Lock for %s not held", volname);
+ "Lock for %s not held", key);
ret = -1;
goto out;
}
@@ -302,15 +302,15 @@ glusterd_volume_unlock (char *volname, uuid_t uuid)
gf_log (THIS->name, GF_LOG_ERROR, "Lock owner mismatch. "
"Lock for %s held by %s",
- volname, uuid_utoa (owner));
+ key, uuid_utoa (owner));
goto out;
}
- /* Removing the volume lock from the global list */
- dict_del (vol_lock, volname);
+ /* Removing the mgmt_v3 lock from the global list */
+ dict_del (mgmt_v3_lock, key);
gf_log (THIS->name, GF_LOG_DEBUG, "Lock for %s successfully released",
- volname);
+ key);
ret = 0;
out: