Skip to content

test/cls_lock: expired lock before unlock and start check - #47148

Merged
cbodley merged 1 commit into
ceph:mainfrom
NitzanMordhai:wip-nitzan-test-cls-lock-expiered-locks-start
Oct 2, 2023
Merged

cbodley merged 1 commit into
ceph:mainfrom
NitzanMordhai:wip-nitzan-test-cls-lock-expiered-locks-start

Conversation

@NitzanMordhai

@NitzanMordhai NitzanMordhai commented Jul 18, 2022 •

Copy link
Copy Markdown
Contributor

If the lock expired, the stat check shouldn't return -ENOENT, we need to check before if the lock
expired and check stat accordingly

Fixes: https://tracker.ceph.com/issues/56575
Signed-off-by: Nitzan Mordechai [email protected]

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@NitzanMordhai
NitzanMordhai requested a review from a team as a code owner July 18, 2022 10:17
@github-actions github-actions Bot added the tests label Jul 18, 2022
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from 811efca to 95e27e8 Compare July 19, 2022 04:49
@NitzanMordhai
NitzanMordhai requested a review from ljflores July 19, 2022 04:50
@idryomov idryomov changed the title cls_lock: expired lock before unlock and start check test/cls_lock: expired lock before unlock and start check Jul 19, 2022
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
@idryomov
idryomov requested a review from ivancich July 19, 2022 09:31
@badone

badone commented Aug 30, 2022

Copy link
Copy Markdown
Contributor

I'll take a look into this and try to work out how we got here. It seems these tests have become very problematic over time and perhaps a comprehensive review is in order?

@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from 95e27e8 to daced6a Compare October 27, 2022 09:02
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from daced6a to ef08832 Compare October 27, 2022 09:05
@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test make check

@idryomov idryomov left a comment •

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.

I think this PR should just remove lock_expired function, completely reverting the changes made in #45762. Then, on top of the revert, apply two set_duration fixups and that is it.

Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from ef08832 to a0e6c79 Compare December 25, 2022 15:30
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
Comment thread src/test/cls_lock/test_cls_lock.cc Resolved
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from a0e6c79 to c276843 Compare January 4, 2023 15:00
@NitzanMordhai
NitzanMordhai requested a review from idryomov January 4, 2023 15:00
@badone

badone commented Jan 4, 2023

Copy link
Copy Markdown
Contributor

jenkins test windows

@idryomov

idryomov commented Jan 4, 2023 •

Copy link
Copy Markdown
Contributor

jenkins test windows

It's going to fail but there is work in flight to get that fixed, hopefully tomorrow!

@idryomov

idryomov commented Jan 9, 2023

Copy link
Copy Markdown
Contributor

jenkins test windows

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Apr 27, 2023
@idryomov idryomov added needs-qa and removed stale labels Apr 28, 2023
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Jun 27, 2023
@badone badone removed the stale label Jun 27, 2023
@idryomov

Copy link
Copy Markdown
Contributor

@yuriw A gentle needs-qa poke ;)

If the lock expired, the stat check shouldn't return -ENOENT,
We will change the lock duration to prevent lock expired before the
stat check.

Fixes: https://tracker.ceph.com/issues/56575
Signed-off-by: Nitzan Mordechai <[email protected]>
@NitzanMordhai
NitzanMordhai force-pushed the wip-nitzan-test-cls-lock-expiered-locks-start branch from c276843 to d3457c6 Compare August 1, 2023 07:57
@NitzanMordhai
NitzanMordhai requested a review from a team as a code owner August 1, 2023 07:57
@cbodley

cbodley commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

215/285 Test #224: unittest_rgw_amqp .........................***Failed 35.29 sec

saw an unrelated 'make check' failure and opened https://tracker.ceph.com/issues/62264 to track it

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Sep 30, 2023
@idryomov

idryomov commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

jenkins test make check

@cbodley

cbodley commented Oct 2, 2023 •

Copy link
Copy Markdown
Contributor

builds pending in https://shaman.ceph.com/builds/ceph/pr-47148/

i just want to see the updated ceph_test_cls_lock pass, so i'm planning to schedule a single rados/basic/tasks/rados_cls_all.yaml job to verify. would that satisfy you too @idryomov, or would you like to run part of the rbd suite?

@idryomov

idryomov commented Oct 2, 2023 •

Copy link
Copy Markdown
Contributor

@cbodley Nothing in RBD touches lock duration, so whatever you do is fine with me.

@cbodley

cbodley commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

scheduled with: teuthology-suite -m smithi -s rados/basic -c pr-47148 --filter cls --limit 1 -p 75

results: http://qa-proxy.ceph.com/teuthology/cbodley-2023-10-02_19:06:34-rados:basic-pr-47148-distro-default-smithi/7408609/teuthology.log

2023-10-02T19:28:53.330 INFO:tasks.workunit.client.0.smithi114.stdout:[ RUN      ] ClsLock.TestExclusiveEphemeralBasic
2023-10-02T19:28:59.403 INFO:tasks.workunit.client.0.smithi114.stdout:[       OK ] ClsLock.TestExclusiveEphemeralBasic (6073 ms)
2023-10-02T19:28:59.404 INFO:tasks.workunit.client.0.smithi114.stdout:[ RUN      ] ClsLock.TestExclusiveEphemeralStealEphemeral
2023-10-02T19:29:07.213 INFO:tasks.workunit.client.0.smithi114.stdout:[       OK ] ClsLock.TestExclusiveEphemeralStealEphemeral (7810 ms)
2023-10-02T19:29:07.214 INFO:tasks.workunit.client.0.smithi114.stdout:[ RUN      ] ClsLock.TestExclusiveEphemeralStealExclusive
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:[       OK ] ClsLock.TestExclusiveEphemeralStealExclusive (7069 ms)
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:[----------] 11 tests from ClsLock (67949 ms total)
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:[----------] Global test environment tear-down
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:[==========] 11 tests from 1 test suite ran. (67949 ms total)
2023-10-02T19:29:14.283 INFO:tasks.workunit.client.0.smithi114.stdout:[  PASSED  ] 11 tests.

👍

@cbodley
cbodley merged commit cc984be into ceph:main Oct 2, 2023
idryomov pushed a commit to ceph/ceph-ci that referenced this pull request Oct 13, 2026
read_lock() removes the backing object when an ephemeral lock has drained
of unexpired holders, via cls_cxx_remove(). get_info and assert_locked are
registered read-only (CLS_METHOD_RD, RdTag / RdPromoteTag), so when they
reach that path the OSD rejects the write issued by a non-WR method and
fails the whole class call with EIO (PrimaryLogPG: "tried to update object
but is not marked WR"). Both methods then answer EIO instead of the lock's
state, and the cleanup is lost with them.

Gate the removal on a may_write flag that read_lock's callers pass: the
write-capable methods (lock, unlock, break_lock, set_cookie) still clean the
drained object, while the read-only methods skip the removal and report the
lock as empty. The next write-capable call removes the object, so no leak is
introduced.

#56575 logged this same failure in 2022 but was closed by a test-only change
(PR ceph/ceph#47148) that lengthened the test's lock durations so the lock
never expired during the run; the class behaviour was never corrected.

Fixes: https://tracker.ceph.com/issues/80993
Signed-off-by: Joshua Hoblitt <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
jhoblitt added a commit to jhoblitt/ceph that referenced this pull request Nov 5, 2026
read_lock() removes the backing object when an ephemeral lock has drained
of unexpired holders, via cls_cxx_remove(). get_info and assert_locked are
registered read-only (CLS_METHOD_RD, RdTag / RdPromoteTag), so when they
reach that path the OSD rejects the write issued by a non-WR method and
fails the whole class call with EIO (PrimaryLogPG: "tried to update object
but is not marked WR"). Both methods then answer EIO instead of the lock's
state, and the cleanup is lost with them.

Gate the removal on a may_write flag that read_lock's callers pass: the
write-capable methods (lock, unlock, break_lock, set_cookie) still clean the
drained object, while the read-only methods skip the removal and report the
lock as empty. The next lock replaces the drained lock and that holder's
unlock removes the object; the removal was already lost before this
change, so nothing new is left behind.

https://tracker.ceph.com/issues/56575 logged this same failure in 2022
but was closed by a test-only change (PR ceph#47148) that
lengthened the test's lock durations so the lock never expired during
the run; the class behaviour was never corrected.

Assisted-by: Claude-v2.1.286:claude-opus-4-8
Assisted-by: Claude-v2.1.318:claude-opus-5-5
Fixes: https://tracker.ceph.com/issues/80993
Signed-off-by: Joshua Hoblitt <[email protected]>
ronen-fr pushed a commit to ceph/ceph-ci that referenced this pull request Nov 11, 2026
read_lock() removes the backing object when an ephemeral lock has drained
of unexpired holders, via cls_cxx_remove(). get_info and assert_locked are
registered read-only (CLS_METHOD_RD, RdTag / RdPromoteTag), so when they
reach that path the OSD rejects the write issued by a non-WR method and
fails the whole class call with EIO (PrimaryLogPG: "tried to update object
but is not marked WR"). Both methods then answer EIO instead of the lock's
state, and the cleanup is lost with them.

Gate the removal on a may_write flag that read_lock's callers pass: the
write-capable methods (lock, unlock, break_lock, set_cookie) still clean the
drained object, while the read-only methods skip the removal and report the
lock as empty. The next lock replaces the drained lock and that holder's
unlock removes the object; the removal was already lost before this
change, so nothing new is left behind.

https://tracker.ceph.com/issues/56575 logged this same failure in 2022
but was closed by a test-only change (PR ceph/ceph#47148) that
lengthened the test's lock durations so the lock never expired during
the run; the class behaviour was never corrected.

Assisted-by: Claude-v2.1.286:claude-opus-4-8
Assisted-by: Claude-v2.1.318:claude-opus-5-5
Fixes: https://tracker.ceph.com/issues/80993
Signed-off-by: Joshua Hoblitt <[email protected]>
ChrisSchinnerl pushed a commit to SiaFoundation/ceph that referenced this pull request Nov 13, 2026
* qa: create fscrypt config before volume mount setup

TestFSCryptBackup runs alone, so nothing has created /etc/fscrypt.conf
yet. fscrypt setup of the mount reads that file.

Fixes: https://tracker.ceph.com/issues/79375
Signed-off-by: Venky Shankar <[email protected]>

* cephfs: keep the source fscrypt nonce when cloning ciphertext

Subvolume clone reads and writes the stored ciphertext. Creating the
destination minted a new nonce, so a keyed client decrypted those bytes
into garbage. Copy ceph.fscrypt.auth, ceph.fscrypt.file, and
ceph.alternate_name from the source. A locked tree compare cannot open
file contents, so it checks names, sizes, and symlink targets only.

Fixes: https://tracker.ceph.com/issues/79375
Signed-off-by: Venky Shankar <[email protected]>

* client: apply ceph.fscrypt.file locally under FILE_EXCL

The exclusive-cap path dirtied FILE_EXCL but still sent SETATTR. A
subvolume clone hit that after writing ciphertext and before fsync, so
the MDS had to xlock filelock while the request could not release the
dirty buffer cap. Record the value and publish it with the cap flush.

Fixes: https://tracker.ceph.com/issues/79375
Signed-off-by: Venky Shankar <[email protected]>

* qa: use the testing kernel for fs:fscrypt kclient

Drop the distro stock kernel facet so kclient jobs run on the
ceph-client testing branch. Rocky kclient jobs are still rejected
there; fuse coverage is unchanged.

Signed-off-by: Venky Shankar <[email protected]>

* qa: add cephfs-mirror HA directory rebalance tests

Add test coverage for mirror directory rebalance across three HA
daemons, including initial distribution, failover/rejoin and
post-throttle stability checks.

After failover, assert directory concentration on surviving instances
rather than max-min > 1 — even dir counts can settle evenly on the
survivors (e.g. 4 dirs -> [2, 2]).

Fixes: https://tracker.ceph.com/issues/79010
Signed-off-by: Karthik U S <[email protected]>

* rgw/admin: radosgw-admin topic dump follows max-entries

The max-entries parameter was only used as the batch size of the calls to
the queue, while the command itself kept listing until every shard was
exhausted, so from the caller's point of view all the entries were always
dumped at once.

Return at most max-entries notifications, and a marker to continue from.
The marker holds both the shard and the position inside it, so a dump can
resume in the middle of a shard. The --marker option already existed but
was shadowed by a local variable, so it is now wired to the command.

The output is now an object holding the entries under "eventEntries",
together with "truncated" and "marker", instead of a bare array. This is
a change of the output format, and is noted in the release notes.

Fixes: https://tracker.ceph.com/issues/78695
Signed-off-by: Akshay Nazare <[email protected]>

* rgw/admin: validate the marker of "topic dump"

Follow up on the review of the pagination of "radosgw-admin topic dump".

The limit on the number of entries returned to the caller is now a const,
so that it is clear it does not change while the shards are listed, and
the shard part of the marker is no longer the only one checked: the
position inside the shard has to be a queue marker as well, otherwise the
marker is rejected.

Extend the test to cover the pagination across shards, a marker that holds
a shard and no position inside it, and the markers that are rejected.

Signed-off-by: Akshay Nazare <[email protected]>

* cls/queue: reject a start marker that is not in the queue

queue_list_entries() ignored the result of parsing the start marker, and
did not check that the position it holds is one that the queue actually
holds. A marker past the tail makes the size of the contiguous data to
read underflow, and the loop then keeps reading empty chunks past the end
of the queue, which never ends: the cls method spins in the OSD until it
is killed.

This was not reachable while the only markers passed to the queue were
the ones it had returned, but "radosgw-admin topic dump" now takes a
marker from the caller, and a marker that was valid can also become stale
once the entries it points at have been consumed.

Parse the marker, and return EINVAL for a position that is not between
the front and the tail of the queue.

Signed-off-by: Akshay Nazare <[email protected]>

* qa: drop CentOS 9 Stream in favor of Rocky 10

Drop CentOS 9 Stream from supported distributions and test matrices,
transitioning existing suites to Rocky Linux 10. In addition to the
distro replacement, streamline and modernize affected QA suites:

- qa/distros: Remove CentOS 9 Stream configs from supported distros,
  container hosts, and random distro selections.
- fs, orch, rados, rbd, nvmeof: Update test suites to use rocky_10.yaml
  in place of centos_9.stream symlinks.
- rgw/upgrade: Point tentacle and umbrella distro directories directly
  to .qa/distros/supported instead of maintaining individual distro symlinks.
- nvmeof/upgrade: Refactor 1-start matrix to decouple OS/distro targets
  from tasks, breaking configurations into base installs and nvmeof tasks.
- Cleanups: Prune obsolete/superseded test configs, including rpm_latest
  in fs/bugs and reef/squid configs in rados/thrash-old-clients.

Fixes: https://tracker.ceph.com/issues/77317
Signed-off-by: Patrick Donnelly <[email protected]>

* mds: populate rejoin_gather for newly active ranks

A rank that goes creating -> active during max_mds scale-up never
observes peer failures, so rejoin_gather stays empty while recovery_set
is not. OP_WEAK then hits ceph_assert(rejoin_gather.count(from)). Grow
gather from set_recovery_set and the survivor rejoin send path, refresh
the recovery set at joint start, and add or ignore a missing sender
instead of crashing.

Fixes: https://tracker.ceph.com/issues/80402
Related-to: https://tracker.ceph.com/issues/54840
Signed-off-by: Igor Golikov <[email protected]>

* mds: remember applied weak rejoins on survivors

Do not re-insert a rank into rejoin_gather after its OP_WEAK was
already applied when a delayed rejoin_send_rejoins() retries. Drop
gather updates from set_recovery_set() and active_start(); they do not
fix the crash and can wait on peers that will never send again.

Fixes: https://tracker.ceph.com/issues/80402
Related-to: https://tracker.ceph.com/issues/54840
Signed-off-by: Igor Golikov <[email protected]>

* mds: ignore a repeated OP_WEAK after it was applied

A second weak rejoin from a rank still in replay..rejoin is no longer
in rejoin_gather, so handle_cache_rejoin_weak() applied it again. Skip
senders already recorded in rejoin_weak_applied. handle_mds_failure()
clears that bit when a new rejoin is required.

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>

* mds: defer unexpected rejoin messages until the map catches up

OP_STRONG is sent only by a clientreplay, active, or stopping rank.
Dropping it when the local map does not show that state yet loses the
ack, because rejoin_sent prevents a resend. The same drop in
handle_cache_rejoin_weak() loses the ack for a sender outside
replay..rejoin. Wait for the next mdsmap and retry.

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>

* qa: reproduce an active rank with an empty rejoin_gather

Hold a new rank in creating while a peer fails over into replay, then
let it become active before that peer leaves replay. OP_WEAK then
reaches a survivor that never ran handle_mds_failure().

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>

* doc/releases: update EOL dates

Signed-off-by: Patrick Donnelly <[email protected]>

* rgw/metadata: keep the layout logs from stored bucket

and ignore empty layout if bucket is indexless

introduced in: 18eddb7dfe9

Signed-off-by: Yuval Lifshitz <[email protected]>
Assisted-by: claude-code:claude-fable-5-1

* mds: add UPDATE-only snap metadata op flag

Add CEPH_SNAP_MD_OP_UPDATE to update an existing snap metadata key and
reject the operation when the key is absent.

Fixes: https://tracker.ceph.com/issues/77992
Signed-off-by: Karthik U S <[email protected]>

* client: accept UPDATE-only snap metadata op flag

Allow CEPH_SNAP_MD_OP_UPDATE in do_snap_md_op() validation.

Fixes: https://tracker.ceph.com/issues/77992
Signed-off-by: Karthik U S <[email protected]>

* pybind/cephfs: export UPDATE-only snap metadata op flag

Fixes: https://tracker.ceph.com/issues/77992
Signed-off-by: Karthik U S <[email protected]>

* tools/cephfs_mirror: fix re-appearance of removed checkpoints

After snapshot metadata mutation (PR #66723), the mgr can remove a
checkpoint while the mirror daemon is syncing. The mirror daemon may
still see stale inode metadata and recreate checkpoint keys when sync
completes.

Use CEPH_SNAP_MD_OP_UPDATE for checkpoint status transitions so the
mirror daemon cannot recreate keys that were removed on the MDS.

Fixes: https://tracker.ceph.com/issues/77992
Signed-off-by: Karthik U S <[email protected]>

* Add enhanced logging and performance counters for Client IO operations

Introduce detailed counters for IO events (read/write sizes,
async IO activity, and MDS requests).
Improve metrics tracking and logging to support monitoring and
debugging capabilities.

Fixes: https://tracker.ceph.com/issues/75298
Signed-off-by: Edwin Rodriguez <[email protected]>

* Handle aio zero length op counters correctly

l_c_aio_ops and l_c_aio_in_flight were being incremented for async read operations
that complete immediately due to being at EOF or having zero length. Since these
operations don't actually result in any asynchronous I/O being performed, counting
them as such is redundant and potentially misleading.
The following changes:
1. Removed the calls to logger->inc(l_c_aio_ops) and logger->inc(l_c_aio_in_flight)
   in the immediate completion block of Client::_read_async.
2. Updated the immediate completion logic to call onfinish->complete(0) directly and
   reset the io_finish managed pointer, instead of using crf->complete(0). This bypasses
   the C_Read_Async_Finisher::finish method, which would have incorrectly decremented
   l_c_aio_in_flight and incremented l_c_aio_completions, thus maintaining correct
   counter balance.
3. Ensured that the C_Read_Async_Finisher::finish method continues to update counters
   for all other cases where an actual async operation was initiated.
These changes ensure that "no-op" async reads are not counted in AIO metrics, while preserving the accuracy and balance of those metrics for real I/O operations.

Signed-off-by: Edwin Rodriguez <[email protected]>

* Correctly increment cap counters for stale generation

Update the Client::add_update_cap method to correctly increment cap-related counters when
a cap with a stale generation is encountered and re-initialized.
Specifically, when cap.gen < mds_session->cap_gen is true within Client::add_update_cap,
the existing code was resetting cap.issued and cap.implemented to CEPH_CAP_PIN, but it was
failing to increment the l_c_caps and pinned_icaps counters. These counters are correctly
incremented in the else branch where a new cap is created.
Adding calls to inc_pinned_icaps() and inc_caps() within this block ensure that
these counters accurately reflect the current state of pinned caps and total caps when a
stale cap is updated to the current generation.

Signed-off-by: Edwin Rodriguez <[email protected]>

* Fix incorrect `inc_caps_release` placement in Client methods

Reposition `inc_caps_release` calls to ensure proper counter updates during cap flush operations across multiple code paths.

Signed-off-by: Edwin Rodriguez <[email protected]>

* Simplify async read completion handling by directly releasing `io_finish` and invoking `onfinish->complete(0)` to ensure immediate execution and clarity.

Signed-off-by: Edwin Rodriguez <[email protected]>

* Track readahead cache hits and misses in Client IO operations

Signed-off-by: Edwin Rodriguez <[email protected]>

* client: add fscrypt IO latency and amplification perf counters

Encrypted Client IO lacked visibility into crypto cost and block-alignment
amplification, so loadpoint and debug dumps could not separate fscrypt
overhead from raw IO.

Add enc/dec and overall encrypted read/write latency averages, plus
fscrypt_wr_amp and fscrypt_rd_amp as average ratios (x100) of aligned
physical span to logical IO size. Instrument the encrypted write path and
all fscrypt decrypt completion paths (including async finishers).

Signed-off-by: Edwin Rodriguez <[email protected]>

* client: track sync/async IO in-flight counts and peaks

Operators and the loadpoint harness needed per-interval visibility into
how many Client IO calls are outstanding and their high-water marks.
Plain peak gauges did not reset with `perf reset`, and async OC-off
reads never updated aio_in_flight.

Add sync_in_flight and aio_in_flight gauges with COUNTER-typed peaks
updated via PerfCounters::set_max. Instrument sync and async read/write
paths (including vectored and ll_nonblocking), track aio on C_Read_Finisher
so both ObjectCacher and C_Read_Sync_NonBlocking paths are covered, and
keep peak publishing lock-free and resettable between measurement intervals.

Signed-off-by: Edwin Rodriguez <[email protected]>

* common/Readahead: add standalone readahead perf counters

Under Ganesha sequential-read load, Readahead::_observe_read can
silently reset state whenever offset != m_last_pos, which starves
prefetch with no visibility in perf dump. Per-Fh loggers would spam
the dump, so there was no practical way to quantify resets vs issued
readahead.

Add observes/resets/sequential/issued/issued_bytes counters on
Readahead, expose them via an optional shared PerfCounters pointer,
and have Client register one "readahead" section injected into each
Fh at open. Unit test covers reset and issued increments.

Signed-off-by: Edwin Rodriguez <[email protected]>

* rgw: return AccountAlreadyExists when account modify hits a taken name

RGWOp_Account_Modify passed -EEXIST from rgw::account::modify() straight
through, so renaming an account to a name or email another account holds
answered 409 BucketAlreadyExists. Map it to ERR_ACCOUNT_EXISTS like
RGWOp_Account_Create does.

Co-authored-by: Joshua Hoblitt <[email protected]>
Signed-off-by: Matthew N. Heler <[email protected]>

* qa: avoid admin socket timeouts after OSD restart

Problem:
The recovery-preemption test sends admin-socket config changes after
restarting osd.1 without waiting for it to come up. BlueStore can still
be mounting while OSD::init() holds osd_lock, causing the config handler
to block and the admin-socket commands to time out.

Solution:
Set the recovery options after the initial healthy check, before the
restart sequence, to avoid sending config changes during OSD startup.

Assisted-by: Co-pilot
Fixes: https://tracker.ceph.com/issues/59079
Signed-off-by: Kamoltat (Junior) Sirivadhna <[email protected]>

* doc/rados: rewrite the inconsistent PG and pg repair sections

Rewrite the "PGs Inconsistent" section of troubleshooting-pg.rst from
the scrub code on main. It now shows the current ceph health detail
output, says that an inconsistent PG still serves I/O and that only a
scrub clears the flag, and explains "No scrub information available"
from rados list-inconsistent-obj. It says when to replace a drive
instead of running pg repair, and when repair keeps the primary's copy.
It describes how pg repair chooses the authoritative copy, marks the
other copies missing, recovers them, and scrubs again, which limits a
requested deep scrub or repair ignores, and how automatic repair works.

Remove the clock-skew advice, which nothing in the scrub code supports,
and the Filestore-only text and walkthrough.

Declare osd_deep_scrub_update_digest_min_age and
osd_scrub_retry_pg_state in osd-config-ref.rst, so that the section can
link them.

Fixes: https://tracker.ceph.com/issues/61739
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus-5.5

* test,qa: cover checkpoint removal during sync and UPDATE snap md op

Add integration test for removing a checkpoint while snapshot sync is
in progress, and a libcephfs test for the UPDATE-only snap metadata op.

Fixes: https://tracker.ceph.com/issues/77992
Signed-off-by: Karthik U S <[email protected]>

* monitoring: add rgw buckets/users usage grafana dashboards

We have new metrics available in prometheus related to rgw buckets/users usage. The plan is to include some panels using these metrics in the existing rgw-s3-analytics grafan adashboard and add a new rgw-analytics-users-buckets grafana dashboard using these newly available metrics.

Fixes: https://tracker.ceph.com/issues/81949

Signed-off-by: Aashish Sharma <[email protected]>

* mds: add a reproducer for deferred OP_WEAK during rejoin

Hold rejoin_send_rejoins() until mds_defer_rejoin_send_for_testing is
cleared, so a peer can fail and return below rejoin before the weak
rejoin is sent. The failover test releases that hold while the peer is
still replaying.

Fixes: https://tracker.ceph.com/issues/54840
Signed-off-by: Venky Shankar <[email protected]>

* mds: delay cache rejoin OP_WEAK until peer is in rejoin

A deferred rejoin_send_rejoins() can send OP_WEAK while a peer is still
below rejoin, crashing the receiver on ceph_assert(mds->is_rejoin()).
Skip OP_WEAK for every rank below STATE_REJOIN, including a failed rank,
keep rejoins_pending, and retry from handle_mds_map only while this rank
is in rejoin and a send was deferred. On the receiver, defer the message
until rejoin_start() instead of asserting.

Fixes: https://tracker.ceph.com/issues/54840
Signed-off-by: Igor Golikov <[email protected]>

* ok to stop: added gwid optional parameters:
gw-id and disable-if-ok
Fixes: https://tracker.ceph.com/issues/82527

Signed-off-by: Leonid Chernin <[email protected]>

* mgr/dashboard: allow Fast EC pools as primary pool for RBD

Fast EC pools (ec_optimizations enabled) now support OMAP,
removing the historical blocker for using EC pools as the
primary pool for RBD images and mirroring.

Signed-off-by: Afreen Misbah <[email protected]>
Fixes: https://tracker.ceph.com/issues/79661

* test/osd: ECPeeringTestFixture: give lazily created listeners the fixture's TIDs

ensure_test_pg_exists() and create_child_peering_state() create their
MockPGBackendListeners without calling set_osd(), so get_tid() returns
0 for every read and recovery op of an ECPeeringTestFixture PG. Two
reads in flight on one primary then share tid 0, and the second fails
ceph_assert(!tid_to_read_map.contains(tid)) in
ECCommon::ReadPipeline::start_read_op(). setup_ec_pool() and
setup_replicated_pool() already call set_osd() on the listeners they
create; do the same here.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>

* test/osd: roll back log entries through the PG's real backend

MockPeeringListener hands PGLog a MockPGLogEntryHandler that rolls back,
rolls forward and trims log entries through a MockPGBackend. That mock
does not override object_size_to_shard_size(), so it returns the object
size. Rolling back an op that grows an optimized EC object therefore
truncates every shard to the old object size rather than to its own
shard size, and rolling back extents clamps them to the wrong size too.
A real OSD rolls back through ECSwitch, which computes each shard's
size.

MockPeeringListener already holds the PG's real backend, when it has
one, in pg_backend. Use it for log entries too, so that peering applies
the rollback the OSD would.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>

* test/osd: test EC truncate and write ops, forward and rolled back

Add tests for optimized EC ops that truncate, write and zero an object,
run forward and rolled back through peering, with an independent oracle
for every shard.

Framework: move the truncate helpers into a fixture base class,
ECTruncateTestBase, that can be configured from any BackendConfig. Ops
are built from an ordered list of truncates, writes and zeros on one
object, submitted as a single PGTransaction, while a byte model of the
object tracks what it must contain; the object info size and delta
stats come from the model, so that several ops can be in flight on the
same object. check_shards() requires each shard to be as long as the
shard size for the object size, each data shard to hold its chunks of
the model followed by zeros, and each parity shard to hold the parity
that the plugin encodes from those chunks. Each committed op is recorded
in the ObjectTracker through a new
PGBackendTestFixture::record_truncate_and_write(), so the TearDown scrub
checks the objects too.

run_forward() applies the ops of one or more objects together and then
checks the objects and their shards, before and after taking down the
first data shard to force reads to decode. run_rollback() blocks the ops
to one shard, fails another, and requires peering to restore every
object and every surviving shard exactly. An op that does not write the
blocked shard completes, and must then survive the failure.

Rollback of a truncate that ends mid-page: rolling back a divergent op
that truncates an object to a size part way through a page could
restore zeros over the rest of that page, on the data shard holding the
new end when the op also writes to that page, and on every parity shard
when the new end is in the first data chunk of its stripe. Test such a
truncate on its own and with a write below, across, just above and well
above the new end. With k=2 m=1 the only parity shard is the one that
fails, so the two tests that only corrupt parity pass there. The others
fail for every configuration without "osd/ECTransaction: do not re-clone
data a truncate has already backed up". Also roll back an op that
truncates an object to a larger size, which needs "test/osd: roll back
log entries through the PG's real backend".

Gaps within a page: when an op leaves two extents of a shard in one page
with a gap between them, the data on one side of the gap was lost. This
happens when a truncate keeps the start of a page and a write in the
same op starts further into that page, and when an op writes twice to a
page above the end of the object. Test each; both fail for every
configuration without "osd/ECUtil: zero the gap between extents that
share a page".

Matrix: TestECTruncateMatrix runs a table of cases for every EC
configuration. Offsets are computed from k and the stripe unit, and a
case that means nothing for a geometry is skipped. Most cases truncate
an object in one op, and may also write or zero it in the same op. The
object is chunk aligned, page aligned, unaligned or shorter than a
stripe. It is truncated part way through a page of the first chunk, to
a page boundary in it, to a chunk boundary, part way through a page of
a middle chunk, into the last chunk, to a stripe boundary, within the
last page of the object, to one byte, to zero, to its own size or to a
larger size. The writes are below the new end, ending at it, straddling
it, just above it in the same page, in the truncated range, past the old
end, several of these together, or a zero within the new size. Further
cases truncate down then up, up then down, and write then truncate
across the write in one op; chain two or three ops in flight on one
object; follow a committed truncate with ops in flight; and run ops on
two objects at once, to catch cross-talk in the extent cache.

Each case runs forward, and rolled back with the op blocked to shard 1
and the last parity shard, a data shard other than the first two, or the
primary failing. As an op that does not write shard 1 is not rolled
back, each case is also rolled back with the op blocked to the first
parity shard, which every op writes, and a data shard or the primary
failing. Some cases need "os/memstore: do not replace the target of a
clone_range with its source".

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>

* common/io_exerciser: zero the blocks that a TruncateWrite adds

When a TruncateWrite grew an object, ObjectModel gave the blocks between
the old size and the new size random seeds, so it expected them to hold
generated data. RADOS fills them with zeros, so a read of them would be
reported as a miscompare. Leave them with seed 0, which DataGenerator
generates as zeros, as the model already does for a Truncate.

For example, after "create 2" and "truncatewrite 5 4 1" in interactive
--dryrun mode, the model held nonzero seeds for blocks 2 and 3; it now
holds 0 for them.

No sequence has grown an object with a TruncateWrite: Seq16 truncates to
at most the object size. Seq17, added for Bill Scales' review of
https://github.com/ceph/ceph/pull/72140
(https://github.com/ceph/ceph/pull/72140#pullrequestreview-5487870084),
needs this.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>

* common/io_exerciser: add Seq17, permutations of a TruncateWrite

Answers point 2 of Bill Scales' review of
https://github.com/ceph/ceph/pull/72140
(https://github.com/ceph/ceph/pull/72140#pullrequestreview-5487870084),
which asked for ceph_test_rados_io_sequence tests of a truncate and a
write in one op, iterating over the object size X, the truncate size T,
the write offset O and the write length L, all in blocks, so that the
block size (4K, 2K or a prime) moves them against the EC boundaries. The
combinations must include T < X and T > X; O = 0, O < T, O > T and
O > X; and O + L < T, O + L > T and O + L > X.

Seq17 applies each TruncateWrite to a new object of size X and reads
the whole object after it. T takes every value from 0 to X + 3. O takes
0, 1 and the values at and either side of T and of X. The end of the
write, O + L, takes O + 1, the values above O at and either side of T
and of X, and max(X, T) + 2. X comes from the object size range, as for
Seq15 and Seq16.

Taking every value of all four would need O(X^3) ops for each X; this
needs O(X): 1246 TruncateWrites for X = 32 and 3716 for X = 97, each
followed by a read, where Seq2 issues 5984 reads for sizes 1 to 32. For
any X of 3 or more, a --dryrun run of Seq17 covers each of the 44
possible combinations of T against X, O against 0, T and X, and O + L
against T and X.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>

* qa/nfs: fix test_cluster_info to include enable_nfsv3 and enable_nfs_metrics

The cluster info response now returns enable_nfsv3 and enable_nfs_metrics
fields but the test's expected host_details dict was missing them, causing
assertDictEqual to fail.

Fixes: https://tracker.ceph.com/issues/82723

Signed-off-by: Afreen Misbah <[email protected]>

* rgw: reject unknown or missing elements in PutBucketEncryption

PutBucketEncryption ignored elements it did not know and treated Rule
and SSEAlgorithm as optional, so a misspelled or misplaced element came
back 200 as if it were absent. A misspelled or misplaced SSEAlgorithm
stored a rule with no algorithm, a misspelled Rule stored no rule at
all, and a misspelled BlockedEncryptionTypes or EncryptionType stored a
rule that left SSE-C allowed.

Reject any element the S3 schema does not define for its parent with
400 MalformedXML and require Rule and SSEAlgorithm. Other xml decoders
in rgw still ignore unknown elements, but dropping one here silently
changes how new objects are encrypted or which encryption types the
bucket blocks. A rule with only BucketKeyEnabled or only
BlockedEncryptionTypes is still accepted. Configurations already stored
are unchanged.

Signed-off-by: Matthew N. Heler <[email protected]>

* s3tests: add tests for malformed PutBucketEncryption bodies

Add tests to validate that PutBucketEncryption answers 400 MalformedXML
to a missing, misspelled or misplaced element and stores no
configuration. boto3 only serializes elements in its model, so each test
swaps in a raw body before the request is signed.

New tests:
- test_put_bucket_encryption_missing_rule: no Rule
- test_put_bucket_encryption_missing_sse_algorithm: a default with only
  KMSMasterKeyID
- test_put_bucket_encryption_misspelled_sse_algorithm: SseAlgorithm
- test_put_bucket_encryption_misplaced_sse_algorithm: SSEAlgorithm
  directly under Rule
- test_put_bucket_encryption_misspelled_rule: Rules instead of Rule
- test_put_bucket_encryption_misspelled_blocked_encryption_types:
  BlockedEncryptionType next to a valid default
- test_put_bucket_encryption_misspelled_encryption_type: EncryptionTypes
  inside BlockedEncryptionTypes

Signed-off-by: Matthew N. Heler <[email protected]>

* rgw: reject more than one Rule in PutBucketEncryption

PutBucketEncryption decoded only the first Rule and ignored the rest,
so a second Rule came back 200 without taking effect. A second Rule
carrying BlockedEncryptionTypes left SSE-C allowed.

Reject a configuration with more than one Rule with 400 MalformedXML,
which is what S3 answers for it. A single Rule is decoded as before.

Signed-off-by: Matthew N. Heler <[email protected]>

* s3tests: add a test for PutBucketEncryption with two rules

Add a test to validate that PutBucketEncryption answers 400 MalformedXML
to a configuration with a second Rule and stores no configuration.

New tests:
- test_put_bucket_encryption_two_rules: a default rule followed by a
  rule that blocks SSE-C

Signed-off-by: Matthew N. Heler <[email protected]>

* SimpleRADOSStriper: fix teardown race conditions

This patch addresses two issues in the teardown phase:

1. `wait_for_aios(true)` is explicitly invoked to prevent in-flight AIO
   completions from being destroyed when `aios` goes out of scope,
   preventing memory corruption/segmentation faults.
2. The `shutdown` flag is now protected by the `lock_keeper_mutex` when
   toggled, preventing a race condition where the thread misses the
   notification and blocks indefinitely on thread join.

Assisted-by: Gemini
Signed-off-by: Patrick Donnelly <[email protected]>

* SimpleRADOSStriper: print stat size

Improves debug observability by logging the retrieved file size during
`stat` operations.

Assisted-by: Gemini
Signed-off-by: Patrick Donnelly <[email protected]>

* SimpleRADOSStriper: print connection cookie in debugging

Appends the connection cookie to the `dout_prefix` output. This helps
operators and developers easily differentiate between different database
handles in the logs.

Assisted-by: Gemini
Signed-off-by: Patrick Donnelly <[email protected]>

* cls/lock: add method to get lock info outbl

Signed-off-by: Patrick Donnelly <[email protected]>

* cephsqlite: support concurrent readers

Instead of using an exclusive lock for all database access, allow shared
reader locks to improve read-heavy workload throughput. This patch maps
SQLite VFS locking states to Ceph RADOS advisory locks using a single
primary lock object (`striper.lock`) paired with extended attributes
(`striper.state` and `striper.excl`) to safely facilitate atomic lock
escalation without deadlocks:

- SQLITE_LOCK_SHARED (1): Acquires a SHARED lock on the primary object and
  verifies `striper.state` > None.
- SQLITE_LOCK_RESERVED (2): Acquires a SHARED lock and sets `striper.state`
  to 2. Populates `striper.excl` with the client's address as a gatekeeper
  so only one client can intend to write at a time, bypassing the classic
  SQLite Upgrade Deadlock.
- SQLITE_LOCK_PENDING (3): Upgrades `striper.state` to 3, blocking new readers.
- SQLITE_LOCK_EXCLUSIVE (4): Upgrades the RADOS lock to EXCLUSIVE and sets
  `striper.state` to 4. Returns -EBUSY cleanly if other SHARED readers
  still exist, ensuring no transactional state is corrupted.

Additionally implements `xCheckReservedLock` by checking the reservation
state via `striper.state` to quickly report if any client currently holds
intent to write, satisfying SQLite's concurrency requirements.

Assisted-by: Gemini
Fixes: https://tracker.ceph.com/issues/49958
Signed-off-by: Patrick Donnelly <[email protected]>

* test/libcephsqlite: expand locking and concurrency test coverage

This introduces comprehensive test coverage for the newly implemented
SQLite VFS to RADOS advisory lock state machine, verifying the atomic
escalation paths and contention handling.

Specific scenarios newly covered:
- ConcurrentReaders: Verifies multiple clients can successfully hold
  SHARED locks simultaneously without blocking.
- ReservedLockConcurrency: Ensures a RESERVED lock allows existing
  readers to continue while correctly preventing other immediate transactions.
- ExclusiveLockConcurrency: Validates EXCLUSIVE locks correctly return
  -EBUSY to block incoming readers.
- LockDowngrade: Validates locks correctly step down from EXCLUSIVE
  to SHARED after a transaction commits while a read cursor is still open.
- DeadClientRecovery: Simulates a crashed writer by injecting a stale
  XATTR_EXCL and verifies the safe recovery and lock-stealing logic.
- ContentionWaitLoop: Verifies the -EBUSY backoff/retry loop correctly
  waits for locks to free up before reaching the acquire_timeout.
- LockRenewal: Confirms the background lock_keeper thread successfully
  renews both SHARED and EXCLUSIVE leases to prevent premature expiration.

Assisted-by: Gemini
Signed-off-by: Patrick Donnelly <[email protected]>

* SimpleRADOSStriper: hide symbols

These are not part of any public ABI/API.

Signed-off-by: Patrick Donnelly <[email protected]>

* libcephsqlite: add sleep method

Which is apparently required by the sqlite3 busy_timeout. Previously,
this was implemented (incorrectly) within the VFS SimpleRADOSStriper
itself.

Signed-off-by: Patrick Donnelly <[email protected]>

* qa/workunits: use busy_timeout in sqlite3 testing

The wait is no longer done by the VFS layer (in general without a lock
timeout pragma).

Signed-off-by: Patrick Donnelly <[email protected]>

* qa: add more cephsqlite debugging for upgrades

Signed-off-by: Patrick Donnelly <[email protected]>

* pybind/mgr: set sqlite busy_timeout to 60s for MgrModule

Now that libcephsqlite implements xSleep and supports the SQLite busy
handler, setting a 60-second (default) busy timeout allows mgr modules
to wait out transient lock contention or lock recoveries rather than
immediately aborting with SQLITE_BUSY. This duration safely exceeds
SimpleRADOSStriper's 30-second lock_keeper_timeout.

Signed-off-by: Patrick Donnelly <[email protected]>

* doc/cephfs: explain caps that cover every file system

Say that an MDS or Monitor capability without fsname applies to every
file system, show the caps that "ceph fs authorize '*'" creates, and
say that fsname=* is not a valid capability.

Fixes: https://tracker.ceph.com/issues/74356
Assisted-by: Claude Opus-5.5
Signed-off-by: Anthony D'Atri <[email protected]>

* cls/lock: don't clean an expired ephemeral lock from a read-only method

read_lock() removes the backing object when an ephemeral lock has drained
of unexpired holders, via cls_cxx_remove(). get_info and assert_locked are
registered read-only (CLS_METHOD_RD, RdTag / RdPromoteTag), so when they
reach that path the OSD rejects the write issued by a non-WR method and
fails the whole class call with EIO (PrimaryLogPG: "tried to update object
but is not marked WR"). Both methods then answer EIO instead of the lock's
state, and the cleanup is lost with them.

Gate the removal on a may_write flag that read_lock's callers pass: the
write-capable methods (lock, unlock, break_lock, set_cookie) still clean the
drained object, while the read-only methods skip the removal and report the
lock as empty. The next lock replaces the drained lock and that holder's
unlock removes the object; the removal was already lost before this
change, so nothing new is left behind.

https://tracker.ceph.com/issues/56575 logged this same failure in 2022
but was closed by a test-only change (PR ceph/ceph#47148) that
lengthened the test's lock durations so the lock never expired during
the run; the class behaviour was never corrected.

Assisted-by: Claude-v2.1.286:claude-opus-4-8
Assisted-by: Claude-v2.1.318:claude-opus-5-5
Fixes: https://tracker.ceph.com/issues/80993
Signed-off-by: Joshua Hoblitt <[email protected]>

* mgr: leave read balance scores out of the osd_map getter

OSDMap::dump computes a read balance score for every replicated pool,
and each score maps every PG of the pool. The mgr's osd_map getter
dumps the map under the GIL whenever a Python module asks for it, so
every module stalls while the scores are computed.

No module needs them there. The balancer gets them from
get_osdmap().dump(), which still includes them, and the mons still
include them in osd dump and osd pool ls detail. Add a
with_read_balance argument to OSDMap::dump, true by default, and to
dump_pool, and have the getter pass false. The dashboard's /api/pool
stops returning the read_balance field it passed through, which
neither its UI nor its OpenAPI spec uses.

TestOSDMap dumps the map with the default, with with_read_balance true
and with it false. The replicated pool must have a read_balance section
in the first two dumps and not in the third, and the erasure-coded pool
never has one. The balancer's read modes rely on the default dump
including the scores.

Fixes: https://tracker.ceph.com/issues/82063
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus-5.5

* doc/cephfs: describe pinning the subvolume trash folder

Say that a removed subvolume is moved into /volumes/_deleting and
purged there, so that the unlink load goes to the rank that holds that
folder, and show how to pin it to another rank. Say which purges the
pin does not move: subvolumes with their own pin, and data directories
trashed inside their subvolume, since the MDS does not allow renames
across subvolume boundaries. Also say that the MDS migrates the pinned
folder only when it is not empty, and that the folder stays on the
pinned rank afterward.

Fixes: https://tracker.ceph.com/issues/61902
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus-5.5

* doc/rados: rewrite PG Calc without jQuery or archive.org assets

The PG Calc page restored in eaaf7225312 loads the old ceph.com WordPress
theme stylesheets, jQuery, and jQuery UI from web.archive.org and Google,
and pgcalc.js is the Wayback Machine's rewritten copy of the old script.
The theme stylesheets restyle the docs page around the calculator, its
table runs past the content column, and Generate Commands navigates to a
data: URL, which current browsers block, so it does nothing.

Rewrite pgcalc.js in plain JavaScript with its own CSS and nothing loaded
from other sites. The suggested PG count is unchanged for a given size:
200,000 random inputs give the same count as the previous code.

- Each pool has an application and is replicated or erasure coded, with
  its own k (at least 2) and m (at least 1). An erasure-coded pool counts
  k+m shards.
- Generate Commands creates a replicated CRUSH rule, and an erasure-code
  profile and CRUSH rule for each k and m, with a chosen failure domain
  and CRUSH root; then each pool with its rule, its size or profile,
  allow_ec_overwrites for erasure-coded RBD and CephFS pools, and its
  application. It shows them with Copy and Download buttons and leaves
  out removed pools.
- A pool is marked red, and left out of the commands, when OSD # is less
  than its size or k+m, so its PGs can't be placed. A pool is marked amber
  when it has fewer than three replicas or m=1.
  Erasure coding for an RGW index or metadata pool or a CephFS metadata
  pool draws a warning, as does k above 8, which slows writes and
  rebuilds for diminishing savings in space.
- The calculator renders into pgcalc-root, because the page's pgcalc
  label is also the id of an element ahead of it.
- A column heading opens a native dialog to set that value for every pool,
  and Add pool adds a row directly.
- The RGW presets use the pools that RGW creates today, the Infernalis-era
  presets are gone, CephFS and erasure-coded RGW presets are added, and
  All-in-One puts 100% of the data in rbd rather than 200%.

Move the instructions, field descriptions, and formula out of raw HTML into
RST, describe the generated commands, and tie the Target PGs per OSD
guidance to mon_target_pg_per_osd and mon_max_pg_per_osd, which
d34fa3316f0 raised to 200 and 500 for the Umbrella release. Note that many
clusters do fine with the PG autoscaler once that target is at least 200,
and that the calculator assumes OSDs of one size: with mixed sizes the
largest OSDs hold the most PG replicas, which calls for a generous
mon_max_pg_per_osd.

Fixes: https://tracker.ceph.com/issues/82513
Fixes: https://tracker.ceph.com/issues/64905
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus 5.5

* doc/rados: add FD Calc, a failure domain capacity calculator

Add a page with a calculator for how much of a cluster's raw capacity a
replicated or erasure-coded pool can use, given the CRUSH weights of its
failure domains. Each PG puts at most one shard in a failure domain, so
none can hold more than 1/n of what a pool with n shards per PG stores,
and capacity past that is stranded. The calculator shows:

- What a balanced placement stores at full_ratio, what is held back by
  full_ratio, and what is stranded, for each failure domain.
- What CRUSH alone stores before the first failure domain fills, from
  straw2's chance of choosing each failure domain: exact for up to 16
  failure domains, sampled for more.
- After an OSD or a whole failure domain fails, the new capacity, what is
  newly stranded, and how full the pool can be for backfill to re-protect
  everything before an OSD reaches backfillfull_ratio.
- Red when there are too few failure domains to place each PG, yellow
  when there is no spare failure domain, orange when capacity is
  stranded, and a warning for m=1.

The calculator is one HTML fragment with its own CSS and JavaScript,
included with the raw directive. Link it from PG Calc and from the
failure domain discussion in the CRUSH map page.

Fixes: https://tracker.ceph.com/issues/82513
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus 5.5

* test/libcephfs: cover blockdiff growth and different auth ranks

Add a hardlink growth test with an explicit object layout to check the
snapshot sizes across object boundaries and exclude later head growth.

Add a two-MDS test that leaves the older snapshot inode on another rank
and verifies the conservative result covers exactly the newer snapshot.

Signed-off-by: Li Sheng <[email protected]>

* mgr/dashboard: NFS Cluster Detail Page

Fixes: https://tracker.ceph.com/issues/81423

Signed-off-by: Dnyaneshwari Talwekar <[email protected]>

* doc: update libcephsqlite docs on concurrent readers

Fixed in 1cbffd3fb160ccc2f6f7d8959d47bf2849757fc2.

Signed-off-by: Patrick Donnelly <[email protected]>

* qa/rgw: point the java s3tests at a Maven Central mirror

Maven Central (repo.maven.apache.org) rate-limits the test lab, and the
java s3tests pull the AWS SDK and their one gradle plugin from it via
mavenCentral() in the suite's build.gradle. Enough of those downloads
fail that the rgw/verify suite loses a sizeable fraction of its jobs.

Write a gradle init script into the test checkout and pass it with
--init-script. It hooks repositories.all on every project, including
buildscript repositories and pluginManagement, and rewrites any
repository whose host is repo.maven.apache.org to the Google mirror of
Maven Central. Since the hooks fire for repositories added later by
build.gradle, this works regardless of what the test suite declares,
and the mirror can be changed per client with a new 'maven-repo' task
option.

Verified locally with gradle 6.0.1 on JDK 8 against ceph-master of
java_s3tests: without the script, 512 fetches from repo.maven.apache.org;
with it, 0 from Apache and 514 from the mirror, build successful.

Also give the task an explicit name so that a teuthology 'overrides'
block keyed 's3tests-java' applies to it; previously the key would have
had to be the lowercased class name, s3tests_java.

Fixes: https://tracker.ceph.com/issues/82736
Assisted-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>

* qa/rgw: drop dead gradle stanza from test_awssdkv4_sig.sh

The jcksum workunit is a Maven project, so the gradle init script this
script writes is never read. It was also broken three ways: the tilde
in "~/.gradle/init.gradle" is quoted so never expands and the script
creates a literal '~' directory in the working directory; a
pluginManagement {} block is only valid in settings.gradle, not an init
script; and the cleanup line removes $gradle_savings, a typo. The Maven
settings.xml mirror and MVNW_REPOURL are what actually redirect the
downloads, and they stay.

Fixes: https://tracker.ceph.com/issues/82736
Assisted-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>

* tools/contrib: sync upmap-remapped.py with cernceph/ceph-scripts

Bring the in-tree copy of upmap-remapped.py in line with the version
maintained at https://github.com/cernceph/ceph-scripts, as of commit
6a83fb45d0089a21ce966b057c7824707b1e239c (cernceph/ceph-scripts#51 and
cernceph/ceph-scripts#52).

Notable changes:
- argparse command line; the cluster work runs from main()
- a remapped pg which already carries pg-upmap-items has its mapping
  recomputed instead of having its items removed
- never map a pg onto an osd which is down
- when a crush rule changes failure domain (host -> rack, rack -> row),
  keep the acting osds the new rule still allows and replace only the
  ones which violate it, instead of letting the whole pool backfill
- break the shard rotations this can leave behind on ec pgs

The file is a verbatim copy of tools/upmap/upmap-remapped.py from
cernceph/ceph-scripts.

Signed-off-by: Frédéric Nass <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* common/test: Tests for `from_iso_8601` handling of timezones

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Make `from_iso_8601` return `std::optional`

When this was written, `boost::optional` was the only game in town.

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Rewrite `ceph::from_iso_8601`

Add support for timezones, improve testing, and reject undefined
behavior.

The `ws_terminates` flag and its behavior were removed. It was
incompatible with allowing ' ' as a substitute for 'T' and was added
originally as a pre-string_view affordance. Nothing should require it,
as AWS and other services reject trailing whitespace.

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Add `basic` mode specifier for `from_iso_8601`

Currently unimplemented, so tests compile.

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Carve out timepoints from system clocks from `ceph_time_fmt.h`

In more particular we do *not* want them picking up `chrono::sys_time`

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Rewrite `to_iso_8601` in terms of libfmt

This gets rid of `stringstream` and adds support for the 'basic' format.

Signed-off-by: Adam C. Emerson <[email protected]>

* common/test: Add many more tests for `iso_8601.cc`

Expand and improve tests ahead of rewriting `to_iso_8601` and adding a
`basic` mode to `from_iso_8601`.

Assisted-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adam C. Emerson <[email protected]>

* common: `to_iso_8601` supports basic format timestamps

In addition to the 'extended' "YYYY-MM-DDThh:mm:ssZ" style of
timestamp, accept the 'basic' 'YYYYMMDDThhmmssZ' style.

The 'lax' mode accepts both but will not accept a mixture of the two
styles. Strict still allows the basic-style offset (±hhmm), because
many clients generate it.

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Simplify bounding with internal type

Since the `std::chrono::system_clock`'s time points are signed, create
a 128-bit signed internal time to avoid the overhead of bounded
addition/subtraction at every step and simply calculations. The year
bound keeps it well within the available time, and we validate at the end.

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Rewrite ceph::real_time formatter without strftime

Signed-off-by: Adam C. Emerson <[email protected]>

* common: Add `iso_8601_bound` parameter to `from_iso_8601`

When set to `saturate_above`, numbers after our epoch are set to the
latest representable time. This is specifically to support the common
idiom of using `9999-12-31` or other far-future times to mean
'forever'.

Signed-off-by: Adam C. Emerson <[email protected]>

* qa/suites: remove leftover centos9 link

Signed-off-by: Patrick Donnelly <[email protected]>

* qa/distros: remove ubuntu 22 from supported distros

Fixes: https://tracker.ceph.com/issues/77313
Signed-off-by: Casey Bodley <[email protected]>

* qa/distros: remove ubuntu 22 from supported-container-hosts

Fixes: https://tracker.ceph.com/issues/77313
Signed-off-by: Casey Bodley <[email protected]>

* qa/suites: remove links to jammy

Swap in Noble.

Fixes: https://tracker.ceph.com/issues/77313
Signed-off-by: Patrick Donnelly <[email protected]>

* rgw/s3vectors: background vector-index rebuild with distributed locking

- background rebuild engine with per-table mutation tracking, worker pool,
  and cross-instance distributed locking (conditional S3 object lock, TTL refresh)
- drop persisted global_delete_count; use lancedb_table_stats() ghost-row count
  as ground truth for delete-ratio rebuild decisions
- fix silent-merge defects from rebase (VectorBucketConfig<>, BackendConfig args)
- make distributed lock storage-mode aware (fix default VECTOR_BUCKET mode)
- update lancedb-c submodule to upstream main (PR #71, adds LanceDBFragmentStats)
- drop unused build_state_t and table metadata persistence (dead code)
- replace table_state_t/tables map with pending_mutations set (simpler design)
- fix restore_pending on benign lock-held-by-other path (tight-loop fix)
- apply cooldown on all non-retry process_table outcomes (tight-loop fix)
- coalesce LOCK_REFRESH events and cap event-log response size
- move rebuild status to /admin/vectorbucket/rebuild sub-resource
- move /admin/vectorbucket manager into rgw_rest_vector_bucket.{h,cc}
- fix tenant missing from event coalescing key; improve rebuild tests
- change default index type from auto to ivf_flat (better recall)

Signed-off-by: Gal Salomon <[email protected]>
Assisted-by: claude-code:claude-fable-5-1

* test/rgw/s3vectors: sign the Host header sent to the admin REST API

Send the Host header explicitly, so that botocore signs the same value
that urllib sends.

Signed-off-by: Yuval Lifshitz <[email protected]>
Assisted-by: claude-code:claude-fable-5-1

* doc: drop EOL release names from four CephFS pages

Remove the Hammer framing and the pre-Hammer section from
doc/cephfs/full.rst, the release names from
doc/cephfs/kernel-features.rst while keeping its kernel versions, the
Jewel note from doc/cephfs/client-auth.rst, and the Jewel reference from
doc/cephfs/mount-using-kernel-driver.rst.

Fixes: https://tracker.ceph.com/issues/77195
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted-by: Claude Opus-5.5

* doc/governance: remove selected CSC members

See: https://tracker.ceph.com/issues/82118
Signed-off-by: Patrick Donnelly <[email protected]>

* doc/governance: add new members to CSC

See: https://tracker.ceph.com/issues/82119
Signed-off-by: Patrick Donnelly <[email protected]>

* osd: pool migration data model (pg_pool_t, PG states, feature bit)

Introduce the core data model, PG states, and metadata structures for RADOS
pool migration:

- Add migration_src, migration_target, and migration_root fields to pg_pool_t.
- Define new PG states: PG_STATE_MIGRATING, PG_STATE_MIGRATION_WAIT,
  PG_STATE_MIGRATION_TOOFULL, PG_STATE_MIGRATION_UNFOUND, and
  PG_STATE_MIGRATION_ERROR.
- Add request_redirect_t pool-migration constructor and helpers
  (is_pool_migration(), update_migration_watermark()) for client op
  redirection carrying the migration watermark.
- Add object state and snapshot migration helpers (pool_migration_write_marker,
  get_pool_migration_write()) to osd_internal_types.h and object_state.h.
- Add PGTransaction dump() debug helper.
- Enforce SERVER_VAMPIRE feature bit requirement when pools are migrating.
- Bump struct encodings and wire formats: pg_pool_t (struct_v 34),
  request_redirect_t (struct_v 2), object_stat_sum_t (struct_v 21 for
  num_objects_migrated and num_bytes_migrated), and object_copy_data_t
  (struct_v 9 for watchers).

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Bill Scales <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: migrated-pool completion notification

Implement completion messaging from OSD PGs to the monitor when pool
migration completes:

- Add MOSDPGMigratedPool message to notify OSDMonitor when a PG has finished
  migrating all objects to the target pool.
- Register MSG_OSD_PG_MIGRATED_POOL in msg infrastructure.
- Implement OSDService::send_pg_migrated_pool() helper.

Signed-off-by: Jamie Pryde <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: pool migration peering state machine

Implement pool migration peering states and inter-OSD reservation messaging:

- Add MigratingSource, MigratingTarget, WaitLocalPoolMigrationReserved,
  WaitRemotePoolMigrationReserved, NotMigrating, and
  RepWaitPoolMigrationReserved states to PeeringState.
- Add MPoolMigrationReserve peering message to negotiate and track pool
  migration reservations across peer shards.
- Extend PeeringListener and PG interfaces with pool migration reservation
  and suspension callbacks, add HBHandle* parameter to on_activate_complete
  and on_activate_committed, and add num_objects parameter to
  try_reserve_recovery_space.
- Add OSD dispatching and perf counters for pool migration states and
  stats invalidation (rs_stats_invalidated).
- Increase BOOST_MPL_LIMIT_LIST_SIZE from 30 to 40 in CMakeLists.txt to
  accommodate expanded PeeringState reaction lists.
- Add last_event_desc and last_exited_state diagnostic recording to
  PeeringState Crashed state handler.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* crimson/osd: pool migration stubs and interface updates

Update Crimson OSD and PG interfaces to support pool migration:

- Add stub implementations for Crimson PeeringListener and PGBackend interface
  methods for pool migration events and watermark tracking.
- Add MOSDPGMigratedPool dispatch and sending support in Crimson shard_services.
- Add stub handlers in Crimson PGRecovery for pool migration reservation states.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: pool migration target reservation protocol

Add the protocol by which a source PG reserves space on a target PG
before copying objects:

- Add CEPH_OSD_OP_PG_POOL_MIGRATION_RESERVE/RELEASE and the
  pool_migration_reserve (num_bytes, num_objects) op payload in rados.h.
- Source: request a reservation from the target PG, sized by the number
  of remaining target PGs. Retry after a delay on -EBUSY (stale epoch),
  stop the migration on -ENOSPC or any other error, and send a release
  when finished. A generation counter invalidates stale async callbacks.
- Target: handle RESERVE/RELEASE in do_pg_op, hold the request until the
  local reservation is granted and then reply, and fail queued requests
  if the reservation is suspended. A granted reservation removes stale
  objects left by an interrupted migration (pool_migration_target_delete).
- Add helpers to map an object hash to its source and target PG and to
  count the remaining target PGs.
- Cancel or clear reservations in on_change and on_shutdown.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: pool migration source delete, copy failure handling and range scan

Add the source-side code that runs when a pool migration copy finishes
or fails, and the scanning that selects objects to migrate. Nothing in
this commit starts a copy: recover_pool_migration() is a stub, and the
copy_from itself is added by the object copy engine commit.

- Add C_Migrate, the completion for a migration copy_from. On success it
  deletes the object from the source pool
  (pool_migration_source_start_delete[_head], pool_migration_source_delete),
  deleting a head only after all of its clones. While quiescing, every
  completion is treated as a failure so that in-flight copies drain.
- Add handle_pool_migration_copy_failure, which enters quiesce mode for
  retryable (-EBUSY) and fatal (-ENOENT, -EIO, -EPERM) errors, and
  stop_pool_migration_unfound/error and on_pool_migration_source_suspended
  to report the result once the quiesce completes.
- Add scan_range_migration and update_range(PoolMigrationInterval*) to
  list the objects in the current migration range and keep the list up
  to date from the PG log.
- Add a stub recover_pool_migration and hook it into start_recovery_ops,
  including PG_STATE_MIGRATING handling and the DoPoolMigration and
  PoolMigrationDone peering events. DoPoolMigration is also queued after
  recovery and backfill complete and after mark_all_unfound_lost.
- In do_op_impl for a migration source pool, fail clients that lack
  CEPH_FEATUREMASK_SERVER_VAMPIRE with -EIO, and redirect ops for
  objects below the migration watermark to the target pool.
- Treat the watermark object (at the start of a new interval) and
  in-flight migration objects as degraded.
- Fail a CEPH_OSD_COPY_FROM_FLAG_POOL_MIGRATION copy_from with -EBUSY
  unless the target holds reservations.
- Only drop the recovery read in _clear_recovery_state when the
  recovery_read_marker is set.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: backend support for pool migration watermark and object ranges

Add backend support in ECBackend and ReplicatedBackend for migration watermarks:

- Introduce PoolMigrationInterval (in recovery_types.h) to track migration
  watermark, object ranges, and progress across peering intervals.
- Implement consider_updating_migration_watermark() across backend pipelines to
  advance watermarks as objects are modified or deleted.
- Propagate watermark updates across MOSDRepOp (bumped to v4) and ECSubWrite
  (bumped to v6) messages to replicas.
- Add cancel_recovery_op() to PGBackend interface and backend implementations
  (ECBackend, ECBackendL, ReplicatedBackend, ECSwitch) to keep in-flight
  recovery ops synchronized with recovery cancellations.
- Add OI_ATTR existence check in ReplicatedBackend calc_head_subsets and
  calc_clone_subsets.
- Add fmt formatter support for PoolMigrationInterval in recovery_types.h.
- Ensure backend recovery and clone trims remain synchronized with active
  migration ranges.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: migration watermark and object-range scanning

Add the watermark and range-scan logic that decides which objects a
source PG migrates next:

- Add next_pool_migration() and earliest_pool_migration() to find the
  lowest-hash object still to migrate, and
  consider_updating_migration_watermark() to advance the watermark past
  objects that have been migrated or deleted.
- Rework scan_range_migration() and update_range(PoolMigrationInterval*)
  to scan from the watermark, and to leave alone log updates for objects
  below it.
- Split on_activate_complete() into _on_activate_committed(), which
  every shard runs, and the primary-only on_activate_complete(). Both
  now take an HBHandle, and on_activate_committed() is added.
  _on_activate_committed() scans the first migration range, merges
  missing objects into it, sets the watermark from earliest_pool_migration()
  and builds the target PG list (initialize_pool_migration_target_pg_list).
- In on_activate_complete(), queue DoPoolMigration when the PG needs
  migration and nothing else (recovery or backfill) is pending.
- Make recover_pool_migration() initialise the migration interval, and
  keep it up to date with update_range() before choosing the next object.
- Erase an object from pool_migrations_in_flight when it is recovered,
  and assert that none are left in _clear_recovery_state().
- Add the on_pool_migration_source_starting() override.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: object copy engine for pool migration

Implement the core object copy engine for pool migration in PrimaryLogPG:

- Implement migration_copy_from_check() and cancel_pool_migration_copy_ops()
  to transfer object data, attributes, and omap to the target pool.
- Handle copy-from completion, failure retries, and out-of-order copies.
- Support migrating whiteout head objects (adding whiteout flag to
  object_copy_data_t, creating whiteouts on target, updating whiteout stats,
  and passing pool_migration flag to _delete_oid).
- Add CEPH_OSD_COPY_FROM_FLAG_POOL_MIGRATION flag in rados.h.
- Update PGMap with pool migration throughput and object statistics rate summaries.
- Update SplitOp target calculation for objecter copy-from operations.
- Add osd_debug_inject_copyfrom_single_error config option for error injection.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Bill Scales <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: snapshot and watcher support for pool migration

Add snapshot context, clone, and watcher migration support to PrimaryLogPG:

- Preserve clone snapsets and snapshot metadata during migration, mirroring
  snapsets to the target pool.
- Source the pool snap context and pool-snaps mode from the migration-chain
  root pool (PGPool), so clone-on-write during migration uses the root's
  snapc, and honour MAP_SNAP_CLONE in execute_ctx to keep the source
  object's snapset.seq instead of fast-forwarding it to the pool seq.
- Refactor trim_object() into add_trim_to_ctx() to allow applying clone trims
  directly to an existing OpContext during migration copy and clone processing.
- Handle clone trimming, pruned clone cleanup, and snapset rebuilds during
  in-flight object copies.
- Add flags2 field to ceph_osd_op.copy_from and define
  CEPH_OSD_COPY_FROM_FLAG_POOL_MIGRATION_HAS_RES and
  CEPH_OSD_COPY_FROM_FLAG2_POOL_MIGRATION_HAS_CLONES in rados.h.
- Migrate registered object watchers to the target pool.
- Update scrubber to tolerate intermediate snapshot states and incomplete clones
  on migration target pools.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0

* osd: pool migration quiesce on suspend and new interval

Extend the quiesce mechanism (which until now only handled copy
failures) so that in-flight migration copies are drained when the
migration is suspended or the PG re-peers, rather than being discarded.

- Add two quiesce reasons, SUSPEND_NEEDED and NEW_INTERVAL, and the
  pool_migration_quiesce_last_started_reset flag.
  on_pool_migration_source_suspended() sets SUSPEND_NEEDED if copies are
  still in flight, and finishes the suspension once they have drained.
- on_change(): instead of always clearing the quiesce state, set
  NEW_INTERVAL when copies from the previous interval are still in
  flight. An in-progress FATAL_ERROR, RETRY_NEEDED or SUSPEND_NEEDED
  q…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants