Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jul 2005 15:10:30 -0400
From:      Igor Shmukler <igor.shmukler@gmail.com>
To:        fs@freebsd.org, hackers@freebsd.org, dillon@apollo.backplane.com
Subject:   per file lock list
Message-ID:  <6533c1c9050721121030016b7d@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 f=
ile?

Thank you in advance.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6533c1c9050721121030016b7d>