summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-locks.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-05-05 10:58:10 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-05-28 19:38:05 -0700
commit4397d7e72fdff6f01c59b72eebea421f23c1a392 (patch)
tree8c09329c2fbccaf5cb8a4c80ed8323a670ef0aa1 /xlators/mgmt/glusterd/src/glusterd-locks.c
parente6934debda3a67b5666f1aa30b33c5267de49d84 (diff)
glusterd/snapshot: Return correct errno in events of failure - PATCH 1
RETCODE ERROR ------------------------------------------- 30800 Internal Error 30801 Another Transaction In Progress Change-Id: Ica7fd2e513b2c28717b6df73cfb2667725dbf057 BUG: 1212413 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/10313 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-locks.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index c86dc8069da..0f9c2b26084 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -21,6 +21,7 @@
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
#include "glusterd-locks.h"
+#include "glusterd-errno.h"
#include "run.h"
#include "syscall.h"
@@ -191,6 +192,7 @@ out:
* volumes */
static int32_t
glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
+ uint32_t *op_errno,
int32_t count, char *type)
{
char name_buf[PATH_MAX] = "";
@@ -220,7 +222,7 @@ glusterd_acquire_multiple_locks_per_entity (dict_t *dict, uuid_t uuid,
break;
}
- ret = glusterd_mgmt_v3_lock (name, uuid, type);
+ ret = glusterd_mgmt_v3_lock (name, uuid, op_errno, type);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to acquire lock for %s %s "
@@ -330,8 +332,8 @@ out:
* if the type is "vol", this function will accordingly lock a single volume *
* or multiple volumes */
static int32_t
-glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, char *type,
- gf_boolean_t default_value)
+glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, uint32_t *op_errno,
+ char *type, gf_boolean_t default_value)
{
char name_buf[PATH_MAX] = "";
char *name = NULL;
@@ -369,7 +371,7 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, char *type,
goto out;
}
- ret = glusterd_mgmt_v3_lock (name, uuid, type);
+ ret = glusterd_mgmt_v3_lock (name, uuid, op_errno, type);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to acquire lock for %s %s "
@@ -381,6 +383,7 @@ glusterd_mgmt_v3_lock_entity (dict_t *dict, uuid_t uuid, char *type,
/* Locking one element name after another */
ret = glusterd_acquire_multiple_locks_per_entity (dict,
uuid,
+ op_errno,
count,
type);
if (ret) {
@@ -437,7 +440,7 @@ out:
/* Try to acquire locks on multiple entities like *
* volume, snaps etc. */
int32_t
-glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid)
+glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno)
{
int32_t i = -1;
int32_t ret = -1;
@@ -456,7 +459,7 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid)
/* Locking one entity after other */
for (i = 0; valid_types[i].type; i++) {
ret = glusterd_mgmt_v3_lock_entity
- (dict, uuid,
+ (dict, uuid, op_errno,
valid_types[i].type,
valid_types[i].default_value);
if (ret) {
@@ -494,7 +497,8 @@ out:
int32_t
-glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, char *type)
+glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
+ char *type)
{
char key[PATH_MAX] = "";
int32_t ret = -1;
@@ -550,6 +554,7 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, char *type)
"Lock for %s held by %s",
name, uuid_utoa (owner));
ret = -1;
+ *op_errno = EANOTRANS;
goto out;
}