Detecting directory changes.

Carl Perkins CARL at gerg.tamu.edu
Thu Mar 13 14:59:03 GMT 2003


>That's actually a way to consider, but I am not too much confident, because
>the problem is to know when directory contents are changed. You are talking
>here of RMS locks, and changes in the directories are not made by RMS, but
>by the XQP. I mean that there is no calls to RMS $OPEN service when changing
>the directory contents, so there is probably no RMS$xxx resource either to
>be "AST blocked" for that purpose.

I keep forgeting that even though the $RENAME service is part of RMS, it
won't take out RMS locks (at least, I'm pretty sure it doesn't).

OK, I have done some research. It turns out that the XQP uses serialization
locks with names with a prefix of F11B$s followed by 4 bytes of binary data
that are 2 bytes of FID file number and 2 bytes of RVN/NMX data (the only
example I have found doesn't use the NMX data, but it is from 1994),
essentially it is the FID with the middle two bytes of file sequence number
removed. This is a child lock on a volume allocation lock - a lock taken
out on a resource with a prefix of "F11B$v" followed by 12 bytes of volume
name (space filled).

So instead of blocking ASTs via a (probably never used) RMS resource, you
could do it on the F11B$s serialization resource. According to the only
mention of this on the "Ask the Wizard" pages, this is used by various
software, including 3rd party softwre, for doing this sort of thing.

I found an old (1994) program using this (it doesn't use the NMX byte
to get the full range of file numbers, instead using only the RVN byte, so
it will not always work as advertised on a more modern system - it will tend
to operate on the wrong file if the desired file uses the NMX bits to extend
its file number past the 16 bit limit). This program was for doing something
a lot like SAMBA need - it was intended to replace the scanning of the
contents of a directory to see if anything had changed with a way of being
notified when it changed.

See:
http://www.eight-cubed.com/watchdir.zip

which has a parent document of:

http://www.eight-cubed.com/downloads.html

The lock's resoure name's format is also mentioned in a few other places
such as

http:// www.geocities.com/keithparris/decus_presentations/
s2002_dist_lock_mgr_perf.ppt

which includes this text in an example:

'F11B$vAPP2        ' 202020202020202032505041762442313146

    Files-11 Volume Allocation lock for volume APP2

'F11B$sH...' 00000148732442313146

    Files-11 File Serialization lock for file [328,*,0] on volume APP2

The a lock on the former resouce would be the parent of the lock on the
latter resource. (The parent lock evidently just needs to be in NL mode.)

Figuring out some of this would be easier for someone with the
VMS File Systems Internals book. Unfortunately that has not been
updated since 1990 and would therefore be missing some information
(like the NMX bits in the FID, probably).

--- Carl


More information about the samba-vms mailing list