client: Fix CAS writes and buffer cleanup with write-back and immediate_commit #196

Merged
vitalif merged 2 commits from koolkhel/vitastor:cas-writeback-immediate-commit into master 2026-11-26 16:05:53 +03:00
3 changed files with 21 additions and 2 deletions

View File

@@ -113,6 +113,24 @@ jobs:
echo ""
done
test_cas_imm:
runs-on: ubuntu-latest
needs: build
container: ${{env.TEST_IMAGE}}:${{github.sha}}
steps:
- name: Run test
id: test
timeout-minutes: 3
run: IMMEDIATE_COMMIT=1 /root/vitastor/tests/test_cas.sh
- name: Print logs
if: always() && steps.test.outcome == 'failure'
run: |
for i in /root/vitastor/testdata/*.log /root/vitastor/testdata/*.txt; do
echo "-------- $i --------"
cat $i
echo ""
done
test_change_pg_count:
runs-on: ubuntu-latest
needs: build

View File

@@ -925,7 +925,7 @@ void cluster_client_t::execute_cas(cluster_op_t *op, bool nosync)
cb(op);
return;
}
if (!(op->flags & OP_IMMEDIATE_COMMIT) && !nosync &&
if ((!(op->flags & OP_IMMEDIATE_COMMIT) || enable_writeback) && !nosync &&
wb->has_dirty(op->inode, op->offset, op->len))
{
cluster_op_t *sync_op = new cluster_op_t;
@@ -1322,7 +1322,7 @@ resume_2:
op->retval = op->len / pool_cfg.bitmap_granularity;
}
}
if (op->flush_id)
if (op->flush_id && !(op->flags & OP_IMMEDIATE_COMMIT))
{
wb->mark_flush_written(op->inode, op->offset, op->len, op->flush_id);
}

View File

@@ -6,6 +6,7 @@ cd $(dirname $0)
./test_add_osd.sh
./test_cas.sh
IMMEDIATE_COMMIT=1 ./test_cas.sh
./test_change_pg_count.sh
SCHEME=ec ./test_change_pg_count.sh