Is curthread always valid in a VOP call?

Rick Macklem rmacklem at uoguelph.ca
Sun Aug 31 18:46:16 UTC 2008



On Sun, 31 Aug 2008, Kostik Belousov wrote:

> On Sat, Aug 30, 2008 at 07:23:07PM -0400, Rick Macklem wrote:
>> Since VOP_GETATTR() and VOP_SETATTR() lost the thread argument in
>> -current, I did the obvious and used "curthread" instead. Is this
>> safe to do?
>
> Yes. Does the change forced you to use curthread often ?
>
Ok, thanks. How often? 7 (or 2 if I "struct thread *td = curthread; at
the beginning of nfs_getattr() and nfs_setattr() like the vanilla
nfsclient has done). Basically, any NFS
VOP is going to end up doing an RPC sooner or later (if it's lucky, it
hits a cache, but...) and the RPC currently likes to have a thread/proc
pointer so it can check for termination signals for interruptible
mounts. Personally, I'm not fond of interruptible mounts (they're hard
to get right and almost impossible to do correctly for NFS4) and prefer
hard mounts + forced dismounts when a server is dead. But, I'm not sure
others would be ready to get rid of them.

So, until interruptible mounts go away, I can't see avoiding a thread
pointer for the RPC and that means either pass it down the calling
chain or use curthread at some point. (Doesn't matter to me which it is,
so long as it works.)

rick


More information about the freebsd-fs mailing list