summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-10-02 06:14:33 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-02 06:30:09 -0700
commit73c6b2f21a67bed186a279adacb4eb28eafcd853 (patch)
treeb8a279cbdb603796bfb9c828e86f96583ab85bc3
parent99ff5f22db3404abbbab6e7d7edabe930762118d (diff)
protocol/client: Fix dumping of locks in client.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 865 (Add locks recovery support in GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=865
-rw-r--r--xlators/protocol/client/src/client-lk.c15
-rw-r--r--xlators/protocol/client/src/client.h2
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c5
3 files changed, 9 insertions, 13 deletions
diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c
index c5696500c5e..b6944ba40b1 100644
--- a/xlators/protocol/client/src/client-lk.c
+++ b/xlators/protocol/client/src/client-lk.c
@@ -914,20 +914,16 @@ client_dump_locks (char *name, inode_t *inode,
dict_t *dict)
{
int ret = 0;
+ dict_t *new_dict = NULL;
char dict_string[256];
+ GF_ASSERT (dict);
+ new_dict = dict;
+
ret = dump_client_locks (inode);
snprintf (dict_string, 256, "%d locks dumped in log file", ret);
- dict = dict_new ();
- if (!dict) {
- gf_log (THIS->name, GF_LOG_DEBUG,
- "Out of memory");
- ret = -1;
- goto out;
- }
-
- ret = dict_set_str (dict, "trusted.glusterfs.clientlk-dump", dict_string);
+ ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
if (ret) {
gf_log (THIS->name, GF_LOG_DEBUG,
"Could not set dict with %s", CLIENT_DUMP_LOCKS);
@@ -935,6 +931,7 @@ client_dump_locks (char *name, inode_t *inode,
}
out:
+
return ret;
}
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 1e90c5935cf..0586dcb61d5 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -120,7 +120,7 @@ typedef struct client_args {
loc_t *oldloc;
loc_t *newloc;
const char *name;
- struct gf_flock *flock;
+ struct gf_flock *flock;
const char *volume;
const char *basename;
off_t offset;
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 786db4c7903..f4a9b198808 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -4081,6 +4081,7 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
if (args && args->name) {
if (is_client_dump_locks_cmd ((char *)args->name)) {
+ dict = dict_new ();
ret = client_dump_locks ((char *)args->name,
args->loc->inode,
dict);
@@ -4111,9 +4112,7 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
return 0;
unwind:
- STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, NULL);
- if (dict)
- dict_unref (dict);
+ STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
return 0;
}