@@ -677,8 +677,8 @@ int db_write(struct connection *conn, const char *db_name, void *data,
return 0;
}
-int db_delete(struct connection *conn, const char *name,
- struct node_account_data *acc)
+void db_delete(struct connection *conn, const char *name,
+ struct node_account_data *acc)
{
struct node_account_data tmp_acc;
unsigned int domid;
@@ -698,8 +698,6 @@ int db_delete(struct connection *conn, const char *name,
domain_memory_add_nochk(conn, domid,
-acc->memory - strlen(name));
}
-
- return 0;
}
/*
@@ -1670,9 +1668,8 @@ static int delnode_sub(const void *ctx, struct connection *conn,
if (domain_nbentry_dec(conn, get_node_owner(node)))
return WALK_TREE_ERROR_STOP;
- /* In case of error stop the walk. */
- if (!ret && db_delete(conn, db_name, &node->acc))
- return WALK_TREE_ERROR_STOP;
+ if (!ret)
+ db_delete(conn, db_name, &node->acc);
/*
* Fire the watches now, when we can still see the node permissions.
@@ -366,8 +366,8 @@ struct xs_tdb_record_hdr *db_fetch(const char *db_name, size_t *size);
int db_write(struct connection *conn, const char *db_name, void *data,
size_t size, struct node_account_data *acc,
enum write_node_mode mode, bool no_quota_check);
-int db_delete(struct connection *conn, const char *name,
- struct node_account_data *acc);
+void db_delete(struct connection *conn, const char *name,
+ struct node_account_data *acc);
void conn_free_buffered_data(struct connection *conn);
@@ -377,10 +377,8 @@ static int finalize_transaction(struct connection *conn,
/* Entries for unmodified nodes can be removed early. */
if (!i->modified) {
- if (i->ta_node) {
- if (db_delete(conn, i->trans_name, NULL))
- return EIO;
- }
+ if (i->ta_node)
+ db_delete(conn, i->trans_name, NULL);
list_del(&i->list);
talloc_free(i);
}
@@ -397,8 +395,7 @@ static int finalize_transaction(struct connection *conn,
? NODE_CREATE : NODE_MODIFY;
*is_corrupt |= db_write(conn, i->node, hdr,
size, NULL, mode, true);
- if (db_delete(conn, i->trans_name, NULL))
- *is_corrupt = true;
+ db_delete(conn, i->trans_name, NULL);
} else {
*is_corrupt = true;
}
@@ -408,9 +405,8 @@ static int finalize_transaction(struct connection *conn,
* in this transaction will have no generation
* information stored.
*/
- *is_corrupt |= (i->generation == NO_GENERATION)
- ? false
- : db_delete(conn, i->node, NULL);
+ if (i->generation != NO_GENERATION)
+ db_delete(conn, i->node, NULL);
}
if (i->fire_watch)
fire_watches(conn, trans, i->node, NULL, i->watch_exact,