[CSL #248914] [OpenAFS] flock() behavior openafs-1.2.11
David Thompson
thomas@cs.wisc.edu
Wed, 01 Dec 2004 14:29:51 -0600
Derrick J Brashear wrote:
>
>fine, so i'll guess this function calls one of our ops (getattr?) and
>somehow loses, because EACCES shouldn't be coming from afs_lockctl (at
>least not directly)
>
>Can you fstrace both cases?
Here's the sample C program I'm using:
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
char *fname = "/s/db-apps/lib/GradApp/lib/GradApp.pbk";
main ()
{
int fd, ret;
fd = open (fname, O_RDONLY);
ret = flock (fd, LOCK_SH);
exit (0);
}
I think I have the helpful part of the fstrace. Tell me if you need more.
Box 1 (the flock succeeds):
<snip>
time 119.118525, pid 29453: d_delete inode 0xe13ee698 d_name lib/GradApp
time 119.118525, pid 29453: Access vp 0xe1077d3c mode 0x40 len 0x800
time 119.118525, pid 29453: Access vp 0xe13ef034 mode 0x40 len 0x800
time 119.118525, pid 29453: Access vp 0xe13f036c mode 0x100 len 0x23e8
time 119.118525, pid 29453: Open 0xe13f036c flags 0x0
time 119.118525, pid 29453: Open 0xe13f036c flags 0xf423f
time 119.118525, pid 29453: Close 0xe13f036c flags 0x0
time 119.118525, pid 29453: d_delete inode 0xe13f036c d_name lib/GradApp.pbk
AFS Trace Dump - Completed
Box 2 (the flock fails):
<snip>
time 962.599815, pid 21833: d_delete inode 0x420bdf5c d_name lib/GradApp
time 962.599815, pid 21833: Access vp 0x4204de4c mode 0x40 len 0x800
time 962.599815, pid 21833: Access vp 0x4203b168 mode 0x40 len 0x800
time 962.599815, pid 21833: Access vp 0x422de2c4 mode 0x100 len 0x23e8
time 962.599815, pid 21833: Open 0x422de2c4 flags 0x0
time 962.599815, pid 21833: Open 0x422de2c4 flags 0xf423f
time 962.599815, pid 21833: Analyze RPC op 13 conn 0x2128b4c0 code 0xd user
0x417529fa
time 962.599815, pid 21833: Returning code 13 from 1
time 962.599815, pid 21833: Returning code 13 from 3
time 962.599815, pid 21833: Close 0x422de2c4 flags 0x0
time 962.599815, pid 21833: d_delete inode 0x422de2c4 d_name lib/GradApp.pbk
AFS Trace Dump - Completed
Dave