[OpenAFS] Re: experience of SQLite on AFS

Andrew Deason adeason@sinenomine.net
Fri, 30 Apr 2010 17:07:49 -0500

On Mon, 19 Apr 2010 17:41:03 -0500
Andrew Deason <adeason@sinenomine.net> wrote:

> On Mon, 19 Apr 2010 14:51:28 -0600
> Ken Dreyer <ktdreyer@ktdreyer.com> wrote:
> > The ACLs were one of the first things I looked at, but "k" seemed to
> > have no effect. I will try to build SQLite aside from PHP to see if I
> > can narrow the problem further. I'll try to provide backtraces /
> > cmdebug too, when I can pull them together.
> A truss would also at least help to see if it's our bug or theirs. My
> guess would be that it's ours, since the only difference in the cases
> you describe is RW vs RO. But it's possible sqlite is broken for
> RO-fs-with-flock or something.

After some offline discussion, this appears to probably be the case.
sqlite opens the db file O_RDONLY, and attempts to acquire an fcntl
F_WRLCK on it, to which it gets EROFS back. Trying to acquire a
writelock on a file opened readonly doesn't make a lot of sense to me;
can someone tell me if POSIX specifies that that should fail?

In any case, I think technically fcntl should be returning EBADF here,
not EROFS (I think this is our fault, but I haven't checked yet). I
don't know if it makes a difference what error code sqlite gets back;
I'll try later to see if it does anything differently when it gets EBADF
back instead.

Andrew Deason