Merge changes Ia17bcc86,I1954b38f

* changes:
  snapuserd: Remove IByteSink usage from legacy snapuserd.
  libsnapshot: Disable another legacy merge path in tests.
This commit is contained in:
David Anderson 2023-05-01 19:36:34 +00:00 committed by Gerrit Code Review
commit 23ff37a038
2 changed files with 14 additions and 3 deletions

View file

@ -2646,6 +2646,11 @@ TEST_F(SnapshotUpdateTest, QueryStatusError) {
ASSERT_TRUE(init->InitiateMerge());
ASSERT_EQ(UpdateState::MergeFailed, init->ProcessUpdateState());
if (ShouldSkipLegacyMerging()) {
LOG(INFO) << "Skipping legacy merge in test";
return;
}
// Simulate a reboot that tries the merge again, with the non-failing dm.
ASSERT_TRUE(UnmapAll());
init = NewManagerForFirstStageMount("_b");

View file

@ -95,11 +95,17 @@ void WorkerThread::ConstructKernelCowHeader() {
// internal COW format and if the block is compressed,
// it will be de-compressed.
bool WorkerThread::ProcessReplaceOp(const CowOperation* cow_op) {
if (!reader_->ReadData(*cow_op, &bufsink_)) {
SNAP_LOG(ERROR) << "ProcessReplaceOp failed for block " << cow_op->new_block;
void* buffer = bufsink_.GetPayloadBuffer(BLOCK_SZ);
if (!buffer) {
SNAP_LOG(ERROR) << "No space in buffer sink";
return false;
}
ssize_t rv = reader_->ReadData(*cow_op, buffer, BLOCK_SZ);
if (rv != BLOCK_SZ) {
SNAP_LOG(ERROR) << "ProcessReplaceOp failed for block " << cow_op->new_block
<< ", return = " << rv;
return false;
}
return true;
}