smbstatus does not reliably detect that a samba connection is in use.

Bug #886953 reported by Bob Harvey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
samba
Invalid
Medium
samba (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

I have a file server, built to be solar powered. It is powered up by a WOL magic packet, and a little daemon I have written starts to count down. When it gets to zero it suspends. Every second the daemon monitors for valid activity and restarts the countdown if the server is in use. The indications of valid activity are : 'who' count > 0, number of rysnc running >0, and number of active samba connections open >0.

Details
---------
It is the samba connection that is causing me trouble. The test is actually `smbstatus | grep \: -c`. It ignores the various header lines in the default smbstatus output, and counts those with a time delimiter as active connections.

This works fine with a Windows client, and used to work fine with an Ubunutu client, but that second case is no longer true. I have two text files which tell the story: with a windows client closing the windows file explorer closes the last connection. In Ubuntu, closing the Natuilus file explorer leaves the last connection running. If go to look at /proc/<process no>/net/tcp it is not changing. So there is no traffic, but the connection is still open.

If I kill either the process listed in smbstatus at the server end, or the one listed as gvfsd-smb at the client end, then it all settles down and no harm is done: the countdown resumes because of my smbstatus | grep test, and if I try to open a new connection it opens normally.

I cannot differentiate when samba is in use or idle when the client is Ubuntu, only when it is Windows.

Question
-------------
So that is my question:
How, at the server end, do I reliably detect that a samba connection is in use?

Supplementary
------------------
Out of curiosity:
Why does samba lock directories when opened in a client windows file navigator, but not an ubuntu one?
Why does samba not lock a text file when opened with a text editor from either type of client?

========================================
I cannot attach files, so I will add them as subsequent comments
=======================================

Revision history for this message
Bob Harvey (bobharvey) wrote :
Revision history for this message
Bob Harvey (bobharvey) wrote :
Revision history for this message
Dave Walker (davewalker) wrote :

Thanks for the bug report, the latest upstream comment suggests setting the "deadtime" parameter. Please can you confirm this has been tried.

Thanks.

Changed in samba (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Bob Harvey (bobharvey) wrote :

Copied from my reply upstream:
------------------------------------------------------------
OK, installed that. It does force a disconnect.

The first time I try to reconnect I get an error "Unable to read", presumably
the client doesn't know its friend has died. The second time I connect OK.

Not been able to try that with a windows client, but it does resolve the
problem with the ubuntu client.

Revision history for this message
Bob Harvey (bobharvey) wrote :

Now tested with XP and Suse Linux.
The suggested modification does what I require, although I do get spurious error messages in Linux after a forced disconnect, but they can safely be ignored.

Changed in samba (Ubuntu):
status: Incomplete → Invalid
Changed in samba:
importance: Unknown → Medium
status: Unknown → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.