[BProc] Re: bproc+autofs: oz_pgrp problem

hanzl at noel.feld.cvut.cz hanzl at noel.feld.cvut.cz
Fri May 10 05:53:51 PDT 2002


In your last email, you already commented version of the patch which I
am yet going to write in this email :-) Good. Reverse-engineering
your comment:

Yet better way to fix autofs probably is to do just one change to
fs/autofs/autofs_i.h:

  static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
  /*	return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
   * Changed to let it work with bproc (should there be any):
   */
     return sbi->catatonic || sys_getpgrp() == sbi->oz_pgrp;
  }

This should fix autofs with bproc but also compile and work without bproc.

sys_getpgrp() either contains current->pgrp in vanilla kernel or bproc
hook in bproc-patched kernel.

Regards

Vaclav


> From: Erik Arjan Hendriks <erik at hendriks.cx>
> To: hanzl at noel.feld.cvut.cz
> Cc: bproc-users at lists.sourceforge.net, beowulf at beowulf.org
> Date: Thu, 9 May 2002 13:14:36 -0600
> User-Agent: Mutt/1.2.5.1i
> 
> 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.
> ...



More information about the Beowulf mailing list