[OmniOS-discuss] CIFS File Lock Problems

Aaron Curry asc1111 at gmail.com
Tue Mar 3 23:44:52 UTC 2015


Hi all,

We have encountered an issue with out OmniOS CIFS file server and file
locks. Every now and then we get a call from a user trying to access a file
but they can't because it says that the file is in use by another user.
Long story short, we track down the session holding the lock, kill the
session, file locks are released and the user can access the file. Left at
that, it sounds pretty normal for a file server. But, it's not as simple as
it sounds.

Problem #1: Frequency

This happens much more often than I am used to with other file servers. Not
only that, but the frequency of "file locked" incidences seems to slowly
increase over time until we are inundated with requested to unlock files.
At that point we reboot the server and everyone is happy... at least for a
week or so.

Problem #2: Stale sessions

It seems that the problem is caused by sessions becoming disconnected from
the client and the server is not cleaning up those orphaned sessions. We
can tell this because once we track down the session holding the lock,
shutting down the desktop/laptop/whatever that initiated the session does
not clean it up. The session stays open on the server. If you bring the
client device back up, instead of reconnecting to the existing session it
creates a new one. Often times the session holding locks is owned by the
same user who is unable to access the file.

When we first encountered this problem I changed the keep_alive setting on
the smb server from the default of 5400 to 300. This seemed to help. At
first I told people to wait 5 minutes and then the session cleared and they
were able to access their files, but it doesn't seem to be working any
more. Or at least changing keep_alive only fixed one problem and either
didn't resolve another or maybe caused another problem?

Problem #3: Tracking down open files

Most NAS devices I have worked with have you manage session and open files
through the Windows Computer Management console. You use that to connect to
the NAS device and can see all session and open files. Through that console
you can also kill sessions or the locks on specific files. It doesn't work
very well in this case. Windows 7 takes forever to try to load the session
information and seems to try to refresh while its still loading. The result
is that it is unusable. XP/2003 loads session information just fine but if
there's more than just a few sessions the open files list is empty. I even
ran a packet capture on the client to see if it just didn't understand what
the server was saying. Not the case. If there's more than 5 or so sessions,
the request for open files returns an empty array of items.

We have been using mdb to track down the open files, which is a pain.
Getting a list of sessions from mdb is easy enough with ::smblist but open
files are only returned as an address which then needs to be checked
against ::smbnode to get the path and file name. I wrote a script to parse
all the information and return something usable, but I'm not much of a
programmer. It takes about 15 minutes to run and having to run it every
time someone calls about a file lock is a waste of time.

Problem #4: Releasing file locks

Similar to problem #3. Normally we would connect to the NAS device with
Windows Computer Management console, go to Open Files, find the file,
right-click and Close Open File. Since we can't get a list of open files in
the Computer Management console, that obviously doesn't work. That's where
we've been tracking down the session holding the lock, pulling up the
sessions in Computer Manager on a Windows 2003 machine and killing the
session. This is going to become a very big problem in the near future as
we retire all our XP/2003 systems.

So those are the problems we are facing with our OmniOS CIFS server. If you
are still reading this, thank you for your patience. We're at a loss on
where to go from here. Understandably, the end users (and management) are
starting to get a little grouchy. The questions we are having trouble
answering are:

Why do sessions seem to get disconnect and hold locks open?
When a user / client machine combo reconnects, why doesn't it reuse an
existing session and assume responsibility for open files?
Why does the problem seem to grow in frequency over time (sounds like a
system stability issue)?
What is the best way to monitor / list active sessions and open files?
Is there a way to kill individual file locks / close open files?

Any help would be appreciated.
Thank you,

Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://omniosce.org/ml-archive/attachments/20150303/bfe95d5f/attachment-0001.html>


More information about the OmniOS-discuss mailing list