home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!dkuug!tfl.dk!karsten
- From: karsten@tfl.dk (Karsten Nyblad)
- Newsgroups: vmsnet.internals
- Subject: Re: Searching the lock list for locks associated with a file
- Message-ID: <1992Aug26.123720.274@tfl.dk>
- Date: 26 Aug 92 10:37:20 GMT
- References: <920825142952.20201d28@vax4>
- Organization: TFL, A Danish Telecommunication Research Laboratory
- Lines: 69
-
- In article <920825142952.20201d28@vax4>, RSPECTOR@vax4.bear.com writes:
- > I am trying to create a utility that will search the lock list database on all
- > systems in a cluster and return lock information about all the locks for a
- > specified file or records within the file.
- >
- > I wrote a program that runs on every system in the cluster. It executes the
- > system service $GETLKI in kernal mode to search all the locks on a given system.
- > This program looks for a matching resource name. If one is found, the lock
- > information will be displayed. If there is no match, the lock could possibly
- > be for a record within the specified file. The program will check to see if
- > this lock has a parent lock id. If the id exists, the parent's resource name
- > will be checked for a match. If a match is found, then the lock information
- > will be displayed. If there is no match, then the lock will be skipped.
- >
- > This solution will not work. It is very slow. There are about 30,000 locks
- > at any one time in use. It also appears that my process uses a lot of the CPU
- > and goes into RWSCS state quite often. Therefore, I am looking for an
- > alternative.
- >
- > I would like to be able to write some privileged code to calculate a hash value
- > for the specified file and find the resource block from the hash table.
- > Once I have this I will be able to find the sub resource blocks and all the
- > locks associated with the resource and sub resources.
- >
- > I would appreciate any help with this matter.
- >
- >
- > Robin Spector
- > Bear Stearns Inc. & Co.
- > New York, N.Y. 10167
- > (212) 272-3696
-
- First, listing the locks taken by the XCP wont help you much. The locks
- are on node basis, i.e. owned by the node in the cluster. Within the
- single node, access is synchronize by the XCP. The easiest way to get
- the lock on a file is geting the reference for the FCB, which has a
- field containing the lockid on the lock of the file. The reference
- for the FCB is optained by a QIO to the XCP asking for the statistics
- block. Refer to chapter 1 of the I/O control manuals. To find the single
- processes locking a file you need to track the WCBs (Window Control Block),
- which lists the processes locking the file on the current node.
- I will send you a program that does the trick. It needs SYSLCK
- WORLD and CMKNRL priviledges. The program is not completed,
- but it does what you need on VMS version 5.4 and later. DEC
- cleaned up some symbol names in version 5.4, so it will not
- compile on earlier versions. The program will not list processes
- locking the file as a global sections. The program does not synchronizes
- with the XCP, but is written with handlers so that it will not crash
- your computer. Refer to VMS file Systems Internals for details and
- for information on how to synchronize properly with the XCP (order
- number EY-F575E-DP).
-
- The RMS locks are as far as I know organized into a lock tree with
- a parent lock consisting of the prefix RMS$, the file id, and the
- volume lock name. The file id takes up 4 bytes if the file is not
- located on a volume set and the file number is less than 2**16.
- Otherwise it takes up 6 bytes. You can chase through the
- resource database and find all sublocks in that way. Refer to
- VAX/VMS Internals and Data Structures for details (order number
- EY-C171E-DP)
-
- What do you really want? Finding the process locking the
- ressource somebody wants? It can be done by going through
- the list of locks associated to "somebodies" process. That list is
- refered from the PCB.
-
- Karsten Nyblad
- TFL, A Danish Telecommunication Research Laboratory
- E-mail: karsten@tfl.dk
-