summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt_txn.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2025-04-08 05:55:03 +0000
committerChristian Hopps <chopps@labn.net>2025-04-09 10:14:58 +0000
commit59d2368b0f055f28aeda8f6080d686acfa35c20b (patch)
treec4112f18aa261081b6c3d59ce705b43c47c1fa97 /mgmtd/mgmt_txn.c
parentb12b4c28b4c4a76cbc906b703ee5a694a082ab74 (diff)
mgmtd: normalize argument order to copy(dst, src)
Having just completed a code audit during RCA, the fact that we have 2 different argument orders for the related datastore copying functions was unnecessary and super confusing. Fix this code-maintenance/comprehension mistake and move the newer mgmtd copy routines to use the same arg order as the pre-existing underlying northbound copy functions (i.e., use `copy(dst, src)`) Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'mgmtd/mgmt_txn.c')
-rw-r--r--mgmtd/mgmt_txn.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c
index 483dfab8e8..2b4734e971 100644
--- a/mgmtd/mgmt_txn.c
+++ b/mgmtd/mgmt_txn.c
@@ -764,17 +764,15 @@ static int mgmt_txn_send_commit_cfg_reply(struct mgmt_txn_ctx *txn,
!txn->commit_cfg_req->req.commit_cfg.rollback);
/*
- * Successful commit: Merge Src DS into Dst DS if and only if
+ * Successful commit: Copy Src DS to Dst DS if and only if
* this was not a validate-only or abort request.
*/
if ((txn->session_id &&
!txn->commit_cfg_req->req.commit_cfg.validate_only &&
!txn->commit_cfg_req->req.commit_cfg.abort) ||
txn->commit_cfg_req->req.commit_cfg.rollback) {
- mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg
- .src_ds_ctx,
- txn->commit_cfg_req->req.commit_cfg
- .dst_ds_ctx,
+ mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg.dst_ds_ctx,
+ txn->commit_cfg_req->req.commit_cfg.src_ds_ctx,
create_cmt_info_rec);
}
@@ -783,22 +781,18 @@ static int mgmt_txn_send_commit_cfg_reply(struct mgmt_txn_ctx *txn,
* request.
*/
if (txn->session_id && txn->commit_cfg_req->req.commit_cfg.abort)
- mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg
- .dst_ds_ctx,
- txn->commit_cfg_req->req.commit_cfg
- .src_ds_ctx,
- false);
+ mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg.src_ds_ctx,
+ txn->commit_cfg_req->req.commit_cfg.dst_ds_ctx, false);
} else {
/*
* The commit has failied. For implicit commit requests restore
- * back the contents of the candidate DS.
+ * back the contents of the candidate DS. For non-implicit
+ * commit we want to allow the user to re-commit on the changes
+ * (whether further modified or not).
*/
if (txn->commit_cfg_req->req.commit_cfg.implicit)
- mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg
- .dst_ds_ctx,
- txn->commit_cfg_req->req.commit_cfg
- .src_ds_ctx,
- false);
+ mgmt_ds_copy_dss(txn->commit_cfg_req->req.commit_cfg.src_ds_ctx,
+ txn->commit_cfg_req->req.commit_cfg.dst_ds_ctx, false);
}
if (txn->commit_cfg_req->req.commit_cfg.rollback) {