A bit more on listing file locks on Solaris 10

January 21, 2011

To follow up on my earlier entry on this, it's amazing what you discover when you take the time go through mdb's full online help. In particular, if you have an NFS fileserver you can easily see all NFS locks that it knows about, complete with the remote hold and even the full filename.

The basic mdb -k command we want is ::nlm_lockson, which does what you might expect from the name. The state field values that I know about are '3' for active locks and '4' for attempted locks that are currently blocked. If there is a specific lock that you want path information on, take the vnode address and use the mdb command line:

<addr> ::print vnode_t v_path

If you want the paths for most or all of the locks, use ::nlm_lockson -v instead of the plain version. This will also tell you various sorts of other additional information, including decoding the numeric state field to human-readable values.

The help for ::nlm_lockson claims that you can get it to report on only a single remote host. I've never been able to get this to work, but I don't care very much since you can always pipe its output through grep or the like. (I'm probably missing something.)

The other two NLM commands documented in ::nfs_help -d don't seem to report anything that's useful for sysadmins. It's possible that I'm missing something; full understanding of this stuff is difficult without access to the kernel source, and the NLM modules are one of the pieces of Solaris that are still closed source and available only as binaries.

Written on 21 January 2011.
« Something I've worked out about Django's admin interface
The clash between wikis and blogging »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Jan 21 01:46:49 2011
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.