[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sanlock-devel
Subject:    src/direct.c
From:       teigland () fedoraproject ! org (David Teigland)
Date:       2011-04-18 14:13:34
Message-ID: 20110418141334.D988F12033F () lists ! fedorahosted ! org
[Download RAW message or body]

 src/direct.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 3bc89aa936c38e488c967b19503068db369a8d00
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Mon Apr 18 14:44:51 2011 +0100

    direct: close disks after initialization

diff --git a/src/direct.c b/src/direct.c
index 42dc15c..fb85f53 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -86,7 +86,7 @@ static int do_paxos_action(int action,
 		rv = paxos_lease_init(ti, token, num_hosts, max_hosts);
 		if (rv < 0) {
 			log_tool("cannot initialize disks");
-			return -1;
+			goto exit_fail;
 		}
 		break;
 
@@ -97,7 +97,7 @@ static int do_paxos_action(int action,
 		rv = paxos_lease_acquire(ti, token, 0, &leader_ret, 0, num_hosts);
 		if (rv < 0) {
 			log_tool("cannot acquire lease on %s", token->r.name);
-			return -1;
+			goto exit_fail;
 		}
 		break;
 
@@ -105,19 +105,21 @@ static int do_paxos_action(int action,
 		rv = paxos_lease_leader_read(ti, token, &leader_read, "direct_release");
 		if (rv < 0) {
 			log_tool("cannot read lease on %s", token->r.name);
-			return -1;
+			goto exit_fail;
 		}
 		rv = paxos_lease_release(ti, token, &leader_read, &leader_ret);
 		if (rv < 0) {
 			log_tool("cannot release lease on %s", token->r.name);
-			return -1;
+			goto exit_fail;
 		}
 		break;
 	}
 
+exit_fail:
+	close_disks(token->disks, token->r.num_disks);
 	free(token);
 
-	return 0;
+	return rv;
 }
 
 /*
@@ -366,6 +368,8 @@ int direct_init(struct timeout *ti,
 		}
 
 		rv = delta_lease_init(ti, &sd, ls->name, max_hosts);
+	        close_disks(&sd, 1);
+
 		if (rv < 0) {
 			log_tool("lockspace init failed %d", rv);
 			return -1;



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic