recover: use CTDB_REC_RO_FLAGS where appropriate
authorMichael Adam <obnox@samba.org>
Fri, 19 Apr 2013 14:24:32 +0000 (16:24 +0200)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 24 Apr 2013 08:49:08 +0000 (18:49 +1000)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit b5a8791268e938d7e017056e0e2bd2cbec1fa690)

ctdb/server/ctdb_recover.c

index 3250eaf35e0f5452dd01562275257f8cd896328c..1e5170feccaf595b098d83318d7f24de4cb5ad23 100644 (file)
@@ -418,7 +418,7 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
                /* strip off any read only record flags. All readonly records
                   are revoked implicitely by a recovery
                */
-               hdr->flags &= ~(CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE);
+               hdr->flags &= ~CTDB_REC_RO_FLAGS;
 
                data.dptr += sizeof(*hdr);
                data.dsize -= sizeof(*hdr);
@@ -843,13 +843,13 @@ static int delete_tdb_record(struct ctdb_context *ctdb, struct ctdb_db_context *
        }
 
        /* do not allow deleting record that have readonly flags set. */
-       if (hdr->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE)) {
+       if (hdr->flags & CTDB_REC_RO_FLAGS) {
                tdb_chainunlock(ctdb_db->ltdb->tdb, key);
                DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly flags set\n"));
                free(data.dptr);
                return -1;              
        }
-       if (hdr2->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE)) {
+       if (hdr2->flags & CTDB_REC_RO_FLAGS) {
                tdb_chainunlock(ctdb_db->ltdb->tdb, key);
                DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly flags set\n"));
                free(data.dptr);
@@ -1158,21 +1158,13 @@ static int store_tdb_record(struct ctdb_context *ctdb,
        }
 
        /* do not allow vacuuming of records that have readonly flags set. */
-       if (hdr->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|
-                         CTDB_REC_RO_HAVE_READONLY|
-                         CTDB_REC_RO_REVOKING_READONLY|
-                         CTDB_REC_RO_REVOKE_COMPLETE))
-       {
+       if (hdr->flags & CTDB_REC_RO_FLAGS) {
                DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly "
                                  "flags set\n"));
                ret = -1;
                goto done;
        }
-       if (hdr2->flags & (CTDB_REC_RO_HAVE_DELEGATIONS|
-                          CTDB_REC_RO_HAVE_READONLY|
-                          CTDB_REC_RO_REVOKING_READONLY|
-                          CTDB_REC_RO_REVOKE_COMPLETE))
-       {
+       if (hdr2->flags & CTDB_REC_RO_FLAGS) {
                DEBUG(DEBUG_INFO,(__location__ " Skipping record with readonly "
                                  "flags set\n"));
                ret = -1;