[SCM] SAMBA-CTDB repository - branch v3-4-ctdb updated - 3.4.2-ctdb-19-2-g381137d

Michael Adam obnox at samba.org
Thu Feb 4 02:10:59 MST 2010


The branch, v3-4-ctdb has been updated
       via  381137d4f1fef5c6c686b805fb0e320212958e2a (commit)
       via  b754d433865c8fbc396885e880218be8985c1cec (commit)
      from  1b2f479ad471592f0b53a4c6dc38f138cda2b7a5 (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-4-ctdb


- Log -----------------------------------------------------------------
commit 381137d4f1fef5c6c686b805fb0e320212958e2a
Author: Michael Adam <obnox at samba.org>
Date:   Wed Feb 3 17:16:57 2010 +0100

    v3-4-ctdb: Bump ctdb vendor patch level to 20
    
    Michael

commit b754d433865c8fbc396885e880218be8985c1cec
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 29 15:04:25 2010 +0100

    s3:make "net conf addshare" atomic by wrapping all writes in one transaction
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source3/VERSION          |    2 +-
 source3/utils/net_conf.c |   42 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 37 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/VERSION b/source3/VERSION
index f4dbe42..f70eb89 100644
--- a/source3/VERSION
+++ b/source3/VERSION
@@ -85,7 +85,7 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=no
 #                                                      #
 ########################################################
 SAMBA_VERSION_VENDOR_SUFFIX="ctdb"
-SAMBA_VERSION_VENDOR_PATCH=19
+SAMBA_VERSION_VENDOR_PATCH=20
 
 ########################################################
 # This can be set by vendors if they want..            #
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index ca3cb0b..11fedc0 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -670,6 +670,17 @@ static int net_conf_addshare(struct net_context *c,
 	}
 
 	/*
+	 * start a transaction
+	 */
+
+	werr = smbconf_transaction_start(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error starting transaction: %s\n",
+			 win_errstr(werr));
+		goto done;
+	}
+
+	/*
 	 * create the share
 	 */
 
@@ -677,7 +688,7 @@ static int net_conf_addshare(struct net_context *c,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error creating share %s: %s\n",
 			  sharename, win_errstr(werr));
-		goto done;
+		goto cancel;
 	}
 
 	/*
@@ -688,7 +699,7 @@ static int net_conf_addshare(struct net_context *c,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error setting parameter %s: %s\n",
 			  "path", win_errstr(werr));
-		goto done;
+		goto cancel;
 	}
 
 	if (comment != NULL) {
@@ -697,7 +708,7 @@ static int net_conf_addshare(struct net_context *c,
 		if (!W_ERROR_IS_OK(werr)) {
 			d_fprintf(stderr, "Error setting parameter %s: %s\n",
 				  "comment", win_errstr(werr));
-			goto done;
+			goto cancel;
 		}
 	}
 
@@ -705,7 +716,7 @@ static int net_conf_addshare(struct net_context *c,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error setting parameter %s: %s\n",
 			  "'guest ok'", win_errstr(werr));
-		goto done;
+		goto cancel;
 	}
 
 	werr = smbconf_set_parameter(conf_ctx, sharename, "writeable",
@@ -713,10 +724,29 @@ static int net_conf_addshare(struct net_context *c,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error setting parameter %s: %s\n",
 			  "writeable", win_errstr(werr));
-		goto done;
+		goto cancel;
 	}
 
-	ret = 0;
+	/*
+	 * commit the whole thing
+	 */
+
+	werr = smbconf_transaction_commit(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error committing transaction: %s\n",
+			 win_errstr(werr));
+	} else {
+		ret = 0;
+	}
+
+	goto done;
+
+cancel:
+	werr = smbconf_transaction_cancel(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error cancelling transaction: %s\n",
+			 win_errstr(werr));
+	}
 
 done:
 	TALLOC_FREE(mem_ctx);


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list