Repository navigation
Wip posix nsfs accts notify sse misc - #69529
Open
mattbenjamin wants to merge 173 commits into
Open
mattbenjamin wants to merge 173 commits into
mattbenjamin wants to merge 173 commits into
Conversation
This seems to be needed for (at least) object lock retention period checks, e.g., in DeleteObject::execute(). Signed-off-by: Matt Benjamin <[email protected]>
Retention rules can be specified in init-multipart, and of present, need to propagate to the final object if the upload completes. Needed for (e.g.) test_object_lock_delete_multipart_object_with_retention Signed-off-by: Matt Benjamin <[email protected]>
The upstream logic (mostly?) correctly uses bde.flags when filling the cache for versioned objects, but cache ser(de)ialization has been discarding that member. This change suppresses the visible result where RGW incorrectly produces multiple versions in non-versioned listing because none uniquely sets FLAG_CURRENT: mbenjamin@fedora:~/dev/rgw/s3_py/python$ s3cmd ls s3://sheik2 2026-02-14 22:44 22 s3://sheik2/ginfizz_1 2026-02-14 22:44 22 s3://sheik2/ginfizz_1 2026-02-14 22:44 22 s3://sheik2/ginfizz_1 2026-02-14 22:44 22 s3://sheik2/ginfizz_2 2026-02-14 22:44 22 s3://sheik2/ginfizz_2 2026-02-14 22:44 22 s3://sheik2/ginfizz_2 Corrected result is: mbenjamin@fedora:~/dev/rgw/s3_py/python$ s3cmd ls s3://sheik2 2026-02-14 22:44 22 s3://sheik2/ginfizz_1 2026-02-14 22:44 22 s3://sheik2/ginfizz_2 Cached listings for versions are still incorrect in containing an an extra entry for the "current" version in with empty instance (from the Symlink)--the visible effect being that list-object-versions output is incorrect (no entry is sent with IsLatest, after the empty instance version has been filtered out). Signed-off-by: Matt Benjamin <[email protected]>
This change completes the original intent (hypothesized) to conditionally set the FLAG_CURRENT bit on just the current entries during bucket listing cache fill. This avoids interning 2 copies of the current version of each object in the listing cache, and also correctly sets the FLAG_CURRENT bit as required--so the current versions are correctly reported in versioned listings. Janky logic to find the current version by explicitly chasing the symlink target and saving it outside the enumeration scope has been replaced with proper call to stat() provided by Dang. Symlink::fill_cache() is no longer used, so removed. Signed-off-by: Matt Benjamin <[email protected]>
Posixdriver doesn't serialize POSIXMultipartUpload, but rather a member mp_obj of type POSIXMPObj--so to avoid losing the latter's inherited cksum_type and cksum_flags members (which are already copied in), copy them out in POSIXMultiPartUpload::get_info() which we need to call to copy out dest_placement anyway. (oops, chksum_type was copied in, but not cksum_flags) Signed-off-by: Matt Benjamin <[email protected]>
initially, it is just used to remember the multipart layout, but likely will see other use. Signed-off-by: Matt Benjamin <[email protected]>
Signed-off-by: Matt Benjamin <[email protected]>
Fixes crash induced by taking the address of the last element of an empty intrusive list (!). Also, introduces active queue, reducing potential for lock contention in evict_block(): * entries are tracked on lane::active_queue when lru_refcnt > 1 ** on some lane::q otherwise Object transition between queues when lru_refcnt changes value-- a value of 0 triggers deletion, as before. Fixes: https://tracker.ceph.com/issues/73992 Signed-off-by: Matt Benjamin <[email protected]>
* avoids leak of database handles during eviction Also adds missing return-ref in invalidate_entry--this would leak a cache entry. With this change, we can now tolerate indefinite s3-test runs wit rgw_posix_cache_max_buckets=100. Signed-off-by: Matt Benjamin <[email protected]>
Signed-off-by: Matt Benjamin <[email protected]>
The POSIXBucket copy constructor incorrectly calls .get() on a on a temporary unique_ptr returned by clone(), causing immediate deletion of the Directory object. This leaves a dangling pointer that triggers a segfault during destruction. Signed-off-by: Nithya Balachandran <[email protected]>
Moves file open and stat into the (atomic) link step, so size is correctly interned in the cache. Fix suggested by dang. Signed-off-by: Matt Benjamin <[email protected]>
Signed-off-by: Daniel Gryniewicz <[email protected]>
Signed-off-by: Samarah Uriarte <[email protected]>
Signed-off-by: Ali Masarwa <[email protected]>
Implement the quota feature for the POSIX driver. Signed-off-by: Nithya Balachandran <[email protected]>
Removes the DB directory path from the table names. Signed-off-by: Nithya Balachandran <[email protected]>
In two cases, logic related to the new active queue was not symmetric in active/non-active--and I have followed Claude/Sonnet in explicitly checking Object::lru_hook::active defensively. Signed-off-by: Matt Benjamin <[email protected]> Assisted-by: Claude Code, Sonnet 4.5 (cherry picked from commit 95c869895f4a5b7b4f7cec3cb2d429b8ee137b5a)
The idea for a unit test cycle modeled on (a simplified version of) nfs-ganesha MDCACHE chunking was by me. The chunksim unit test is also written by me. I used claude code to check assertions after first getting predicted stable refcnt over up to 33 continuous scans. Specifically, claude helped clarify why the maximum value of lru-refcnt before recycling rises from 2 to 3 for num_scans > 1. Squashed: restore do_create from marker Signed-off-by: Matt Benjamin <[email protected]> Assisted-by: Claude Code, Opus 4.6 1M Signed-off-by: Matt Benjamin <[email protected]>
This should not be restricted to the is-linked() path. New behavior was a side effect of active-qlane refactoring recently introduced. In addition to being the original invariant, it's reintroduction dramatically simplifed tracking down a refcnt underrun in ganesha during continued readdirs. Signed-off-by: Matt Benjamin <[email protected]>
Handle the (currently not "normally" reachable) case where the CHUNKED_READDIR unit is listing a directory with fewer entries than the ChunkCache capacity. Supporting this case wasn't originally planned, I hit it by accident by interrupting the test during the SETUP_BUCKET step. It seems like a good idea to fix for the benefit of future readers of this code, who might decide to permit setting up directories with an arbitrary number of entries (as in librgw_file_marker) and would not be expecting a trap. Fix suggested by claude code (this isn't my preferred style of filtering duplicates with a std::set, but this is a unit test...) Signed-off-by: Matt Benjamin <[email protected]> Assisted-by: Claude Code, Opus 4.6 1M
Fix multipart upload failure for names with dots. Object names were incorrectly split at the last dot during initiation, causing directory mismatches in part uploads. Generate random upload_id instead of parsing object name. - Before: "host.example.com" → oid="host.example", upload_id="com" - After: "host.example.com" → oid="host.example.com", upload_id="2~abc123" Fixes: https://tracker.ceph.com/issues/74005 Signed-off-by: Joshua Blanch <[email protected]>
Fork the posix driver into a new nsfs backend. The four core files
(rgw_sal_nsfs.{h,cc}, nsfsDB.{h,cc}) are case-preserving
POSIX→NSFS transforms of the posix originals. Shared infrastructure
(bucket_cache, lmdb-safe, notify) is reused from driver/posix via
relative includes and CMake source references.
Assisted-by: claude-code:claude-opus-4-6
…spacing Register rgw_nsfs_* config options (base_path, userdb_dir, database_root, cache_max_buckets, cache_lanes, cache_partitions, cache_lmdb_count) and add nsfs to the rgw_backend_store enum_values so the config parser accepts it. Add the #cmakedefine for WITH_RADOSGW_NSFS so the ifdef-guarded driver factory paths compile in. Add nsfs to the CINIT_FLAG_NO_MON_CONFIG list so it runs standalone without a monitor cluster. Add --rgw_store nsfs support to vstart.sh with its own data directories under $CEPH_DEV_DIR/rgw/nsfs/. Namespace the filesystem helper types (FSEnt, File, Directory, Symlink, MPDirectory, VersionedDirectory, ObjectType, BucketCache, etc.) into rgw::sal::posix and rgw::sal::nsfs respectively, so both driver headers can coexist in a single translation unit (rgw_sal.cc). Assisted-by: claude-code:claude-opus-4-6
Add test_rgw_nsfs_driver.cc with 16 tests exercising the nsfs backend against its current posix-clone behavior: FSEnt basics (Directory, File create/open/stat/attrs/read/write), driver init, bucket create, object PUT/GET/DELETE, bucket LIST, and object attrs. Tests support --create, --delete, and --verbose flags to control filesystem setup/teardown for iterative development. Also fix test_rgw_posix_driver.cc build break from the namespace changes in 99baf7e (add `using namespace posix;`). Assisted-by: claude-code:claude-opus-4-6
Remove VersionedDirectory, Symlink classes and their implementations from the nsfs namespace. Remove VERSIONED and SYMLINK enum values from ObjectType. Simplify NSFSObject::open(), make_ent(), and NSFSAtomicWriter::prepare() to always create FILE entities. Remove set_cur_version() and versioned() helpers, and clean up versioning checks in bucket list and multipart complete paths. This reduces the nsfs driver to unversioned-only operation, eliminating ~740 lines of dead code paths as a step toward the nsfs-specific hierarchical filesystem mapping. Assisted-by: claude-code:claude-opus-4-6
Object keys containing '/' now create real intermediate directories on disk. PUT of 'dir1/dir2/file.txt' creates directories dir1/ and dir1/dir2/ under the bucket root, with the file at the leaf. Key changes: - get_key_fname(): stop URL-encoding object keys; slashes are literal path separators - decode_obj_key(): stop URL-decoding (symmetric change) - Add resolve_path() helper: splits key on '/', walks/creates each intermediate directory via per-component openat/mkdirat, returns (leaf_dir, leaf_name) — avoids PATH_MAX limits on deep hierarchies - NSFSObject::make_ent(): uses resolve_path(create_dirs=true) to build the directory chain; File is created with basename in leaf directory - NSFSObject::stat(): uses resolve_path(create_dirs=false) for lookup - gen_temp_fname(): uses leaf basename only for temp file naming - NSFSObject gains dir_chain member to hold intermediate Directory object ownership for the lifetime of the operation Listing does not yet recurse into subdirectories (Phase 3). Assisted-by: claude-code:claude-opus-4-6
Shell script that starts an nsfs cluster via vstart.sh and exercises PUT/GET of flat and hierarchical objects via s3cmd, verifying both S3 API results and on-disk filesystem layout. Self-contained with inline vstart credentials, no sudo, no external config dependencies. Usage: cd build && ../src/test/rgw/test_nsfs_s3.sh --verbose Assisted-by: claude-code:claude-opus-4-6
fill_cache() now recurses into subdirectories, emitting entries with full path-based S3 keys (e.g., dir1/dir2/file.txt). Plain directories (no object-type xattr) are traversed, not emitted as objects. Key changes: - FSEnt::fill_cache() gains path_prefix parameter; prepends it to entry name for full key reconstruction - Directory::fill_cache() recurses into DIRECTORY children with accumulated prefix instead of emitting them as objects - Directory::get_ent() defaults directories without xattr to DIRECTORY (was MULTIPART), matching intermediate dirs from resolve_path() LIST with prefix/delimiter now works against the real directory hierarchy — the existing LMDB range scan + delimiter split handles CommonPrefix generation correctly with full path keys. Assisted-by: claude-code:claude-opus-4-6
After deleting a hierarchical object, reverse-walk the intermediate directory chain and rmdir each empty parent back to the bucket root. Stops at the first non-empty directory (ENOTEMPTY). Also includes Phase 3 (recursive listing) changes: - fill_cache() gains path_prefix parameter for full S3 key reconstruction during recursive directory traversal - Directory::fill_cache() recurses into plain subdirectories instead of emitting them as objects - get_ent() defaults directories without xattr to DIRECTORY (was MULTIPART), matching intermediate dirs from resolve_path() Assisted-by: claude-code:claude-opus-4-6
…tive list
unittest_posix_bucket_cache failed under LeakSanitizer:
==40342==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 248 byte(s) in 1 object(s) allocated from:
#1 BucketCacheEntry<>::Factory::alloc() src/rgw/driver/posix/bucket_cache.h:114
#2 cohort::lru::LRU<std::mutex>::insert(...) src/common/cohort_lru.h:269
ceph#3 BucketCache<>::get_bucket(...) src/rgw/driver/posix/bucket_cache.h:352
ceph#4 BucketCache<>::list_bucket(...) src/rgw/driver/posix/bucket_cache.h:437
ceph#5 BucketCacheFixtureDefault_ListTDir1_Test::TestBody() src/test/rgw/test_posix_bucket_cache.cc:199
The leaked object is a BucketCacheEntry the suite never frees at exit. The
corruption behind it is a race in the multithreaded ListThreads test, so the
leak is intermittent and does not show on every run.
LRU::unref() moves an object from the non-evictable active list to the evictable
q when its last initial ref is dropped, but it never cleared the object's active
flag. Each Object has a single intrusive lane hook, so the next ref()/unref()
read the stale flag and erased the object from the wrong list, active instead of
q. That corrupts both lanes' constant_time_size counters and leaves the entry
orphaned off the lanes. BucketCache's teardown drains the lanes to free their
entries, so it never frees that one, and LeakSanitizer flags it.
Clear the flag when the object moves to q so it always tracks the list it is on.
The leak no longer reproduces.
Signed-off-by: Kefu Chai <[email protected]>
Signed-off-by: Matt Benjamin <[email protected]>
unittest_posix_bucket_cache intermittently hung at teardown and never exited. The main thread spun at 100% CPU inside TreeX::drain(), walking an avl tree that had been corrupted into a cycle, so the loop never reached the end. It is a race in the multithreaded ListThreads test, so it does not reproduce every run, on the order of once in 60. BucketCache::get_bucket() takes a partition lock through find_latch(). On the normal create path it commits the new entry with insert_latched() while that lock is still held. The recycle branch cannot: reclaiming an lru entry mutates the tree and invalidates the latch's cached insert position, so insert_latched() is unusable. It instead dropped the partition lock and called insert() with FLAG_NONE, an unlocked tree insertion. find_latch(), insert() and remove() all serialize on the partition lock, so that insert raced them and concurrent insertions corrupted the tree. Hold the partition lock across the insert and release it afterwards. insert() resolves the same partition the latch already guards and runs with FLAG_NONE, so it takes no further lock and cannot self-deadlock. It still acquires the lock before b->mtx, matching find_latch()'s order, so it adds no new lock-ordering hazard. With this and the active-flag fix in place, the test ran 150 times without a single hang. Fixes: https://tracker.ceph.com/issues/77499 Signed-off-by: Kefu Chai <[email protected]> Signed-off-by: Matt Benjamin <[email protected]>
and stale cache in multipart list_parts In read_obj_policy(), the MultipartUpload was scoped inside the if-block, and its shadow bucket was destroyed while mpobj still held a dangling pointer to it. Moving the declaration to the function scope keeps the shadow bucket alive for the duration of the call, fixing a SIGSEGV in POSIXObject::stat() during multipart part uploads. In POSIXMultipartUpload::list_parts(), the bucket cache for the shadow directory could be filled before parts were uploaded (e.g. by a ListParts call during upload), causing CompleteMultipart to see zero parts. Invalidating the shadow bucket cache before listing ensures parts written to disk are always found. Fixes: https://tracker.ceph.com/issues/77597 Signed-off-by: Mark Kogan <[email protected]>
…ex bottleneck
Every S3 request calls get_user() at least twice, each of which acquires
a global std::mutex protecting SQLite prepared statements. Under high
concurrency (e.g. rgw_thread_pool_size=512), this single lock serializes
all request processing and causes a a higher lock contention compared to
for example 12 threads.
Add a mutex-protected user LRU cache in POSIXDriver that serves repeated
lookups from memory. The cache is populated on first DB hit and
invalidated on store_user/remove_user.
Benchmark (4K PUT, 100K objects, 256 buckets, hsbench 512 clients):
```
Before: 512 threads = 3,578 IO/s (avg lat 142ms)
12 threads = 6,068 IO/s (avg lat 84ms)
After: 512 threads = 19,299 IO/s (avg lat 26ms) 5.4x
12 threads = 9,962 IO/s (avg lat 51ms) 1.6x
```
Signed-off-by: Mark Kogan <[email protected]>
(cherry picked from commit 7935b35)
(cherry picked from commit 91167df)
Signed-off-by: Matt Benjamin <[email protected]>
Found and fixed by Kefu Chai <[email protected]>. Signed-off-by: Matt Benjamin <[email protected]>
…sc--fix-T77597 rgw/posix: fix use-after-free in read_obj_policy
…rowth The BucketCache uses a partitioned AVL tree (TreeX) with per-partition mutexes and an LRU that recycles evicted entries. Under concurrent LIST workloads, two problems caused deadlocks and unbounded cache growth: 1. ABBA deadlock in reclaim(): get_bucket() acquires locks in the order partition→entry_mtx, but reclaim() held entry_mtx while locking the victim's partition for cross-partition tree removal — the reverse order. Fix: mark the entry deleted under entry_mtx (short critical section), release entry_mtx, then do the cross-partition tree remove outside. The caller's partition lock is released and re-acquired around the victim's partition lock to avoid holding two partition locks simultaneously. 2. evict_block() checked only lane.q.back() per lane. If that single entry was mid-eviction by another thread (evicting flag set), the entire lane was skipped — even with dozens of reclaimable entries behind it. Fix: walk the lane queue from LRU toward MRU until a reclaimable entry is found. 3. evict_block() used a shared atomic counter (next_evict_lane()) for each iteration of the lane loop. Concurrent threads incrementing the counter could cause a thread to visit the same lane multiple times while skipping others entirely. Fix: call next_evict_lane() once for the starting lane, then increment locally to guarantee all lanes are visited. Also adds lock_for()/unlock_for() helpers to TreeX, debug-only LRU size accessors (get_size/get_q_size/get_active_size), and diagnostic logging in get_bucket() under #ifndef NDEBUG. Signed-off-by: Mark Kogan <[email protected]>
…rowth The BucketCache uses a partitioned AVL tree (TreeX) with per-partition mutexes and an LRU that recycles evicted entries. Under concurrent LIST workloads, two problems caused deadlocks and unbounded cache growth: 1. ABBA deadlock in reclaim(): get_bucket() acquires locks in the order partition→entry_mtx, but reclaim() held entry_mtx while locking the victim's partition for cross-partition tree removal — the reverse order. Fix: mark the entry deleted under entry_mtx (short critical section), release entry_mtx, then do the cross-partition tree remove outside. The caller's partition lock is released and re-acquired around the victim's partition lock to avoid holding two partition locks simultaneously. 2. evict_block() checked only lane.q.back() per lane. If that single entry was mid-eviction by another thread (evicting flag set), the entire lane was skipped — even with dozens of reclaimable entries behind it. Fix: walk the lane queue from LRU toward MRU until a reclaimable entry is found. 3. evict_block() used a shared atomic counter (next_evict_lane()) for each iteration of the lane loop. Concurrent threads incrementing the counter could cause a thread to visit the same lane multiple times while skipping others entirely. Fix: call next_evict_lane() once for the starting lane, then increment locally to guarantee all lanes are visited. Also adds lock_for()/unlock_for() helpers to TreeX, debug-only LRU size accessors (get_size/get_q_size/get_active_size), and diagnostic logging in get_bucket() under #ifndef NDEBUG. Signed-off-by: Mark Kogan <[email protected]>
evict_block() unconditionally recycled entries on every insert(), even when the LRU lane was well below its high-water mark. With the bucket listing cache, this caused a cascade: evicting a filled bucket entry forced a full directory re-scan (fill_cache) on the next LIST for that bucket — opening every object file to collect stat + xattrs. With 1000 objects per bucket, each unnecessary refill took 1-2 seconds, degrading LIST throughput by ~25%. Skip eviction when lane.q.size() <= lane_hiwat. After warmup, all buckets stay cached and LIST requests are served entirely from LMDB with no filesystem I/O. Also adds debug-level (21) logging for cache fill, reclaim, invalidate, and inotify overflow events. Running hsbench LIST workload of 100K objects spread across 160 buckets using 80 threads -- on a warm LMDB cache the list IO's increased from `IO/s: 169` to `IO/s: 478` ``` ❯ while sleep 1; do nice numactl -N 1 -m 1 -- env GOMAXPROCS=$(( $(numactl -N 0 -- nproc) / 2 )) ~/go/bin/hsbench -a b2345678901234567890 -s b234567890123456789012345678901234567890 -u http://127.0.0.1:8000 -z 4K -d -1 -t 80 -b 160 -n 100000 -m l -bp "b01b--" -op 'folder01/stage01_' ; done 2026/06/28 12:44:21 Loop: 0, Int: TOTAL, Dur(s): 6.6, Mode: LIST, Ops: 1120, MB/s: 0.00, IO/s: 169, Lat(ms): [ min: 6.4, avg: 401.1, 99%: 1917.6, max: 2003.8 ], Slowdowns: 0 ^^^^^^^^^ vvvvvvvvv 2026/06/28 12:53:37 Loop: 0, Int: TOTAL, Dur(s): 2.3, Mode: LIST, Ops: 1120, MB/s: 0.00, IO/s: 478, Lat(ms): [ min: 6.6, avg: 145.7, 99%: 738.2, max: 1217.8 ], Slowdowns: 0 Compared to Rados: 2026/06/25 07:28:46 Loop: 0, Int: TOTAL, Dur(s): 2.5, Mode: LIST, Ops: 1120, MB/s: 0.00, IO/s: 452, Lat(ms): [ min: 13.3, avg: 236.6, 99%: 462.5, max: 524.7 ], Slowdowns: 0 ``` Signed-off-by: Mark Kogan <[email protected]>
The inotify notify() handler was unlocking b->mtx before writing to LMDB, allowing stale inotify events from radosgw's own filesystem operations (e.g., delete + promote_version) to corrupt a freshly-filled cache. Hold b->mtx across all LMDB writes in notify() so that fill() and notify() are mutually exclusive on the same bucket. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
The BucketCache inotify watcher detects files created or removed by processes outside radosgw (sideloading). In single-process deployments every filesystem change made by radosgw itself generates a redundant inotify event, adding lock contention and wasted I/O. Add rgw_nsfs_inotify and rgw_posix_inotify config options (default false) and a NullNotify implementation that disables the watcher. rgw-vstart.sh gains --with-inotify for dev-cluster use. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
…rsion delete The three versioned delete paths in delete_obj() were calling invalidate_bucket(), which drops the entire LMDB listing cache and forces a full re-scan from disk on the next listing — O(n) per delete. Replace with targeted cache operations: - Delete current version + promote: under OFD version_lock, delete the current entry (via delete_object), stat the promoted file, and add_entry with FLAG_CURRENT. Double-check-under-lock pattern: stat before lock to resolve the path, re-stat under lock for fresh state. - Delete non-current version (.versions/): remove_entry for the specific (name, version_id) key. No lock needed — the unlinkat is atomic and no promotion occurs. - Create delete marker: under OFD version_lock, remove the old current entry, add a non-current entry for the demoted version, and add the delete marker entry with FLAG_DELETE_MARKER. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
copy_object() was destroying the existing destination version instead of demoting it to .versions/ — File::copy() unlinks the target before writing. Add the same demote-under-version_lock pattern used by NSFSAtomicWriter::complete(): CAS safe_link the current version into .versions/ with a non_current_timestamp, then publish the copy. Replace the trailing invalidate_bucket() with surgical cache updates: remove the old current entry, add the demoted non-current entry, and add the new current entry. Add test_object_copy_versioned_overwrite to verify old versions survive copy overwrites and are retrievable by versionId. Add a separate (currently gated on fails_on_nsfs) test tracking that copy_object should return x-amz-version-id in the response. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
Two general RGW bugs prevented CopyObject from returning the destination object's version ID: 1. rgw_rest_s3.cc: send_partial_response never emitted the x-amz-version-id header in the CopyObject response. 2. rgw_op.cc: RGWCopyObj::execute passed NULL for the version_id output pointer when the request had no source versionId, so copy_object() could never write back the new destination version. These affect all backends (rados, nsfs, posix), not just nsfs. Add test_object_copy_versioned_overwrite_response_version_id to verify the header is returned. Self-copy (metadata-replace to same key) version_id is a separate issue tracked for future work. TODO: validate against a rados vstart cluster. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
CopyObject to the same key in a versioned bucket (MetadataDirective=REPLACE) must create a new version per S3 spec. Previously nsfs skipped the copy and returned the same version_id. Add FSStrategy::clone_fd() to copy from an open source fd into a new file via O_TMPFILE + link_temp_file for atomic replacement. The self-copy path demotes the current version to .versions/ then atomically replaces the current entry with a fresh inode, producing a new version_id. Also fix copy_file_data: copy_file_range returning 0 caused an infinite loop when no more data could be copied. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
…T/MPU Three categories of fix, all in rgw_sal_nsfs.cc: 1. NSFSAtomicWriter (PUT) and NSFSMultipartUpload::complete (MPU): replace invalidate_bucket() with surgical remove_entry/add_entry for the demoted non-current version and the new current version. For the PUT path, move version_id xattr + set_instance + fill_cache into link_temp_file (with FLAG_LIST_VERSIONS and force stat) so a single call produces the correct versioned cache entry. The demoted entry is handled in AtomicWriter::complete after the demote block. 2. link_temp_file: use ent->stat(dpp, force=true) instead of stat(dpp) to avoid returning cached statx from before the link. Set the version_id xattr before fill_cache so is_null_version_fd() sees the real version_id rather than classifying all new files as null versions. 3. Index key escaping: all surgical cache updates (delete_obj, copy_object, AtomicWriter, MPU) now use get_index_key_name() instead of get_name() for cache entry keys. fill_cache encodes leading underscores (e.g. "_" → "__"), so remove_entry/add_entry must use the same encoding or they silently miss. This bug affected underscore-prefixed keys on the posix backend as well (BucketCache is shared); the posix driver should be checked for the same pattern. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Benjamin <[email protected]>
Every early return path in delete_directory() after fdopendir() leaked the DIR handle (and its underlying fd). The most frequent leak was the ENOTEMPTY return when trying to rmdir a non-empty parent directory, which is hit on every object delete that has sibling objects. Under sustained delete workloads this quickly exhausts the fd limit. Close the DIR handle (or raw fd on fdopendir failure) on every error return path. Fixes: https://tracker.ceph.com/issues/77692 Signed-off-by: Mark Kogan <[email protected]>
File::close() unconditionally called fsync() before closing the fd. During bucket listing cache population (fill_cache), every object file is opened read-only to collect metadata (stat + xattrs), then closed. The fsync on each close was unnecessary and extremely expensive — with 1000 objects per bucket, each fill() made 1000 fsync calls to XFS, turning a cache-miss LIST into a 1-2 second operation. Add a need_fsync flag to FSEnt, set only by mutating operations (create, write, write_attrs). File::close() skips fsync when the flag is clear. Signed-off-by: Mark Kogan <[email protected]>
LMDB exceptions escaped into Boost.Asio coroutines with no try/catch, calling std::terminate and crashing the process. Wrap all LMDB operations in fill(), list_bucket(), notify(), add_entry(), and remove_entry() with try/catch so failures return -EIO instead of aborting. get_dbi() had a DBI eviction hack that dropped another entry's LMDB database when MDB_DBS_FULL was hit, leaving the victim's BucketCacheEntry with a stale DBI handle and causing a deadlock when the eviction callback re-entered get_bucket() with the partition lock held. Remove the eviction — just return nullopt on MDB_DBS_FULL. Also: - list_bucket() silently returned 0 results when get_bucket() failed; return -EIO with a log message instead - Replace abort() calls on serialization errors with -EIO returns and log messages - Add try/catch around invalidate_bucket()'s mdb_drop and log failures - Remove invalidate_bucket() from POSIXMultipartUpload::list_parts() which was destroying the parts listing before reading it - Silence ENOENT from inotify_add_watch on multipart staging directories already removed by complete/abort (notify.h) Signed-off-by: Mark Kogan <[email protected]>
Each multipart upload shadow creates a unique BucketCache entry with its own LMDB named database. Since DBI handles are never dropped (by design — mdb_dbi_close is unsafe with concurrent readers), each upload permanently consumed a DBI slot, exhausting max_dbs under sustained multipart workloads. Root cause: POSIXBucket::rename() changes info.bucket.name to the target object name, so invalidate_bucket(shadow->get_name()) after rename looked up the wrong name and never found the cache entry. Fix by saving the shadow name before rename. Add a DBI recycling mechanism: invalidate_bucket() gains a recycle parameter (default false). When recycle=true, mdb_drop(dbi, 0) clears the data and recycle_dbi() moves the handle to a per-partition free pool. get_dbi() checks the free pool before calling openDB(), keeping the total DBI count bounded. Regular bucket invalidation (recycle=false) keeps the handle in dbi_map for stable reuse. Call invalidate_bucket(recycle=true) from complete() and abort() in both POSIX and NSFS multipart upload paths. Signed-off-by: Mark Kogan <[email protected]>
mattbenjamin
force-pushed
the
rgw-standalone
branch
from
July 22, 2026 16:29
993db65 to
35366d7
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
dang
force-pushed
the
rgw-standalone
branch
3 times, most recently
from
August 3, 2026 16:21
847bb41 to
db44a2c
Compare
dang
force-pushed
the
rgw-standalone
branch
from
September 28, 2026 18:50
a28765e to
912ea32
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.
Fixes multiple trackers....
Fixes: https://tracker.ceph.com/issues/77692
Fixes: https://tracker.ceph.com/issues/77597
other trackers???
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.