Wandering Thoughts archives

2011-01-21

A bit more on listing file locks on Solaris 10

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.

solaris/ListingFileLocksII written at 01:46:49; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.