cephfs: move fscrypt lock into the CephFS RADOS namespace - #6539
cephfs: move fscrypt lock into the CephFS RADOS namespace#6539Greenpepper15 wants to merge 5 commits into
Conversation
|
Wait for #6497 to be merged before starting full e2e and merging on this PR. |
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 ⛓️ Depends-On RequirementsRequirement based on the presence of
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
|
/queue |
|
@Mergifyio rebase |
❌ This pull request comes from a fork and cannot be rebasedDetailsGitHub refuses an OAuth token on its rebase API for a fork, so rebasing one means impersonating a GitHub user to force-push the contributor's branch. Mergify does not do that. Use the |
|
Should I rebase manually? |
Hey @Greenpepper15 , yes, please rebase. The approvals will be dropped, but I'll get them added as soon as possible again. After the rebase, we'll start the full CI cycle. In the mean time, we're looking into Mergify changes that allow rebasing/updating again. Thanks! |
LockExclusive folds every unexpected return value into one generic error. Return a distinguishable error for EPERM and EACCES, so that callers can tell a denied lock apart from a failed one. Locking is a RADOS class operation, so it needs the class-exec permission on the pool, and caps that cover the RADOS namespace of the IO context. Signed-off-by: David Mohren <david.mohren@clyso.com> Assisted-by: Claude Code <noreply@anthropic.com>
The RADOS lock that serializes the fscrypt setup of an encrypted volume should be placed in the RADOS namespace configured by cephFS.radosNamespace and not in the default namespace of the metadata pool, like every other object Ceph-CSI creates there. Signed-off-by: David Mohren <david.mohren@clyso.com> Assisted-by: Claude Code <noreply@anthropic.com>
Handle the rolling-upgrade window in which upgraded nodes take the fscrypt lock in cephFS.radosNamespace while not-yet-upgraded nodes still take it in the default namespace, unserialized against each other. Take both locks. The new lock is exclusively used when the old one is not available. That is the case when the credentials have no permission for the default namespace (such a deployment could never stage an encrypted volume before this change, so no old node can hold the old lock), and when the volume has no RADOS namespace (both locks would be the same object). Signed-off-by: David Mohren <david.mohren@clyso.com> Assisted-by: Claude Code <noreply@anthropic.com>
Mount an encrypted volume and check that the fscrypt lock object exists in the CephFS RADOS namespace, and, while the transitional legacy lock exists, in the default namespace as well. The lock is released before NodeStageVolume returns; the check relies on cls_lock leaving the object behind on unlock. Signed-off-by: David Mohren <david.mohren@clyso.com> Assisted-by: Claude Code <noreply@anthropic.com>
cc135b2 to
b087b71
Compare
Pull request has been modified.
|
/queue |
|
@Mergifyio rebase |
❌ This pull request comes from a fork and cannot be rebasedDetailsGitHub refuses an OAuth token on its rebase API for a fork, so rebasing one means impersonating a GitHub user to force-push the contributor's branch. Mergify does not do that. Use the |
|
@Greenpepper15 , no need to do anything about these Mergify things, we're still testing it out. |
|
/test ci/centos/k8s-e2e-external-storage/1.36 |
|
/test ci/centos/k8s-e2e-external-storage/1.34 |
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/mini-e2e/k8s-1.36 |
|
/test ci/centos/k8s-e2e-external-storage/1.35 |
|
/test ci/centos/mini-e2e/k8s-1.34 |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/mini-e2e/k8s-1.35 |
Merge Queue Status
Required conditions to merge
Waiting for
All queue conditions
|
|
/test ci/centos/k8s-e2e-external-storage/1.36 |
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/k8s-e2e-external-storage/1.34 |
|
/test ci/centos/mini-e2e/k8s-1.36 |
|
/test ci/centos/k8s-e2e-external-storage/1.35 |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/mini-e2e/k8s-1.34 |
|
/test ci/centos/mini-e2e/k8s-1.35 |
Describe what this PR does
Fixes the first item of #6531: the RADOS lock that serializes fscrypt setup for encrypted volumes lives in the
default namespace of the metadata pool, while every other object Ceph-CSI creates for a CephFS cluster lives
in the configured RADOS namespace (
cephFS.radosNamespace, defaultcsi).This PR places the lock in the RADOS namespace configured by
cephFS.radosNamespace.Is there anything that requires special attention
Is the change backward compatible?
Yes, I implemented a transitional legacy lock mechanism that keeps mixed-version deployments safe. This
mechanism makes nodes that include the changes of this PR try to get both the new lock (placed in
cephFS.radosNamespace) and the old lock (placed in the default RADOS namespace).However, the "old lock" in the default RADOS namespace is not required in two cases. If the CephX capabilities
of the node cannot access the default namespace, the mount continues without it (such a deployment could never
stage an encrypted volume before this change, so no old nodeplugin can be holding the old lock). Volumes
without a RADOS namespace (static volumes) take only one lock, in the default namespace, because both locks
would be the same object. Any other failure to take the old lock fails the mount.
The legacy lock is marked with a TODO for removal once upgrades from releases that lock in the default
namespace are no longer supported.
Do you have any questions?
Is protecting the rolling-upgrade edge case worth the code it takes? The core fix is the single
SetNamespace()call. The rest of the PR exists to keep an old nodeplugin and an upgraded one serializedwhile updating. The serialization only matters when the same encrypted volume is staged on a non-updated
ceph-csi instance and an updated ceph-csi instance at the same time. If that window is considered
unimportant, the legacy lock can be dropped (together with the sentinel-error commit it depends on and its
e2e check). Instead the upgrade documentation would warn operators not to start pods that mount encrypted
volumes while the nodeplugin upgrade is running. Ceph-CSI cannot enforce this since a nodeplugin does not
know that a rolling upgrade is in progress, and the legacy lock is exactly the mechanism that serializes the
two sides. Avoiding the race would be left entirely to the operator.
Is the e2e test's dependency on RADOS lock internals acceptable? The lock is released before
NodeStageVolumereturns, so the test can not observe it held. Instead it checks for the object thatcls_lock leaves behind on unlock, which holds for every lock type except
LOCK_EXCLUSIVE_EPHEMERAL. Shouldcls_lock ever stop leaving the object behind, or the fscrypt lock become ephemeral, the test breaks without
any product regression. An e2e test was asked for in cephfs: cephFS.radosNamespace is not applied consistently #6531, so if this dependency is not acceptable, I would
rework the check rather than drop it. However suggestions for a better way to observe the lock's namespace
are welcome (I am unsure how to do it in a different manner).
Related issues
Part of #6531.
Future concerns
namespace are no longer supported (marked with a TODO in the code).
AI assistance: this code was developed with the help of an AI assistant (Claude). Each commit carries the
Assisted-by: Claude Code <noreply@anthropic.com>trailer, per AGENTS.md.Checklist:
guidelines in the developer
guide.
Request
notes
updated with breaking and/or notable changes for the next major release.
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>: retest the<job-name>after unrelatedfailure (please report the failure too!)
CI job ordering.
Depends-on: #6497