Bug 16291 - shadow_copy2: previous versions of nested directories fail with catia and disables the RESOLVE_NO_SYMLINKS fast path
Summary: shadow_copy2: previous versions of nested directories fail with catia and dis...
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Ralph Böhme
QA Contact: Samba QA Contact
URL:
Keywords:
: 16298 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-10-29 14:14 UTC by Ralph Böhme
Modified: 2026-11-07 03:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2026-10-29 14:14:16 UTC
There are two problems in this report. The second one turned up while debugging the first.

1. Previous versions of nested directories fail when catia comes before shadow_copy2

When catia is listed before shadow_copy2 in vfs objects, opening previous versions fails for paths that are a few directories deep. With the modules in the opposite order it works.

Example share:

[shadow]
    path = /srv/samba/test/snapshots-test
    vfs objects = catia shadow_copy2
    shadow:mountpoint = /srv/samba/test/snapshots-test
    shadow:snapdir = snapshots

with a snapshot at snapshots/@GMT-2026.10.28-15.15.30/ containing a/b/c/d/file.txt.

$ smbclient //server/shadow -c "allinfo a/b/c/d"
...
@GMT-2026.10.28-15.15.30
pathinfo(@GMT-2026.10.28-15.15.30\a\b\c\d) failed: NT_STATUS_OBJECT_PATH_NOT_FOUND

Paths with only one or two directory levels work.

Cause: for snapshot paths, in openat_pathref_fsp_nosymlink() smbd opens the path one directory at a time and reuses file handles. vfs_catia caches a translated name per file handle and doesn't notice that a reused handle now stands for a different directory. It then hands a stale directory name down to shadow_copy2, which builds the wrong snapshot path. The fix is to drop the VFS module state of a handle when it gets reused during the path walk.

2. shadow_copy2 disables the fast path lookup for the whole share

Just having shadow_copy2 in the VFS stack disables the fastpath lookup via openat2() with RESOLVE_NO_SYMLINKS for every path on the share, not only for snapshot paths. shadow_copy2 rejected the flag unconditionally, so smbd always tried the fast lookup first, failed, and fell back to opening the path one directory at a time. The fix lets non-snapshot opens pass straight through shadow_copy2, so only snapshot paths still take the slow route.

Have patches, need bugnumber.
Comment 1 Ralph Böhme 2026-11-05 14:18:22 UTC
*** Bug 16298 has been marked as a duplicate of this bug. ***
Comment 2 benjamin.klier 2026-11-05 14:25:38 UTC
We hit exactly this in production on 4.22.11 (Debian 13, 3-node CTDB
cluster, CephFS kernel mount, vfs objects = catia fruit streams_xattr
acl_xattr shadow_copy2): "Previous Versions" fails for anything below
three directory levels. Standalone reproducer and level 10 log are
attached to bug 16298.

We worked around it by removing catia (no catia:mappings in use). We'd
appreciate a backport to 4.22 and 4.23 and are happy to test the
patches from MR 4786 against 4.22 with our reproducer.
Comment 3 Samba QA Contact 2026-11-07 03:50:04 UTC
This bug was referenced in samba master:

e09de2cbdbba357cc281e16b08585cc74b38c421
885ed5544347adbd569a470b9df13ef041578e23
1e9c1cd2bd613e0784d59148f4742bf4307ba72d