HomeClusterLabs Projects

Refactor: based, libcib: Drop internal use of cib_zero_copy

Description

Refactor: based, libcib: Drop internal use of cib_zero_copy

We already ignore whether the client sets cib_zero_copy or not. We
decide internally whether to set or clear it, in pacemaker-based. This
is correct: this flag is safe only in limited circumstances, so it would
be dangerous to allow a client to set it.

In cib_process_command(), we'll now check whether result_cib == the_cib,
which is what we really cared about in the first place. result_cib ==
the_cib if we didn't make a scratch copy, and result_cib != the_cib if
we did.

We add a new boolean called "make_copy" to cib_perform_op() and put the
decision logic in a static helper function. make_copy is the logical
inverse of cib_zero_copy.

This change has a small side effect. Previously, cib_zero_copy was never
set or cleared for the cib_file cib_t variant. A user could change the
behavior by passing cib_zero_copy to a cib_file client, even though the
flag did nothing when passed to a cib_native or cib_remote client.

I consider that a bug and dangerous behavior. There's no known use case
for it. Any attempt to use it would either produce no user-visible
difference in behavior compared to making a scratch copy, or break the
CIB. I'm comfortable with letting cib_perform_op() decide whether to
make a copy.

Ref T185

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Jun 6 2023, 8:39 PM
Parents
rPe0ee8cffb76f: Refactor: libcib: Check doc in cib_file_perform_op_delegate()
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task