[Samba] Re: strange locks

jra@dp.samba.org
Tue, 29 Oct 2002 07:28:25 -0000

On Tue, Oct 29, 2002 at 06:17:20PM +1100, Matthew Hannigan wrote:

> so I could see some locks from the unix level.
> It worked sorta, I see the locks for big files
> (but not the locks I was expecting), but for little
> files it shows nothing:
>
> # ./lock_list /opt/testsambashare/mattest.doc
> # ./lock_list /opt/testsambashare/contents.doc
> 0 22086 W 2147483539        1
> 0 22086 W 2147483559        1
> 0 22086 W 2147483599        1
> (the output is l_sysid, l_pid, l_start, l_len of struct flock)
>
> (lock_list.c source given below)
>
> The only difference I can see is that the contents.doc is
> much bigger:
>
> # ls -l /opt/testsambashare
> total 5210
> -rwxrw-r--   1 matt     other    1460736 Oct 29 15:24 contents.doc
> -rw-r--r--   1 matt     other    1176738 Oct 29 15:23 contents.txt
> -rwxrw-r--   1 matt     other       2168 Oct 29 16:19 mattest.doc
> -rwxrw-r--   1 matt     other         54 Oct 29 16:52 ~$attest.doc
> -rwxrw-r--   1 matt     other         54 Oct 29 16:47 ~$ntents.doc
>
>
> Why is there 3 1 byte locks at some position
> way beyond the end of the file?

The locks you see here are used by MS Office as semaphores.
No one really knows why (well the MS Office programmers do,
but they're not telling :-).

Jeremy.