Liam
2010-Dec-16 23:20 UTC
[Samba] Running a sleepy server (was: smbd on a battery-powereddevice)
On Thu, Dec 16, 2010 at 2:43 PM, <tms3 at tms3.com> wrote:> > On Thursday 16/12/2010 at 2:33 pm, Liam wrote: > > On Thu, Dec 16, 2010 at 1:52 PM, <tms3 at tms3.com> wrote: > >> On Thursday 16/12/2010 at 1:36 pm, Liam wrote: >> >> ... >> >> And when an smb connection is active but the client is idle, does the >> client >> expect anything from the server? >> >> ... >> >> That said, depending on the file type and what's oplocked etc...often >> restarting smbd does little harm...often...but it depends on the type of >> files shared. So perhaps you could pull information from smbstatus, and >> restart smbd then sleep the server and wait for the client to decided to do >> something...again though could be quite messy, just depends on what your use >> is. >> > > I don't actually need to *restart* samba, just sleep the device it's > running on. All its state would persist until the next incoming message > wakes it. But a sleepy server obviously won't send anything to the client, > so I want to make sure that's not an issue. > > I guess that's my point. See, those things like oplocks are open, then > smbd is going to want to maintain the connection. So you either kill the > child process that's got the connection/oplock or restart smbd. Now, the > tdb files holding the oplocks will be there, and if samba plays nice with > the server sleeping, the oplock or other file handle would be there...but > now you got a snag if the client shutsdown...now you need to clean up broken > uplocks....IMVERYHO it seems you'd need someway to make sure the sessions > are clean before sleeping on both sides...Just some thinking out loud...like > I said, you need to look at what your user/client environment is going to be > like. >But what does "maintain the connection" mean? If it means sending messages to the client that aren't responses to client requests, that's an issue. But client shutdown during server sleep should generate a message that wakes the server. On the other hand, there's the issue of the server "wandering off" in this case. But samba should get ECONNRESET or EPIPE on wake-up if the client is really gone. And won't it clean up locks in that case? PS: Please send to the mailing list, not me directly.