Repository navigation
scst_vdisk: Refresh thin provisioning after backend changes - #391
Merged
Merged
Conversation
Changing filename while a vdisk is inactive leaves the old backend's thin-provisioning capabilities cached. For example, switching between a plain device and a discard-capable cache can leave automatic thin provisioning disabled or enabled for the wrong backend. Mark only a TP recheck as pending after a successful filename write. Consume it in the common activation path used by active=1 and ALUA. Do not request a full backend reexamination for an existing device: that would also overwrite the exported size and recheck cache mode. The initial deferred reexamination still performs its normal work; if it completes the TP check, activation does not repeat that check. Make the TP probe safe to call repeatedly: - Track successful creation of gen_tp_soft_threshold_reached_UA with tp_ua_attr_created. This avoids duplicate sysfs creation for both thin-to-thin switches and thin-to-non-thin-to-thin round trips. Keep the attribute until device removal; its existing store callback rejects requests while TP is disabled. Failed creation leaves the flag clear so a later probe can retry. - Compare the previous effective TP state and advertised UNMAP limits with vdisk_tp_changed(). Notify on TP enable/disable and on changed granularity, alignment, maximum LBA count or discard-zeroes behavior while TP remains enabled. Ignore stale limits while TP is disabled. - Keep the requested manual TP setting separate from the effective backend capability. An explicit thin_provisioned=0 stays disabled. An explicit thin_provisioned=1 is temporarily disabled on a backend without TP and restored when a later backend supports it. Reusing the effective value as the request would lose that setting on a thin-to-non-thin-to-thin round trip. - On a probe-open error, leave the previous capabilities and pending flag intact. Activation closes any reopened descriptors and returns the device to inactive state so a subsequent activation can retry. Filename replacement, explicit activation and ALUA activation already serialize through scst_alua_lock(). Use that same lock for the new state so another filename write cannot race with consuming the pending check. Keep the new bool fields outside the command-side bitfields to avoid sharing their read-modify-write storage with command callbacks. Queue INQUIRY DATA HAS CHANGED through vdev_inq_changed_work. Calling scst_dev_inquiry_data_changed() directly from activation could recurse on scst_mutex. The existing device-free callback cancels this work before releasing the device. Ordinary ALUA or active cycles without a filename write do not request another TP probe or notification. Link: #389
lnocturno
force-pushed
the
3.11/gleb/vdisk-tp-recheck
branch
from
September 17, 2026 12:29
5786a4a to
7df258d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changing filename while a vdisk is inactive leaves the old backend's thin-provisioning capabilities cached. For example, switching between a plain device and a discard-capable cache can leave automatic thin provisioning disabled or enabled for the wrong backend.
Mark only a TP recheck as pending after a successful filename write. Consume it in the common activation path used by active=1 and ALUA. Do not request a full backend reexamination for an existing device: that would also overwrite the exported size and recheck cache mode. The initial deferred reexamination still performs its normal work; if it completes the TP check, activation does not repeat that check.
Make the TP probe safe to call repeatedly:
Filename replacement, explicit activation and ALUA activation already serialize through scst_alua_lock(). Use that same lock for the new state so another filename write cannot race with consuming the pending check. Keep the new bool fields outside the command-side bitfields to avoid sharing their read-modify-write storage with command callbacks.
Queue INQUIRY DATA HAS CHANGED through vdev_inq_changed_work. Calling scst_dev_inquiry_data_changed() directly from activation could recurse on scst_mutex. The existing device-free callback cancels this work before releasing the device. Ordinary ALUA or active cycles without a filename write do not request another TP probe or notification.
Link: #389