src/cmd.c | 6 +++---
src/delta_lease.c | 2 ++
src/main.c | 6 +++++-
3 files changed, 10 insertions(+), 4 deletions(-)
New commits:
commit 686a5949e83094c7c3b51de37ada5aa700d74fe0
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 25 14:56:18 2013 -0500
sanlock: initialize send_len and send_buf
in read_resource_owners for error exit path
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/cmd.c b/src/cmd.c
index 39e72d5..050f595 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1400,7 +1400,7 @@ static void cmd_read_resource_owners(struct task *task, struct
cmd_args *ca)
struct sanlk_resource res;
struct token *token = NULL;
char *send_buf;
- int token_len, disks_len, send_len;
+ int token_len, disks_len, send_len = 0;
int j, fd, rv, result, count = 0;
fd = client[ca->ci_in].fd;
@@ -1486,7 +1486,7 @@ static void cmd_read_resource_owners(struct task *task, struct
cmd_args *ca)
h.length = sizeof(h) + sizeof(res) + send_len;
send(fd, &h, sizeof(h), MSG_NOSIGNAL);
send(fd, &res, sizeof(res), MSG_NOSIGNAL);
- if (send_len) {
+ if (send_len && send_buf) {
send(fd, send_buf, send_len, MSG_NOSIGNAL);
free(send_buf);
}
commit 6976984dbe90ff1563f1b1bd15c2107bdeb23b8b
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 25 14:54:13 2013 -0500
sanlock: initialize owner_id
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/cmd.c b/src/cmd.c
index da56d9d..39e72d5 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -787,7 +787,7 @@ static void cmd_request(struct task *task, struct cmd_args *ca)
struct token *token;
struct sanlk_resource res;
struct space_info spi;
- uint64_t owner_id;
+ uint64_t owner_id = 0;
uint32_t force_mode;
int token_len, disks_len;
int j, fd, rv, error, result;
commit c130ca3c8d2b1abba8719a38708b3895f6c08a8f
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 25 14:51:08 2013 -0500
sanlock: fix read_lockspace name comparison
when the lockspace name is specified (rather than
blank), the comparison was random.
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/delta_lease.c b/src/delta_lease.c
index 19c342b..91d0a83 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -173,6 +173,8 @@ int delta_read_lockspace(struct task *task,
if (!ls->name[0])
space_name = leader.space_name;
+ else
+ space_name = ls->name;
error = verify_leader(disk, space_name, host_id, &leader,
"read_lockspace");
commit 86fc2b926ef92cb113b7766641e487c3aa54b57b
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 25 14:27:25 2013 -0500
sanlock: reinit hss in loop
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/main.c b/src/main.c
index 2667263..23c27cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2205,6 +2205,9 @@ static int do_client_gets(void)
if (!com.get_hosts)
goto next;
+ hss = NULL;
+ hss_count = 0;
+
rv = sanlock_get_hosts(ls->name, 0, &hss, &hss_count, 0);
if (rv == -EAGAIN) {
log_tool("hosts not ready");
commit 6c6e1022d75f349537bcfda43d272290307ca405
Author: David Teigland <teigland(a)redhat.com>
Date: Thu Jul 25 14:24:18 2013 -0500
sanlock: free hss on error
Signed-off-by: David Teigland <teigland(a)redhat.com>
diff --git a/src/main.c b/src/main.c
index cac66ff..2667263 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2297,8 +2297,9 @@ static int do_client_read(void)
(unsigned long long)hs->generation);
hs++;
}
- free(hss);
out:
+ if (hss)
+ free(hss);
return rv;
}