All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch 2/4] chunkd: clean-up return paths
@ 2009-12-27 23:59 Pete Zaitcev
  0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2009-12-27 23:59 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Project Hail List

This version leaves fs_free alone and preserves the quick-quit mechanism.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

---
 server/be-fs.c  |   10 ++++++----
 server/server.c |   15 ++++++++-------
 2 files changed, 14 insertions(+), 11 deletions(-)

commit 354d8a8d2c5ce689fbca6ffb3d1fd2efab07c938
Author: Master <zaitcev@lembas.zaitcev.lan>
Date:   Sun Dec 27 15:55:07 2009 -0700

    Agreed cleanup, leaving fs_free alone.

diff --git a/server/be-fs.c b/server/be-fs.c
index 1f8f1a5..2c63541 100644
--- a/server/be-fs.c
+++ b/server/be-fs.c
@@ -75,7 +75,7 @@ int fs_open(void)
 	}
 
 	if (!tchdbsetmutex(hdb))
-		goto out_hdb;
+		goto out_mut;
 
 	omode = HDBOREADER | HDBONOLCK | HDBOWRITER | HDBOCREAT | HDBOTSYNC;
 	if (!tchdbopen(hdb, db_fn, omode)) {
@@ -86,13 +86,15 @@ int fs_open(void)
 
 	chunkd_srv.tbl_master = hdb;
 
-out:
 	free(db_fn);
-	return rc;
+	return 0;
 
+out_mut:
 out_hdb:
 	tchdbdel(hdb);
-	goto out;
+out:
+	free(db_fn);
+	return rc;
 }
 
 void fs_close(void)
diff --git a/server/server.c b/server/server.c
index 381772b..3f38cca 100644
--- a/server/server.c
+++ b/server/server.c
@@ -1664,13 +1664,13 @@ int main (int argc, char *argv[])
 
 	if (fs_open()) {
 		rc = 1;
-		goto err_out_session;
+		goto err_out_fs;
 	}
 
 	if (cld_begin(chunkd_srv.ourhost, chunkd_srv.cell, chunkd_srv.nid,
 		      &chunkd_srv.loc, NULL)) {
 		rc = 1;
-		goto err_out_fs;
+		goto err_out_cld;
 	}
 
 	/* set up server networking */
@@ -1686,19 +1686,20 @@ int main (int argc, char *argv[])
 
 	applog(LOG_INFO, "shutting down");
 
+	/* net_close(); */
 err_out_listen:
 	cld_end();
-err_out_fs:
+err_out_cld:
 	fs_close();
+err_out_fs:
+	if (strict_free)
+		g_hash_table_destroy(chunkd_srv.fd_info);
 err_out_session:
-	/* net_close(); */
 	unlink(chunkd_srv.pid_file);
 	close(chunkd_srv.pid_fd);
 err_out:
-	if (strict_free) {
+	if (strict_free)
 		fs_free();
-		g_hash_table_destroy(chunkd_srv.fd_info);
-	}
 	closelog();
 	return rc;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-27 23:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-27 23:59 [Patch 2/4] chunkd: clean-up return paths Pete Zaitcev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.