Bug 270951 - net/samba416 stopped working in jails
Summary: net/samba416 stopped working in jails
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: FreeBSD Samba Team (mail alias)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-20 13:52 UTC by Meyser+bugs.freebsd.org
Modified: 2024-09-09 18:12 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (timur)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Meyser+bugs.freebsd.org 2023-04-20 13:52:01 UTC
After updating FreeBSD System samba stopped to function properly.

I can access shares an printer.

I can READ everything on shares.

If I try to WRITE somthing to a schare the samba server just hangs 
for several minutes. 

System that works:
----------------------------------------------------------------------------------------------------
FreeBSD 13.2-STABLE stable/13-n254929-6ebf11e77cf5

ca_root_nss-3.88.1             Root certificate bundle from the Mozilla Project
curl-7.87.0_1                  Command line tool and library for transferring data with URLs
expat-2.5.0                    XML 1.0 parser written in C
gettext-runtime-0.21.1         GNU gettext runtime libraries and programs
glib-2.74.6,2                  Some useful routines of C programming (current stable version)
gmp-6.2.1                      Free library for arbitrary precision arithmetic
gnutls-3.7.9                   GNU Transport Layer Security library
icu-72.1,1                     International Components for Unicode (from IBM)
indexinfo-0.3.1                Utility to regenerate the GNU info page index
jansson-2.14                   C library for encoding, decoding, and manipulating JSON data
libarchive-3.6.2,1             Library to create and read several streaming archive formats
libffi-3.4.4                   Foreign Function Interface
libgcrypt-1.9.4_1              General purpose cryptographic library based on the code from GnuPG
libgpg-error-1.46              Common error values for all GnuPG components
libiconv-1.17                  Character set conversion library
libidn2-2.3.4                  Implementation of IDNA2008 internationalized domain names
libinotify-20211018            Kevent based inotify compatible library
liblz4-1.9.4,1                 LZ4 compression library, lossless and very fast
libnghttp2-1.51.0_1            HTTP/2.0 C Library
libpsl-0.21.2_2                C library to handle the Public Suffix List
libssh2-1.10.0_1,3             Library implementing the SSH2 protocol
libsunacl-1.0.1                Wrapper providing SunOS NFSv4 ACL API
libtasn1-4.19.0                ASN.1 structure parser library
libunistring-1.1               Unicode string library
libunwind-20211201_1           Generic stack unwinding library
libxml2-2.10.3_1               XML parser library for GNOME
mpdecimal-2.5.1                C/C++ arbitrary precision decimal floating point libraries
nettle-3.8.1                   Low-level cryptographic library
p11-kit-0.24.1_2               Library for loading and enumerating of PKCS#11 modules
pcre2-10.42                    Perl Compatible Regular Expressions library, version 2
pkg-1.19.1_1                   Package manager
popt-1.19                      Getopt(3) like library with a number of enhancements, from Redhat
py39-wsdd-0.7.0                Web Service Discovery (WSD) host daemon for Samba
python39-3.9.16_2              Interpreted object-oriented programming language
readline-8.2.0                 Library for editing command lines as they are typed
samba416-4.16.8                Free SMB/CIFS and AD/DC server and client for Unix
talloc-2.3.4                   Hierarchical pool based memory allocator
tdb-1.4.7,1                    Trivial Database
tevent-0.13.0_1                Talloc based event loop library
zstd-1.5.2_1                   Fast real-time compression algorithm
----------------------------------------------------------------------------------------------------

System that does not work:
----------------------------------------------------------------------------------------------------
FreeBSD 13.2-STABLE stable/13-n255137-f0cb73450966

ca_root_nss-3.89               Root certificate bundle from the Mozilla Project
curl-8.0.1                     Command line tool and library for transferring data with URLs
expat-2.5.0                    XML 1.0 parser written in C
gettext-runtime-0.21.1         GNU gettext runtime libraries and programs
glib-2.76.1,2                  Some useful routines of C programming (current stable version)
gmp-6.2.1                      Free library for arbitrary precision arithmetic
gnutls-3.7.9                   GNU Transport Layer Security library
icu-73.1,1                     International Components for Unicode (from IBM)
indexinfo-0.3.1                Utility to regenerate the GNU info page index
jansson-2.14                   C library for encoding, decoding, and manipulating JSON data
libarchive-3.6.2,1             Library to create and read several streaming archive formats
libffi-3.4.4                   Foreign Function Interface
libgcrypt-1.9.4_1              General purpose cryptographic library based on the code from GnuPG
libgpg-error-1.47              Common error values for all GnuPG components
libiconv-1.17                  Character set conversion library
libidn2-2.3.4                  Implementation of IDNA2008 internationalized domain names
libinotify-20211018            Kevent based inotify compatible library
liblz4-1.9.4,1                 LZ4 compression library, lossless and very fast
libnghttp2-1.52.0              HTTP/2.0 C Library
libpsl-0.21.2_3                C library to handle the Public Suffix List
libssh2-1.10.0_1,3             Library implementing the SSH2 protocol
libsunacl-1.0.1                Wrapper providing SunOS NFSv4 ACL API
libtasn1-4.19.0                ASN.1 structure parser library
libunistring-1.1               Unicode string library
libunwind-20211201_2           Generic stack unwinding library
libxml2-2.10.3_2               XML parser library for GNOME
mpdecimal-2.5.1                C/C++ arbitrary precision decimal floating point libraries
nettle-3.8.1                   Low-level cryptographic library
p11-kit-0.24.1_2               Library for loading and enumerating of PKCS#11 modules
pcre2-10.42                    Perl Compatible Regular Expressions library, version 2
pkg-1.19.1_1                   Package manager
popt-1.19                      Getopt(3) like library with a number of enhancements, from Redhat
py39-wsdd-0.7.0                Web Service Discovery (WSD) host daemon for Samba
python39-3.9.16_2              Interpreted object-oriented programming language
readline-8.2.1                 Library for editing command lines as they are typed
samba416-4.16.10_1             Free SMB/CIFS and AD/DC server and client for Unix
talloc-2.3.4                   Hierarchical pool based memory allocator
tdb-1.4.7,1                    Trivial Database
tevent-0.13.0_1                Talloc based event loop library
zstd-1.5.4_2                   Fast real-time compression algorithm
----------------------------------------------------------------------------------------------------

Changing only Samba back to Version 4.16.8 does NOT fix the issue.

Using samba 4.17 (patch from bugreports) does NOT fix the issue.

All samba ports are build with:
----------------------------------------------------------------------------------------------------
OPTIONS_SET+=MANDOC
OPTIONS_SET+=ZEROCONF_NONE
OPTIONS_UNSET+=ADS
OPTIONS_UNSET+=AD_DC
OPTIONS_UNSET+=DOCS
OPTIONS_UNSET+=FAM
OPTIONS_UNSET+=LDAP
OPTIONS_UNSET+=PROFILE
OPTIONS_UNSET+=PYTHON3
OPTIONS_UNSET+=FRUIT
OPTIONS_UNSET+=AVAHI
----------------------------------------------------------------------------------------------------

samba is installed in Jail

any suggestions / hints?



Nothing special shows up in samba logs.
Comment 1 Meyser+bugs.freebsd.org 2023-04-20 16:14:19 UTC
I kicked out all self build packages and did install form FreeBSD pkg repo.

pkg install wsdd
pkg install py39-wsdd

still no fun same problem.

Perhaps something in base system got hosed.

P.S: sendfile usage ist disabled.
Comment 2 Meyser+bugs.freebsd.org 2023-04-21 10:57:57 UTC
switched basesystem back to 

FreeBSD 13.2-STABLE stable/13-n254929-6ebf11e77cf5

problem persists.
Comment 3 Meyser+bugs.freebsd.org 2023-04-21 20:17:22 UTC
updated src (de53ebb0f20e) / doc / ports

installed new world/kernel on host / samba jail.

updated all packages.

Problem persists!

Network dump reveals:

writes are working but extremly slow! about 250B/s. 

for fun I set up ftpd inside the jail.

result:

transfer jail to outside 1G data no Problem
transfer outside to jail timeout during transfer.

seems to be a problem in base system ( bridge / epair ... )
Comment 4 Alexander Leidinger freebsd_committer freebsd_triage 2024-01-30 12:00:43 UTC
I tried with samba shares physically on zfs, which are nullfs mounted into a jail which runs samba and exports to Windows 11 and Windows 10. I can see the directory contents, but when I try to access a file (e.g. text file), Windows tells me it can not access the file. The samba log contains in the log log.<windows_host_name> the lines
---snip---
[2024/01/01 16:01:16.059649,  0] ../../source3/modules/vfs_zfsacl.c:363(fget_zfsacl)
 fget_zfsacl: fdescfs filesystem must be mounted with 'nodup' option
---snip---

Inside this jail I have this:
---snip---
# mount -v | grep fdesc
fdescfs on /dev/fd (fdescfs, vnodes: count 5 )
fdescfs on /var/run/samba4/fd (fdescfs, vnodes: count 2 )
---snip---

The second fdescfs (in the samba pid dir) is mounted from the jail-host with the options rw,noatime,nodup.

Changing files/0099-s3-modules-zfsacl-fix-get-set-ACL-on-FreeBSD-13.patch to comment out (=workaround) this (2 times) makes it work:
---snip---
+/*             if (!fsp->fsp_flags.have_proc_fds) {
+                       DBG_ERR("fdescfs filesystem must be mounted with 'nodup' "
+                               "option \n");
+                       errno = EBADF;
+                       return -1;
+               }*/
---snip---

So the check for have_proc_fds for jails is not correct.
Comment 5 Meyser+bugs.freebsd.org 2024-02-06 13:48:20 UTC
fdesc ist mountest the "right way".

as I said the same problem with ftpd inside jail.

This problem ist bridge(host) an epair (jail) related.

If ipfw ist loaded on host an inside
jail both in "OPEN" mode the problem rises.

to fix one have to set "net.link.bridge.ipfw=1" on host.
Comment 6 crest 2024-07-03 11:01:02 UTC
Mount fdescfs in the jail's /dev/fd with the nodup flag. The new VFS in Samba 4.16+ (!= kernel VFS) requires a /dev/fd mounted with that flag to use with path descriptors so certain operations the SMB protocol exposes on paths can be implemented in a safe, race-free way.
Comment 7 crest 2024-07-03 11:03:30 UTC
An fstab line would look like this:

    fdescfs /jails/smb/dev/fd fdescfs rw,nodup 0 0
Comment 8 Meyser+bugs.freebsd.org 2024-07-16 11:17:10 UTC
after updating host to 14.1 fix "net.link.bridge.ipfw=1"
does not solve this anymore.

it took ours of traking this down to then "igc" network card.

igc0@pci0:4:0:0:        class=0x020000 rev=0x01 hdr=0x00 vendor=0x8086 device=0x15f3 subvendor=0x8086 subdevice=0x0000
    vendor     = 'Intel Corporation'
    device     = 'Ethernet Controller I225-V'
    class      = network
    subclass   = ethernet


When i switch jail from vnet to normal jail everything works fine.

when i use another network card "re" everything works fine.
with vnet jail.

I think the problem is "igc" in combination with bridge/epair connected Jail.

my obscure NOT working setup is

igc0 -> v310 (VLAN 310) -> bridg0 -> epairxa -> epaixb (inside jail)
Comment 9 crest 2024-07-16 12:48:07 UTC
Please share the output of ifconfig igc0 and ifconfig bridge0. I suspect your problem is caused by LRO/TSO **not** being disabled on the physical member interface.
Comment 10 Meyser+bugs.freebsd.org 2024-07-16 12:55:12 UTC
Yes its NOT disabled.

igc0: flags=1008943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=4e427bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,MEXTPG>
        ether 1c:fd:08:74:ac:3e
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

v310Hbridge: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        description: lan-xenet-de
        options=0
        ether 58:9c:fc:10:a5:74
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: v310Bsamba flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 11 priority 128 path cost 2000
        member: v310Burbackup flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 7 priority 128 path cost 2000
        member: v310 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 20000
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>
Comment 11 crest 2024-07-16 13:08:08 UTC
Run this command and test it solve the performance problem:

    ifconfig igc0 -tso -vlanhwtso -lro
Comment 12 Meyser+bugs.freebsd.org 2024-07-16 13:40:38 UTC
new

igc0: flags=1008943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=4e020bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,MEXTPG>
        ether 1c:fd:08:74:ac:3e
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

now it works.

is this a bug of igc?
Comment 13 crest 2024-08-13 18:11:30 UTC
It's not specific to any single NIC driver. It's a limitation of if_bridge(4).