FS#53639 - [linux] cifs client floods Samba server if smbd restarted while client has share mounted

Attached to Project: Arch Linux
Opened by Jonathan Liu (net147) - Tuesday, 11 April 2017, 14:54 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 02 May 2017, 13:43 GMT
Task Type Bug Report
Category Kernel
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:
If a share on a Samba server is mounted using CIFS client (e.g. mount -t cifs -o guest //server/share /mnt/share) and then Samba server is restarted, then Samba server shows high CPU usage. Running "netstat -net | grep :445" on the Samba server shows a flood of connections. This can cause the Samba server to become slow or unresponsive.

Additional info:
* samba 4.5.8-1
* linux 4.10.8-1
* linux-lts 4.9.21-1
* linux-zen 4.10.8-1
* https://bugzilla.kernel.org/show_bug.cgi?id=194531

Steps to reproduce:
* Make sure smbd is not currently running:
# systemctl stop smbd
* Start a terminal window and run the following to start Samba server:
# mkdir -p /tmp/share
# cat > smb-test.conf << EOF
[share]
guest ok = yes
path = /tmp/share
EOF
# smbd -FS -s smb-test.conf

* Start another terminal window and run the following to mount the share:
# mkdir -p /tmp/share-mount
# mount -t cifs -o guest //localhost/share /tmp/share-mount
* Switch back to terminal that is running the server, restart the server:
Ctrl-C to stop server
# smbd -FS -s smb-test.conf

* Switch back to terminal window used to mount share
Wait 5 seconds
Run top command and notice high CPU usage for smbd. Press q to exit.
# top
Run netstat command repeatedly and notice there is an unusually large number of connection states to port :445 that is increasing rapidly
# netstat -net | grep :445 | wc -l
12236

Reverting commit b8c600120fc87d53642476f48c8055b38d6e14c7 for the kernel used on the client resolves the issue.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Tuesday, 02 May 2017, 13:43 GMT
Reason for closing:  Fixed
Comment by Jonathan Liu (net147) - Tuesday, 11 April 2017, 14:55 GMT
The problematic commit is included in Linux 4.9-rc8 and later.
Comment by Jonathan Liu (net147) - Sunday, 16 April 2017, 23:03 GMT Comment by Jonathan Liu (net147) - Thursday, 27 April 2017, 11:02 GMT
Fixed in Linux 4.9.25 and Linux 4.10.13.

Loading...