[Samba] A disconnected network can, for all practical purposes, hang your system.

Jaideep Shankar jaideep.shankar at tallysolutions.com
Thu Apr 7 08:17:04 UTC 2022


Record locks taken on a remote file remains valid, even after 1 hour of network disconnection. The following test case describes the set of activities done in chronological order:

  *   A process (P1) on a windows client (C1) and another process (P2) on a Linux client (C2) are connected to a common Linux server and accessing the same remote file.
  *   Both P1 and P2 opens the remote file and gets a handle each.
  *   P1 takes exclusive lock on offset 0.
  *   P2 tries to take exclusive lock on offset 0 in a loop but does not get since P1 holds an exclusive lock on the same offset.
  *   Now, P1 is disconnected from remote file (C1 is disconnected from server).

Result: P2 does not get lock, returns 'EACCES' instantaneously, tried for around an hour.

The results were surprising, since in a Wi-Fi environment, where systems keep coming in and out, it can potentially stall the system.

OS specs of C1                                   - Windows 10 Enterprise (version: 20H2, build: 19042.1237)
OS specs of C2                                   - Ubuntu 20.04.3 LTS (GNU/Linux 5.13.0-1021-azure x86_64)
OS specs of Linux Server                - Ubuntu 20.04.1 LTS (GNU/Linux 5.13.0-37-generic x86_64)

Samba version on C2                      - 4.13.17-Ubuntu                                            Command used - smbststus
Samba version on Linux server   - 4.13.17-Ubuntu                                              Command used - smbstatus
Samba version on C1                      - SMBv2/v3                                                      Command used - sc.exe qc lanmanworkstation<https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fstorage%2Ffile-server%2Ftroubleshoot%2Fdetect-enable-and-disable-smbv1-v2-v3%23how-to-detect-status-enable-and-disable-smb-protocols-on-the-smb-server&data=04%7C01%7Cjaideep.shankar%40tallysolutions.com%7Cd89e6d87df344ff9528008da16e285f6%7C66bcd9b727254893bb969ae424774af6%7C0%7C0%7C637847459425410980%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qEmZj%2Fc1RtYLDut%2BDu%2B6SgmbKnJeNVrftx2xhJO7%2F4s%3D&reserved=0>
Protocol version                               - 3.1.1 (same on both connections)           Command used - smbstatus

The smb config file on the Linux server is also attached.


More information about the samba mailing list