per file lock list

Igor Shmukler igor.shmukler at gmail.com
Thu Jul 21 19:10:37 GMT 2005


Hi,

We have a question: how to get all POSIX locks for a given file?

As far as I know, existing API does not allow to retrieve all file
locks. Therefore, we need to use kernel internal structures to get all
applied locks. Unfortunately, a head of list with file locks is
attached to inode rather then vnode. As result, it is much harder to
get the lock list head due to the need to know exact inode type that
is hidden behind the vnode.

Of course, the problem could be resolved in a hackish way: we may get
the address of VOP_ADVLOCK() method and compare it with all known FS
methods, that handles this VOP operation: (ufs_advlock, etc.) and
therefore apply a proper type cast to vnode->v_data to get valid
inode. However, this would be a last resort.

So the question: is there an elegant way to get the lock list for a given file?

Thank you in advance.


More information about the freebsd-fs mailing list