[BProc] Re: bproc+autofs: oz_pgrp problem

Erik Arjan Hendriks erik at hendriks.cx
Thu May 9 12:14:36 PDT 2002


On Thu, May 09, 2002 at 08:19:07PM +0200, hanzl at noel.feld.cvut.cz wrote:
> ...
> #include <asm/uaccess.h>
> 
> /* Added by VH for bproc: */
> #include <linux/bproc.h>
> ...
> 
> static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
> /*	return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
>  * Changed by Vaclav Hanzl to let it work with bproc:
>  */
>    return sbi->catatonic ||
>      bproc_hook_imv(current->pgrp,sys_getpgrp,()) == sbi->oz_pgrp;
> }
> 
> I have little idea what it actually means, but it works :)
> Any comments welcome, as always.

That calls: (kernel/sys.c from Linux source)

asmlinkage long sys_getpgrp(void)
{
        /* SMP - assuming writes are word atomic this is fine */
        return bproc_hook_imv(current->pgrp,sys_getpgrp,());
}

the bproc_hook_imv macro calls: (kernel/hooks.c from BProc source)

int bproc_hook_sys_getpgrp(void) {
    return current->bproc.masq->pgrp;
}

... but only if the caller has masqueraded PIDs which is exactly what
you want.  This patch should perfectly safe.  It's small and to the
point - I like it.


> >This is the easiest way to get around the problem although there are
> >some drawbacks.  I've been pretty vehement about not providing hooks
> >for things like daemons to escape.  The rationale there is basically
> >that people would use those hooks if they were there. :)
> 
> Good rationale. Keep it. :-))
> 
> Little side-effect probably is that most people are not able to run
> any daemons on bproc node. :-) But things are getting better...

I don't like daemons on nodes anyway.  I've been trying for years to
reduce the bulk of stuff running on the nodes.

- Erik



More information about the Beowulf mailing list