Hi all,

I'm experiencing a problem with autofs. It seems that when a process
is inside an automounted nfs filesystem, if I restart the automount
daemon the current working directory of the process is changed and a
few leading directory are removed leading to a non-existent cwd.

I have to say, however, that the process will continue to see the
current directory: for instance, if we are running a shell, a "ls"
will gives you the correct answer, I can edit files (but vi
complains about not finding the file when saving) and the "pwd"
command returns the right directory.

In order to reproduce the problem I've wrote a very simple program:

#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>

int main(){
  /* check if the current directory is right */
  char lpath[1024];
  int res;
  getcwd(lpath, 1024);
  res = access(lpath,F_OK);
  if(0 != res)
      printf("Error! My CWD is %s but it doens't exists!\n", lpath);
  else
      printf("My CWD is %s and it exists\n", lpath);
  return res;
}


a simple session follows:

[r...@pc-amessina ~]# cd /home/RAID3-D3/vmware
[r...@pc-amessina vmware]# ~/cwdcheck
My CWD is /home/RAID3-D3/vmware and it exists
[r...@pc-amessina vmware]# service autofs restart
Stopping autofs:                                                [  OK  ]
Starting autofs:                                                [  OK  ]
[r...@pc-amessina vmware]# ~/cwdcheck
Error! My CWD is /vmware but it doens't exists!


My auto.master is:

/home /etc/auto.home  -rw,soft,intr,rsize=8192,wsize=8192,sync

my auto.home is very long but the relevant line is:

RAID3-D3 climaserv3:/RAID3/D3

(we mount a few different filesystems from the climaserv3 machine,
but they are exported separately by the server)

My system is:

[r...@pc-amessina ~]# uname -a
Linux pc-amessina.ictp.it 2.6.24.7-desktop-2mnb #1 SMP Thu Oct 30
18:03:14 EDT 2008 i686 Intel(R) Core(TM)2 Duo CPU     E8400  @
3.00GHz GNU/Linux

[r...@pc-amessina ~]# cat /etc/redhat-release
Mandriva Linux release 2008.1 (Official) for i586

[r...@pc-amessina ~]# rpm -q autofs
autofs-5.0.4-7mdv2008.1


Logs from automount follows:

Sep  3 12:55:33 localhost automount[11856]: Starting automounter
version 5.0.4, master map auto.master
Sep  3 12:55:33 localhost automount[11856]: using kernel protocol
version 5.00
Sep  3 12:55:33 localhost automount[11856]: mounted indirect on
/home with timeout 900, freq 225 seconds
Sep  3 12:55:53 localhost automount[11856]: attempting to mount
entry /home/RAID3-D3
Sep  3 12:55:53 localhost automount[11856]: mount(nfs): mounted
climaserv3:/RAID3/D3 on /home/RAID3-D3
Sep  3 12:55:53 localhost automount[11856]: mounted /home/RAID3-D3
Sep  3 12:55:59 localhost automount[11856]: 1 remaining in /home
Sep  3 12:55:59 localhost automount[11856]: filesystem /home still busy
Sep  3 12:56:04 localhost automount[11915]: Starting automounter
version 5.0.4, master map auto.master
Sep  3 12:56:04 localhost automount[11915]: using kernel protocol
version 5.00
Sep  3 12:56:04 localhost automount[11915]: mounted indirect on
/home with timeout 900, freq 225 seconds
Sep  3 12:56:09 localhost automount[11915]: attempting to mount
entry /home/RAID3-D3
Sep  3 12:56:09 localhost automount[11915]: mount(nfs): mounted
climaserv3:/RAID3/D3 on /home/RAID3-D3
Sep  3 12:56:09 localhost automount[11915]: mounted /home/RAID3-D3
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to