Public bug reported:

[ Impact ]

On Ubuntu 26.04 LTS (samba 2:4.23.6+dfsg-1ubuntu2.2, OpenZFS 2.4.1 from the
Ubuntu archive), SMB clients that browse a ZFS dataset's snapshot directory
(<share>\.zfs\snapshot\<snapshot>) see an empty folder (occasionally
"The parameter is incorrect") unless the snapshot was already mounted by
something else.

smbd opens path components with O_PATH, which does not trigger the ZFS
snapshot automount (ZFS snapshots are automounted under .zfs/snapshot on
lookup). The client is served the empty mountpoint stub. Once the snapshot
has been mounted by any local access (e.g. `ls` as root), the same SMB
request returns the correct contents, until zfs_expire_snapshot unmounts it
again.

This breaks self-service file recovery from ZFS snapshots on Ubuntu-based
NAS servers, a common deployment.

Upstream: https://bugzilla.samba.org/show_bug.cgi?id=15991 (RESOLVED FIXED)
Fix: master commit 45b6cd3852949e74ea4a26e5d5e9c0eee97c3b27, released in
samba 4.24.2 (v4-24-stable commit a820412c178db475284f73b806406fcbe2ebca14),
which adds the "automount fs types" parameter (ZFS: 0x2fc12fc1). It depends
on the automount handling added for 
https://bugzilla.samba.org/show_bug.cgi?id=15805
(first released in 4.24).

The fix is already in Ubuntu 26.10 and the development release
(samba 2:4.24.7+dfsg-1ubuntu1). This request is to fix it in 26.04 LTS.

[ Test Plan ]

1. On 26.04 with zfsutils-linux and samba installed, create a dataset with
   snapdir=visible, share it via smb.conf, write some files, and take a
   snapshot: zfs snapshot pool/ds@test1
2. Make sure the snapshot is not mounted: mount | grep '@test1' (no output)
3. From a Windows client: dir \\server\share\.zfs\snapshot\test1
   Actual (bug): empty listing; `mount` on the server still shows test1
   not mounted.
4. Control: on the server run `ls /pool/ds/.zfs/snapshot/test1`, then repeat
   step 3 within 5 minutes: the files are listed.
5. With the fixed package (and "automount fs types = 0x2fc12fc1" in [global],
   if the backport keeps that parameter), repeat steps 2-3 with a fresh,
   unmounted snapshot: the files must be listed on the first access, and
   the snapshot must show as mounted on the server.
6. Regression check: normal share access, ACLs (vfs_acl_xattr), and
   Previous Versions (vfs_shadow_copy2) continue to work.

[ Where problems could occur ]

The change touches smbd's file open path (source3/smbd/open.c), specifically
how a pathref fd is reopened when it lands on an automount mountpoint.
Regressions could appear as failures opening files or directories on
filesystems that are mountpoints or automount points (autofs, ZFS snapshots),
or as opens that cross mount boundaries unexpectedly. Opens on ordinary
filesystems are not affected.

[ Other Info ]

- Affected: Ubuntu 26.04 LTS (resolute), samba 2:4.23.6+dfsg-1ubuntu2.2,
  zfsutils-linux 2.4.1, linux-azure 7.0.
- Not affected: 26.10 and the development release (samba 4.24.7).
- Workaround: none in smb.conf on 4.23 ("automount fs types" does not exist
  before 4.24.2). Partial mitigation: Windows "Previous Versions" via
  vfs_shadow_copy2 (under test).
- If a minimal SRU patch is not feasible because of the dependency on the
  bug 15805 changes, a backport of samba 4.24.x to resolute-backports would
  also help.

** Affects: samba (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2178226

Title:
  [SRU] samba 4.23 does not trigger ZFS snapshot automount:
  .zfs/snapshot/<snap> appears empty over SMB (upstream bug 15991)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2178226/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to