Bug 15578 - samba doesn't work with autofs in ghost mode
Summary: samba doesn't work with autofs in ghost mode
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.17.12
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
: 15679 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-02-09 11:09 UTC by Bartek Chanda
Modified: 2024-07-10 12:32 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 Bartek Chanda 2024-02-09 11:09:41 UTC
After upgrading Debian from version 11 to 12, we have observed incorrect behavior of our mechanism for sharing logs from filesystems mounted using autofs through Samba.

The autofs configuration appears as follows:

File /etc/auto.master:
/mnt/linbkp1 /etc/autofs.linbkp1 --timeout=60,--ghost

File /etc/autofs.linbkp1:
dd     -fstype=nfs,ro, linbkp1:/mnt/dd

Autofs itself works well - when the resource is not mounted, accessing the directory from shell triggers its mounting.

The /mnt directory is shared in Samba in the standard way:

[mnt]
   path = /mnt
   browseable = yes
   read only = yes
   force user = root
   guest ok = no

When access to the directory is initiated from a Linux system and the resource is still mounted, the shared directory works correctly.

However, if the resource expires and is unmounted from the filesystem, Samba version 4.17.12 fails to access the resource.

Attempting to list the resource results in an error:

smb: \linbkp1\dd\> ls
NT_STATUS_OBJECT_NAME_NOT_FOUND listing \linbkp1\dd\*

In Debian 11, where Samba 4.13.13 was used, a similar operation would mount the resource, and if not on the first attempt, then subsequent attempts to list the contents of the directory would display them correctly. This mechanism also worked in older versions of Samba (from Debian 9 and Debian 10).

I also tested Samba in debian-backports (samba 4.19.4) and debian-experimental (samba 4.20.0~rc1), as well as with Red Hat 9 (Samba 4.18.6), and the error still persists.
Comment 1 Volker Lendecke 2024-07-09 09:35:43 UTC
Not that it helps you directly, but I believe 

https://gitlab.com/samba-team/samba/-/commit/ac7a16f9cc4bd97ef546d1b7b02605991000d0f9

should fix your problem
Comment 2 Björn Jacke 2024-07-09 10:21:40 UTC
*** Bug 15679 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Reichelt 2024-07-10 12:32:30 UTC
Thanks Volker!

I applied ac7a16f9 on top of Debian/sid's 4.20.2+dfsg-6 and can confirm that this solves the problem for me.