Re: [PATCH][2.1.71] BSD revoke() syscall

Matthew Kirkwood (weejock@ferret.lmh.ox.ac.uk)
Tue, 9 Dec 1997 15:38:46 +0000 (GMT)


On Tue, 9 Dec 1997, Alan Cox wrote:

> > The enclosed patch implements most of the BSD revoke() syscall,
> > although it probably needs an fs bod to add a few extra locks
> > of something...
>
> Without lack of respect for the effort "urggggggggggggggggghhhhhhhh" 8)

Agreed <g>

> Have a look how the tty layer revokes access to things. Instead of
> putting another check inline with every fs syscall it changes the
> read/write/etc methods for the object to point to ones that return
> -ENXIO.

Good point but how, then, do I deal correctly with close()? I'm not
allowed to modify *(filp->f_op) (would break the whole filesystem,
wouldn't it?), but I _am_ allowed to change filp->f_op, if I'm not
mistaken. Except that then it's not possible cleanly to handle the
file close.

> That then requires no extra changes although it does have some implicit
> races - as does yours. Specifically
>
> begin read
> revoke
> read wakes up
> complete read
>
> next read
> -EIO

I had wondered about these -- what's the policy? I thought "I've started
so I'll finish" was the rule :)

> the tty drivers handle the relevant races correctly internally if I am
> reading the code right.

OK, but I still require close to be handled correctly. How do I go about
that one?

Matthew.

PS. I'd love to see this in 2.2, but perhaps someone InTheKnow(tm) should
write it? :) It can't be more than an hour's coding.