Bug 16176 - vfs_ceph_snapshots: smbd panics on snapshot access for a share mounted at the CephFS root ("/")
Summary: vfs_ceph_snapshots: smbd panics on snapshot access for a share mounted at the...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.24.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-07-10 06:01 UTC by matthias.grandl@croit.io
Modified: 2026-08-13 14:31 UTC (History)
2 users (show)

See Also:


Attachments
patch from master for v4-24-test (2.95 KB, patch)
2026-07-27 09:20 UTC, Anoop C S
ddiss: review+
Details
patch from master for v4-23-test (2.95 KB, patch)
2026-07-27 09:20 UTC, Anoop C S
ddiss: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matthias.grandl@croit.io 2026-07-10 06:01:55 UTC
smbd hits an assertion and disconnects the client when a snapshot (Previous
Version) is accessed on a share whose "path = /" (mounted at the CephFS file
system root).

ceph_snap_gmt_convert_dir() builds the absolute .snap directory path by joining
the share's connectpath, the request-relative name and the snapshot subdir with
'/' separators. When the connectpath is a bare "/" (root-mounted share), or the
request-relative name is itself absolute / contains '/' runs (e.g. when
accessing a file inside a snapshot), the join produces a path with a run of
consecutive '/', e.g. "//foo/.snap".

This path is handed to OpenDir() -> fd_openat() -> filename_convert_dirfsp_rel(),
which splits on '/', and openat_pathref_fsp_nosymlink() asserts that no
component is empty:

    SMB_ASSERT(rel_fname.base_name[0] != '\0')   source3/smbd/files.c:1212

The empty component from the '//' run trips the assert and panics smbd.

Whether the malformed path reaches the assert also depends on the Ceph client
accepting the non-canonical "//" path in the preceding stat(), so
reproducibility is libcephfs-version dependent (reproduced with Ceph v20.2.1 /
libcephfs).

Reproducer
----------

smb.conf:

    [share]
        path = /
        vfs objects = ceph_snapshots ceph_new
        ceph_new:config_file = /etc/ceph/ceph.conf
        ceph_new:user_id = admin
        read only = no

Create a snapshot from a kernel mount at the CephFS root:

    touch testfile
    mkdir .snap/testsnapshot

Then via smbclient, enumerating previous versions of the file (or
"allinfo testfile") disconnects with NT_STATUS_CONNECTION_DISCONNECTED, and the
smbd log shows the SMB_ASSERT panic. With "log level = 10" the malformed path is
visible, e.g.:

    ceph_snap_gmt_convert_dir: enumerating shadow copy dir at //foo/.snap

The same happens for files within a subdirectory of a snapshot.
Comment 1 Samba QA Contact 2026-07-21 16:13:03 UTC
This bug was referenced in samba master:

abb48aacbd994877006bf9156e633d3cf29a34bc
Comment 2 Anoop C S 2026-07-27 09:20:23 UTC
Created attachment 19134 [details]
patch from master for v4-24-test
Comment 3 Anoop C S 2026-07-27 09:20:50 UTC
Created attachment 19135 [details]
patch from master for v4-23-test
Comment 4 Anoop C S 2026-07-30 05:55:56 UTC
Re-assigning for inclusion in both 4.24 ad 4.23
Comment 5 Samba QA Contact 2026-07-30 23:12:19 UTC
This bug was referenced in samba v4-23-test:

1c1fe53f2fbe60292df6a33320a4ecb867ca5bb5
Comment 6 Samba QA Contact 2026-08-03 19:36:26 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.11):

1c1fe53f2fbe60292df6a33320a4ecb867ca5bb5
Comment 7 Samba QA Contact 2026-08-11 19:20:44 UTC
This bug was referenced in samba v4-24-test:

a2e0beedf76f6541e12c29788ab4bcdfc5004fed
Comment 8 Samba QA Contact 2026-08-13 14:31:40 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.6):

a2e0beedf76f6541e12c29788ab4bcdfc5004fed