Skip to content

fix(controller): give new and restored volumes LINSTOR's block size - #287

Merged
Andrei Kvapil (kvaps) merged 35 commits into
mainfrom
fix/linstor-auto-block-size
Nov 24, 2026
Merged

Andrei Kvapil (kvaps) merged 35 commits into
mainfrom
fix/linstor-auto-block-size

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What this fixes

Every volume blockstor created came up with 512-byte logical sectors, while LINSTOR gave the same volume on the same ZFS pool 4096. A volume restored from a snapshot had the same problem: its source ran at 4096 and the restored device came up at 512, under data written at 4096. On a cluster adopted from LINSTOR this meant two geometries side by side, depending on who created the volume, and restores that changed the sector size of the data they restored.

This is fixed for pools adopted from LINSTOR, which record their minimum I/O size. It is not fixed for pools blockstor creates itself: they record no minimum I/O size yet, so a fresh install, or a new node added to an adopted cluster, still gives its volumes 512. Probing the pool on the satellite, as LINSTOR's AbsStorageProvider.updateMinIoSize does with a temporary volume, is a separate change.

Why it happened

LINSTOR keeps a volume's logical sector size on its volume definition, as DrbdOptions/Disk/block-size, and writes it itself. blockstor rendered the property (since #275) but never wrote it, so DRBD fell back to the backing device's logical sector size, which is 512 on a zvol.

What LINSTOR v1.33.1 does, and what this PR copies:

  • When a replica is created (CtrlRscCrtApiHelper.rscMinIoSizeCheck) and the volume definition has no block size, it writes the minimum I/O size of the replica's storage pool. The satellite records that per pool as StorDriver/internal/minIoSize, read from queue/physical_block_size and clamped to 512..4096 (BlockSizeInfo, AbsStorageProvider.updateMinIoSize). A stack with a layer other than DRBD and STORAGE counts as 4096, a diskless replica as 512.
  • A replica on a pool with a larger size raises the value while the size can still change: no replica is Primary and no volume definition is frozen (CtrlRscStateHelper.canChangeMinIoSize). Otherwise the replica is refused.
  • The first replica of a definition is not decided by canChangeMinIoSize: create takes the definition-wide switch instead (CtrlRscCrtApiHelper.createResourceDb), so with the switch off on any volume LINSTOR refuses the first replica whenever a volume with its switch on has no size, on any pool. blockstor follows that rule and, as for every create LINSTOR refuses, keeps the size and raises IncompatibleBlockSize. Only the autoplacer's pool filter treats an empty definition as free to change, which blocksize.CanChange mirrors for the placer.
  • The autoplacer skips every pool whose minimum I/O size is above the smallest size the definition's volumes run at, once the size can no longer change (StorPoolFilter.filter, SelectionManager.isValid, ResourceDefinition.getFloorVolumesMinIoSize).
  • The first in-use report from any replica stamps Linstor/Drbd/freeze-block-size True (ResourceStateEventHandler).
  • Deleting the last replica removes both properties (CtrlRscDeleteApiHelper).
  • Linstor/Drbd/auto-block-size on the volume definition, resource definition, volume group, resource group or controller switches all of this off (CtrlMinIoSizeHelper). Both switches are read with Java's Boolean.parseBoolean, so only "true" in any case is true.
  • A snapshot copies the volume definition's props (CtrlSnapshotCrtHelper), and the resource restore copies them back onto a target with no replica yet (CtrlSnapshotRestoreApiCallHandler.restoreOnNode). A restored replica gets no block size check. The volume-definition restore copies only the GI and the LUKS password.

Changes

  • New package pkg/blocksize holds the property names, the decision for one volume definition, and LINSTOR's canChangeMinIoSize and floor.
  • The controller runs the rule for a new replica before giving it its DRBD identity. The satellite brings nothing up before that, and drbdsetup never changes the block size of an attached device (the test cluster showed adjust leaves it alone; only a detach and attach applies it), so the size has to be there before the first attach. The decision takes the largest size of every diskful replica of the definition still waiting for its identity, so replicas created together on pools of different sizes end up where LINSTOR's do, whichever reconciles first.
  • The decision reads the definition's other replicas from the cache, and past it only those written under the replica's spelling of the definition or its object name, so a peer created a moment ago still counts and one deleted a moment ago does not: the cache supplies only replicas written under other spellings. It used to list every Resource in the cluster past the cache once per new replica; in a provisioning burst on a cluster with a few hundred replicas that list was most of each allocation's time, and the satellites build nothing before the allocation that follows the decision is done. A server that cannot select Resources by definition is still read in full.
  • The placer applies LINSTOR's autoplace filter, for every caller of Place (REST autoplace, spawn, resource group apply and rebalance, node replacement).
  • The controller stamps the freeze once a replica reports being in use. A failed freeze is retried but no longer holds up the rest of that replica's controller-side apply.
  • A small reconciler removes both properties when the definition's last replica is deleted, under the same per-definition lock the decision for a new replica holds, and leaves a definition under restore alone. A leader-only sweep catches deletions it did not see because the controller was down: it releases a frozen definition with no replica once two sweeps in a row find it so.
  • Snapshots record each volume definition's props (new props field on the Snapshot's volume entries), the autosnapshot runnable records them too, and linstor-migrate imports the props LINSTOR froze into a snapshot, recording {} for a volume LINSTOR snapshotted without props. A Snapshot object written before this falls back to the definition's current props, as before.
  • The resource restore copies the snapshot's volume definition props onto the restored definition, also over the volume definitions linstor-csi restores one call earlier. A source without a block size ran at DRBD's default, and the restored definition records 512, unless the automatic size is off for the target, where nothing is written, as in LINSTOR.
  • A satellite reads the definition from the API server, not the cache, for a replica it has never applied, so the first attach sees the size the controller wrote just before the identity.

Where it differs from LINSTOR

blockstor decides after the replica object exists, and its peers may already run, so some cases cannot behave the same:

  • Where LINSTOR refuses r c of a replica whose pool needs more than a size that may no longer change, blockstor keeps the size and raises an IncompatibleBlockSize Warning Event on the replica. Autoplace no longer gets there, since it filters such pools the way LINSTOR does.
  • A raise while a diskful peer already has its identity is treated the same way. LINSTOR's raise restarts DRBD on every replica, and blockstor has no such restart.
  • A volume definition with no size whose replicas already run (every volume a release without this rule created, or a volume added to a placed definition) gets 512 written down for its next replica instead of the pool's size. Its devices run at 512, and a new replica at 4096, or a later reattach at 4096, would change the sector size under data written at 512 (XFS made with 512-byte sectors does not mount on a 4096 device). Existing blockstor volumes therefore stay at 512 until they are recreated.
  • A replica whose volumes span pools of different sizes counts as the largest; LINSTOR keeps whichever pool it reads last.
  • The release also runs as a sweep, which LINSTOR does not need since it removes the properties in the same transaction as the last resource. The sweep only touches frozen definitions: a size without the stamp may be one an operator set before placing anything, which LINSTOR keeps, and with no replica the next one raises it anyway.

Two consequences for volumes made before this fix, on pools that record 4096: every new replica of such a volume raises an IncompatibleBlockSize Warning, for as long as the volume exists; and once such a volume is in use or frozen, autoplace no longer offers it a 4096 pool, exactly as LINSTOR would not, so evacuating or rebalancing it can run out of candidates where it used to succeed. DRBD 9.2 never lets a device's block size drop below its backing device's or a connected peer's (drbd/drbd_nl.c), so writing 512 down cannot make a device smaller than its disk allows; the filter is about not stacking a peer at 4096 under data made at 512.

All of this is recorded in docs/cli-parity-known-deltas.md (row 96). Row 76 loses its claim that blockstor omits block-size on FILE_THIN volumes: they now carry the 512 upstream renders.

Interactions with open PRs

Testing

  • make lint-config && make lint with GOTOOLCHAIN=go1.25.7: 0 issues.

  • go test over every package except the e2e and integration suites, with envtest assets: pass, including the provenance guard in pkg/naming and the parity doc check in tests/contract.

  • New tests, each seen failing without its fix: internal/controller/blocksize_test.go (the decision listing no Resource past the cache without a definition selector while still counting a peer the cache has not seen and ignoring a deleted one the cache still lists, pool size on a new replica, 512 for diskless and unrecorded pools, 4096 for a special layer, switch off, legacy definitions keep 512, raise while nothing runs, no raise when frozen or under a running diskful peer, the first decision covering every waiting replica, restored definitions untouched, freeze on Primary, apply still running when the freeze is refused), internal/controller/blocksize_release_test.go (release, lock held from list to patch, restoring definitions kept, the sweep), pkg/placer/blocksize_test.go (frozen, Primary, auto off with a size, and the cases that keep the larger pool), pkg/blocksize (switch parsing, canChangeMinIoSize, floor), pkg/rest/restore_block_size_test.go (plain restore, source without a size, the linstor-csi order, auto off on the controller or the target), pkg/store/k8s/snapshots_internal_test.go and pkg/store/k8s/snapshot_volume_props_test.go (recorded props through a real API server), pkg/linstormigrate (frozen props imported, {} for a volume without props, golden updated), pkg/satellite/controllers/first_apply_definition_internal_test.go (including a run of runApply itself).

  • Integration suite (go test -tags=integration -timeout 45m ./tests/integration/): pass, about 10 minutes, so the default 10 minute go test timeout is too short for it.

  • After the definition-scoped read: go test ./... with envtest assets and go test -tags=integration ./tests/integration/... -run 'TestSmoke|TestBug433|TestGroupKWF|TestGroupCRG|BlockSize|Autoplace': pass.

  • TestBurstProvisioningLatency (perf(controller,satellite): read only a definition's replicas, not every Resource #303) on the v0.4.0-alpha.8 tree with this change and fix(controller): hand out DRBD identities without stalling a provisioning burst #300's allocation change, 16 volumes over about 140 existing ones: every CreateVolume under 8 s, where alpha.8 took up to 18 s. The block size decision for a new replica went from a median of 0.9 s to 0.4 s in that run.

Not tested

  • No run on a real cluster: a new PVC and a restore with the device's logical_block_size checked, on ZFS, LVM thin and FILE_THIN pools; autoplace of a frozen 512 volume next to 4096 pools.
  • The e2e and operator-harness replay suites were not run.

LINSTOR keeps a volume's logical sector size on its volume definition
and writes it itself from the storage pool's minimum I/O size, freezes
it once the volume is used and drops it with the last replica.
blockstor never wrote it, so DRBD fell back to the backing device's
sector size, 512 on a zvol, where LINSTOR gave the same volume 4096.

This adds the rule as a package of its own, the property names and
the decision for one volume definition, so the controller, the restore
path and the tests share one reading of it.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR copies a volume definition's props into the snapshot when it
takes it, and a restore copies them back. The block size it keeps
there is the one the snapshot's data was written at. blockstor kept
only the size of each volume and served the definition's current
props instead, so a restore had nothing reliable to take the source's
geometry from, and an adopted LINSTOR snapshot lost the props LINSTOR
had frozen into it.

Snapshots now record the props, linstor-migrate imports the frozen
ones, and a snapshot recorded before this falls back to the
definition as before. The field is serialised without omitempty so a
definition that had no props is told apart from one never recorded.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A volume restored from a snapshot came up with 512-byte sectors under
data written at 4096: the restored volume definition got no props,
so DRBD used the zvol's sector size. LINSTOR's resource restore copies
the snapshot's volume definition props onto a target with no replica
yet, block size and freeze included; its volume-definition restore
copies none of them.

The resource restore now does the same, also over the volume
definitions linstor-csi restores one call earlier. A source that had
no block size ran at DRBD's default, and the restored definition
records 512, so the controller does not hand the restored data the
pool's size.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Every volume blockstor created came up with 512-byte logical sectors,
while LINSTOR gave the same volume on the same ZFS pool 4096. When
LINSTOR creates a replica whose volume definition has no block size,
it writes the minimum I/O size of the replica's pool there (4096 for
a stack with a layer beyond DRBD and STORAGE, 512 for a diskless one),
raises it for a larger pool while nothing is Primary or frozen, and
freezes it on the first in-use report. blockstor did none of it.

The controller now runs that rule for a new replica before giving it
its DRBD identity, since the satellite brings nothing up before that
and drbdsetup never changes the block size of an attached device. It
freezes the size once a replica is in use.

Where LINSTOR would refuse the replica, or raise the size and restart
DRBD on every replica, the replica already exists here and its peers
may run, so the size stays and a Warning Event says why. A definition
without a size whose replicas already run records DRBD's default, so
volumes made before this keep the geometry their data was written at.
A restored definition keeps the size it got from its snapshot.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR removes the block size and its freeze from a volume
definition when the last resource of the definition is deleted, so
the next replica takes the size of whatever pool it lands in and
nothing stays frozen for a device that is gone. blockstor kept both
forever.

A small reconciler now does this on replica deletions only. A
definition that has no replica yet keeps what it carries: a restore
writes its source's size before placing anything, and an operator may
set one before the first replica.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The controller writes the block size onto the volume definition and
only then gives the replica its DRBD identity, but the two objects
reach the satellite through separate watches. A cached definition
older than the size could still be in hand when the identity arrives,
and the first apply attaches the device: drbdsetup never changes the
block size of an attached device, so a size read late stays lost
until the next detach.

A replica that was never applied here now reads its definition from
the API server. Replicas already applied keep using the cache.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
FILE_THIN volumes now carry the block size upstream renders for them,
and the three places blockstor keeps a size where LINSTOR would refuse
or restart DRBD are written down.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A snapshot volume definition LINSTOR stored with no props came out of
the converter with nil props, which the store reads as a snapshot taken
before blockstor kept them and fills in with the definition's props as
they are now. A volume snapshotted before it had a block size, and
raised to 4096 since, then restored at 4096 under data written at 512,
where LINSTOR's restore copies nothing.

The dump is authoritative for what the snapshot held, so a volume
definition row present there is recorded as an empty map. Only Snapshot
objects written before the field existed keep the fallback.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR reads auto-block-size and freeze-block-size with Java's
Boolean.parseBoolean, so only "true" in any case counts as true. The
switch here treated every value but "false" as on, which left the rule
running for a volume an operator switched off with "no", "0" or "off",
where LINSTOR leaves it alone.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Replicas created together on pools of different sizes were decided one
at a time, each for its own pool. The first to reconcile got its size
and its identity and could attach; the next one then saw a diskful
replica running and was refused the raise. The outcome depended on
which replica reconciled first, where LINSTOR decides every replica of
one autoplace before any DRBD comes up and so raises.

The first decision now takes the largest size of every diskful replica
of the definition still waiting for its identity, so the definition
ends up where LINSTOR's does whatever the order.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR's autoplacer drops every pool whose minimum I/O size is above
the smallest block size a placed definition's volumes run at, once that
size may no longer change: a replica is Primary, a volume definition is
frozen, or the automatic size is off with a size set. blockstor placed
the replica on such a pool anyway and then only warned. On a 4Kn pool
DRBD stacks that replica at 4096 next to peers at 512, and once
connected the peers can follow it to 4096 under a filesystem made at
512.

The placer now applies the same filter, with LINSTOR's floor and its
canChangeMinIoSize, for every caller of Place.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The release listed the replicas, read the definition and patched it
without the lock the decision for a new replica holds. A replica
decided in between under the size it kept writes nothing, so the
optimistic lock saw no conflict, and the release took the size and the
freeze stamp from under a replica that had just attached at 4096; its
next down and up brought it back at 512.

The release now holds the same per-definition lock from the list to
the patch. The lock is keyed by the folded definition name, since the
release only has the object name and replicas name their definition as
it was given.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The release ran only on replica deletion events, so a definition whose
last replica went while the controller was down kept its block size
and freeze stamp for good, where LINSTOR removes both with the last
resource. A frozen definition with no replica then refused, or warned
about, a new replica on a larger pool for a device that no longer
exists.

A leader-only sweep now releases a frozen definition with no replica,
not being deleted and not under restore, once two sweeps in a row find
it so; the second look keeps it off a definition whose replicas are
being created right behind it. A size without the stamp is left alone:
it may be one an operator set before placing anything, which LINSTOR
keeps, and with no replica the next one raises it anyway. The release
also leaves a definition under restore alone, since its size is the
one the restored data was written at.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The freeze stamp ran before the controller-side apply and returned its
error first, so a patch the API server kept refusing (admission, RBAC)
stalled the in-use replica's housekeeping for as long as it failed.
The stamp only stops a later size change; the apply now runs either
way, and the freeze error is still returned so it is retried.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A restore of a source without a block size writes 512 down so the
controller does not give the restored data the pool's size. It looked
for auto-block-size only in the snapshot's volume props, so with the
switch off on the target definition, its group or the controller it
still wrote 512, where LINSTOR writes nothing and the controller would
write nothing either.

The switch is now resolved the way LINSTOR resolves it for the
restored volume: volume definition, target definition, volume group,
resource group, controller.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The existing tests called the refresh helper directly, so dropping its
call from runApply would have passed them. This one drives runApply
with a cached definition a size behind the API server's and checks the
volume is carved at the API server's size.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Row 96 now says autoplace skips pools above a size that can no longer
change, as upstream does, and spells out what still differs: the first
decision covers every replica still waiting, a replica on pools of
different sizes counts as the largest rather than the last one read,
the release also runs as a sweep for deletions the controller missed,
and a restore with the automatic size off writes nothing.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Reading the switch over the target's scope added group and controller
reads after the target definition exists, and a failure there failed
the restore, leaving the definition behind so every retry under the
name answered 409. Those reads only decide whether a source without a
size gets 512 written down, so a level that cannot be read is left out
and logged, which at worst writes the 512 the restore always wrote.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Split the replica check out of the release's Reconcile, which the
lock and the restore check pushed over the length limit, and use
slices.ContainsFunc for the frozen check.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2e9d064-0e92-4537-a444-11abc9a321f0
Commits

Reviewing files that changed from the base of the PR and between 96c18b9 and 4cfdd00.

Files selected for processing: 29

  • api/v1alpha1/snapshot_types.go
  • api/v1alpha1/zz_generated.deepcopy.go
  • cmd/controller/main.go
  • config/crd/bases/blockstor.org_snapshots.yaml
  • docs/cli-parity-known-deltas.md
  • internal/controller/autosnapshot_controller.go
  • internal/controller/blocksize.go
  • internal/controller/blocksize_release_controller.go
  • internal/controller/blocksize_release_test.go
  • internal/controller/blocksize_test.go
  • internal/controller/resource_controller.go
  • internal/controller/resource_drbd_layer.go
  • pkg/blocksize/blocksize.go
  • pkg/blocksize/blocksize_test.go
  • pkg/linstormigrate/convert.go
  • pkg/linstormigrate/convert_test.go
  • pkg/linstormigrate/props.go
  • pkg/linstormigrate/testdata/dump/propscontainers.internal.linstor.linbit.com.json
  • pkg/linstormigrate/testdata/golden/manifests.yaml
  • pkg/placer/blocksize.go
  • pkg/placer/blocksize_test.go
  • pkg/placer/placer.go
  • pkg/rest/restore_block_size_test.go
  • pkg/rest/snapshot_restore.go
  • pkg/satellite/controllers/first_apply_definition_internal_test.go
  • pkg/satellite/controllers/resource.go
  • pkg/store/k8s/snapshot_volume_props_test.go
  • pkg/store/k8s/snapshots.go
  • pkg/store/k8s/snapshots_internal_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The block size decision for a new replica listed every Resource in the
cluster past the cache, once per replica. In a provisioning burst on a
cluster with a few hundred replicas that list was most of each
allocation's time, and the satellites build nothing, nor connect a
peer, before the allocation that follows the decision is done.

Take the definition's replicas from the cache, and read past it only
the ones written under the target's spelling or the definition's object
name, so a peer created a moment ago still counts. A reader that cannot
select by definition still reads every Resource.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The block size decision merges the cache with a read past it, and the
read only replaced cached entries of the same name. A replica already
deleted on the API server but still in the cache stayed a peer: delete
the last replica of a volume, create a new one a moment later, and the
stale peer counted as running, so the volume kept the 512 default on a
4096 pool, or stayed frozen when the stale peer had been Primary.
LINSTOR decides from the replicas that exist.

The read past the cache is complete for the spellings it asks for, so
take the cache only for the other spellings.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One divergence from LINSTOR in the controller-side rule, inline. I checked the rest of the decision, the switch resolution, the freeze and the release against LINSTOR v1.33.1 and found no other problem.

// canChangeBlockSize is LINSTOR's canChangeMinIoSize over the replicas
// the definition already has.
func canChangeBlockSize(scope *blockSizeScope, peers []blockstoriov1alpha1.Resource) bool {
if !scope.allAuto() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns false for a definition with no replicas as soon as one volume has the automatic size off. LINSTOR's canChangeMinIoSize starts from getResourceCount() == 0 and only replaces that when every volume has the switch on (CtrlRscStateHelper.java:107-110 in v1.33.1), so the first replica can always set the size on the volumes whose own switch is on. Example: a two-volume RD with Linstor/Drbd/auto-block-size false on volume 1 only, first replica on a pool that records 4096. Volume 0 gets CanChange=false, Decide says Incompatible, it comes up at 512 and the replica gets an IncompatibleBlockSize Warning. LINSTOR writes 4096 there. blocksize.CanChange, which the placer uses, already checks for replicas first; calling it here would keep both paths the same. A test with a mixed switch would pin it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the order on purpose: resource create does not use canChangeMinIoSize for a definition with no replica. CtrlRscCrtApiHelper.createResourceDb (v1.33.1, lines 236-249) calls it only when getResourceCount() >= 1; for the first replica it takes minIoSizeHelper.isAutoMinIoSize(rscDfn), the definition-wide switch, which is false once any volume has it off. rscMinIoSizeCheck then sees volume 0 with its switch on and no size, so minIoNeedsUpdate is true (line 655), and with canChangeMinIo false it throws FAIL_INVLD_BLK_SIZE (line 680). So in your example LINSTOR refuses the replica instead of writing 4096, and it refuses on a 512 pool too. Autoplace ends up there as well, since CtrlRscAutoPlaceApiCallHandler creates through createResourceDb (line 428); only the autoplacer's pool filter asks canChangeMinIoSize on an empty definition (Autoplacer.java:76), which is why the placer uses blocksize.CanChange and the controller does not.

8a58cbc adds the mixed-switch test and says this where the rule lives; with the len(peers) == 0 check moved above allAuto() it fails with block-size 4096. bad0c6d fixes the comment, which said LINSTOR refuses only on larger pools. blockstor leaves the size unset and raises IncompatibleBlockSize there, as for every create LINSTOR refuses (row 96, divergence a).

The release patches the definition under an optimistic lock, so it
fails with 409 Conflict whenever another writer updated the definition
since the read. A burst of volume deletions does that all the time, and
the next pass always goes through, but the reconciler returned the
conflict and controller-runtime logged each one as "Reconciler error"
at ERROR. An alert on ERROR lines then fired on every batch of
deletions. In the sweep the same conflict ended the whole sweep with
"block size sweep failed" and skipped the definitions after it.

A conflict now requeues the definition through the same per-object
backoff an error gets and is logged at V(1); the sweep goes on and
retries it on its next run. Every other error is returned as before.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR's resource create does not call canChangeMinIoSize for a
definition without a replica: createResourceDb passes the
definition-wide auto-block-size switch to rscMinIoSizeCheck instead
(v1.33.1). With the switch off on one volume, the first replica may
not set any volume's size, and LINSTOR refuses it on a pool that needs
more than the default. Only the autoplacer treats an empty definition
as always changeable, which is what blocksize.CanChange mirrors.

Say so where the controller's rule lives, and pin the mixed case so a
later switch to blocksize.CanChange does not quietly diverge.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…into fix/linstor-auto-block-size

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

# Conflicts:
#	docs/cli-parity-known-deltas.md
…ywhere

rscMinIoSizeCheck asks for a size on every volume that has its switch
on and none set, whatever the pool records, so with the definition-wide
switch off the first replica is refused on a 512 pool as well, not only
on one that needs more than the default.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release retry in the new commit looks right to me. The canChangeBlockSize point from my earlier review is still open, and I re-checked it at linstor-server v1.33.2: same code, same lines. Inline again so it stays on the current head. The PR also conflicts with #275 in docs/cli-parity-known-deltas.md (row 95 changed there, row 96 added here).

// canChangeBlockSize is LINSTOR's canChangeMinIoSize over the replicas
// the definition already has.
func canChangeBlockSize(scope *blockSizeScope, peers []blockstoriov1alpha1.Resource) bool {
if !scope.allAuto() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still returns false for a definition with no replicas once one volume has the automatic size off. In v1.33.2 canChangeMinIoSize (CtrlRscStateHelper.java:107-121) starts from getResourceCount() == 0 and only overrides it when every volume has the switch on, so the first replica can set the size on the volumes that allow it. Moving the len(peers) == 0 check above allAuto(), the way blocksize.CanChange does, plus a mixed-switch test, would close it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer as in the first thread: for the first replica create passes isAutoMinIoSize(rscDfn) (CtrlRscCrtApiHelper.java:241-249), not canChangeMinIoSize, so the getResourceCount() == 0 start you quote is reached only from the autoplacer's filter. The test from 8a58cbc pins the create behaviour.

…into fix/linstor-auto-block-size

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

# Conflicts:
#	docs/cli-parity-known-deltas.md
The merge of #275 left runApply one line over the funlen budget: #275
records dropped options there and this branch refreshes the definition
before the first apply. Reading the definition, past the cache when
needed, is one step, so it moves into a helper of its own.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…lock-size

The base now carries main. The block size is decided inside main's
DRBD-only allocation, before a DRBD replica gets its identity; the
freeze and the apply follow as before. The converter writes a
snapshot's frozen volume-definition props onto the Snapshot, so main's
dropped-props report counts that bag as carried. The block-size restore
tests record the pool that holds the copy, which main's restore now
requires.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps

Copy link
Copy Markdown
Member Author

Fixed in 036a2f8, which merges the current #275 branch into this one. Row 76 keeps #275's new (c) and (d) together with this PR's (a), and rows 95 and 96 sit side by side. The merge left runApply one line over funlen, which 3fad56f fixes.

A release whose patch loses an optimistic-concurrency race is retried
quietly at V(1), which keeps normal volume churn out of the ERROR log.
But a writer that rewrites a definition in a loop then starves the
release forever with nothing at the default log level and nothing in
the reconcile-error metric.

Count back-to-back lost races per definition and log from the tenth
on at the default verbosity, as conflict.Retrier does for the other
reconcilers, so the two policies agree until the release moves onto
the Retrier. Any other outcome, a deleted definition included, drops
the count so it does not outlive the definition.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
A release that loses its race in the event path is requeued, and the
pass that follows forgets the count even when the definition is gone.
A race lost in the sweep is retried only by the next sweep, so a
definition deleted after such a race kept its count for the life of
the process, and one recreated under the same name could log its
first race at the default verbosity. The sweep now drops the count of
every definition it no longer lists.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The release patch no longer decides the retry, so the result it
returned was always empty; the unparam lint flags it.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right about canChangeBlockSize, and I withdraw the point. At linstor-server v1.33.2 the first replica gets the definition-wide switch (CtrlRscCrtApiHelper.java L237-250, CtrlMinIoSizeHelper.java L37-51), and a volume with the switch on and no size then refuses the create on any pool (L650-685). The release streak counter and the funlen extraction look right. Unit tests fail on two tests this PR does not touch; they fail on main too and #318 fixes them.

Several open branches added accept-list rows at the next free id on
main, so the merged table carried
ids 95, 96, 97 and 100 twice. Each branch
now takes its own ids above main's 98, in PR order, so they stay
unique whatever order the branches merge in. The row inherited from
the disk options branch moves from 95 to 102, as it does there, and
this branch's own row from 96 to 104, with the citation in row 76.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…into fix/linstor-auto-block-size

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

# Conflicts:
#	docs/cli-parity-known-deltas.md
@kvaps
Andrei Kvapil (kvaps) changed the base branch from fix/vd-level-drbd-disk-options to main November 24, 2026 15:22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The only difference from 0046562 is the known-delta row renumbered from 96 to 104, with the reference to it in row 76 updated. The rest is the merge of main.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps
Andrei Kvapil (kvaps) merged commit 4ed45ba into main Nov 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants