fixed lots of places that paniced on a failed transaction_commit,
authorAndrew Tridgell <tridge@samba.org>
Fri, 8 Aug 2008 01:42:06 +0000 (11:42 +1000)
committerMichael Adam <obnox@samba.org>
Wed, 13 Aug 2008 09:54:10 +0000 (11:54 +0200)
thinking it was a failure of a transaction cancel
(This used to be commit 22dbe158ed62ae47bbcb41bba3db345294f75437)

source3/groupdb/mapping_tdb.c
source3/lib/account_pol.c
source3/lib/dbwrap_ctdb.c
source3/lib/sharesec.c
source3/passdb/pdb_tdb.c

index 59c692297b3f7aa89f1735920acf8998f4e473a9..7cee53a9689cebdb261cb548464b5398b8c72e26 100644 (file)
@@ -521,7 +521,7 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member)
        if (db->transaction_commit(db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
                status = NT_STATUS_INTERNAL_DB_CORRUPTION;
-               goto cancel;
+               return status;
        }
 
        return NT_STATUS_OK;
@@ -705,7 +705,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
        if (db->transaction_commit(db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
                status = NT_STATUS_INTERNAL_DB_CORRUPTION;
-               goto cancel;
+               return status;
        }
 
        return NT_STATUS_OK;
index 7fc565121c7568b868ee2b8d4bde19ad787d29b1..1e435ca53e8cb9c2253ed41745082bbf83be0b76 100644 (file)
@@ -283,7 +283,8 @@ bool init_account_policy(void)
 
        if (db->transaction_commit(db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
-               goto cancel;
+               TALLOC_FREE(db);
+               return false;
        }
 
        return True;
index 8efc1ea2906c4161a519c628f48d066acfe46471..8261e2f7330463f07f59442ce2c1dfaaa8818ceb 100644 (file)
@@ -669,26 +669,28 @@ again:
                        }
                }
 
-               if (ctdb_replay_transaction(h) != 0) {
-                       DEBUG(0,(__location__ " Failed to replay transaction\n"));
+               if (++retries == 10) {
+                       DEBUG(0,(__location__ " Giving up transaction on db 0x%08x after %d retries failure_control=%u\n", 
+                                h->ctx->db_id, retries, (unsigned)failure_control));
                        ctdbd_control_local(messaging_ctdbd_connection(), failure_control,
                                            h->ctx->db_id, CTDB_CTRL_FLAG_NOREPLY, 
                                            tdb_null, NULL, NULL, NULL);
                        h->ctx->transaction = NULL;
                        talloc_free(h);
                        ctx->transaction = NULL;
-                       return -1;
+                       return -1;                      
                }
-               if (++retries == 10) {
-                       DEBUG(0,(__location__ " Giving up transaction on db 0x%08x after %d retries\n", 
-                                h->ctx->db_id, retries));
+
+               if (ctdb_replay_transaction(h) != 0) {
+                       DEBUG(0,(__location__ " Failed to replay transaction failure_control=%u\n",
+                                (unsigned)failure_control));
                        ctdbd_control_local(messaging_ctdbd_connection(), failure_control,
                                            h->ctx->db_id, CTDB_CTRL_FLAG_NOREPLY, 
                                            tdb_null, NULL, NULL, NULL);
                        h->ctx->transaction = NULL;
                        talloc_free(h);
                        ctx->transaction = NULL;
-                       return -1;                      
+                       return -1;
                }
                goto again;
        } else {
@@ -698,7 +700,8 @@ again:
        /* do the real commit locally */
        ret = tdb_transaction_commit(h->ctx->wtdb->tdb);
        if (ret != 0) {
-               DEBUG(0,(__location__ " Failed to commit transaction\n"));
+               DEBUG(0,(__location__ " Failed to commit transaction failure_control=%u\n",
+                        (unsigned)failure_control));
                ctdbd_control_local(messaging_ctdbd_connection(), failure_control, h->ctx->db_id, 
                                    CTDB_CTRL_FLAG_NOREPLY, tdb_null, NULL, NULL, NULL);
                h->ctx->transaction = NULL;
index e64611f1549b368bb8df0ca8f6b5032a1a2a1399..438000008063d5e1929e9e0096386f6f085272f2 100644 (file)
@@ -109,7 +109,7 @@ static bool share_info_db_init(void)
 
        if (share_db->transaction_commit(share_db) != 0) {
                DEBUG(0, ("transaction_commit failed\n"));
-               goto cancel;
+               return false;
        }
 
        return true;
index 824e61b063dcafe6765a84f96700c7e3182f6f97..e40f4bbab8a25c41df79530ee5606ee9b977e91e 100644 (file)
@@ -804,7 +804,7 @@ static bool tdbsam_convert(struct db_context *db, int32 from)
 
        if (db->transaction_commit(db) != 0) {
                DEBUG(0, ("Could not commit transaction\n"));
-               goto cancel;
+               return false;
        }
 
        return true;
@@ -1064,7 +1064,7 @@ static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods,
 
        if (db_sam->transaction_commit(db_sam) != 0) {
                DEBUG(0, ("Could not commit transaction\n"));
-               goto cancel;
+               return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
        return NT_STATUS_OK;
@@ -1191,7 +1191,7 @@ static bool tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd,
 
        if (db_sam->transaction_commit(db_sam) != 0) {
                DEBUG(0, ("Could not commit transaction\n"));
-               goto cancel;
+               return false;
        }
 
        return true;
@@ -1344,7 +1344,8 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
                 * account back?
                 */
                DEBUG(0, ("transaction_commit failed\n"));
-               goto cancel;
+               TALLOC_FREE(new_acct);
+               return NT_STATUS_INTERNAL_DB_CORRUPTION;        
        }
 
        TALLOC_FREE(new_acct );