Thanks Jeff. Your patch seems to fix the problem partly, but I still get
the "device busy" error because the tun device still remains attached to
one process after eth0 is disabled in the uml.

These are the uml related processes on the host after uml is started:

[EMAIL PROTECTED]:~> pstree -p 26848
linux(26848)???linux(26855)
             ??linux(26856)
             ??linux(26857)
             ??linux(26858)

Each of these processes except 26855 is attached to the tun device:

[EMAIL PROTECTED]:~> lsof /dev/net/tun
COMMAND   PID    USER   FD   TYPE DEVICE SIZE NODE NAME
linux   26848 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26856 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26857 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26858 hillenr   31u   CHR 10,200      4874 /dev/net/tun

After starting a telnet session to the uml telnet port, 3 more processes
are created on the host: telnetd, port-helper and another "linux"
process.

[EMAIL PROTECTED]:~> pstree -p 26848
linux(26848)???in.telnetd(27160)???port-helper(27161)
             ??linux(26855)
             ??linux(26856)
             ??linux(26857)
             ??linux(26858)
             ??linux(27163)

Thanks to your patch the tun device is not attached to the telnetd and
port-helper processes anymore, but still to the newly created linux
process:

[EMAIL PROTECTED]:~> lsof /dev/net/tun
COMMAND   PID    USER   FD   TYPE DEVICE SIZE NODE NAME
linux   26848 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26856 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26857 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   26858 hillenr   31u   CHR 10,200      4874 /dev/net/tun
linux   27163 hillenr   31u   CHR 10,200      4874 /dev/net/tun

And after taking down eth0 in the uml, the tun device remains stuck in
that process until the telnet session is terminated:

[EMAIL PROTECTED]:~> lsof /dev/net/tun
COMMAND   PID    USER   FD   TYPE DEVICE SIZE NODE NAME
linux   27163 hillenr   31u   CHR 10,200      4874 /dev/net/tun

Many thanks,

Robert

> -----Original Message-----
> From: Jeff Dike [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, January 29, 2006 3:39 AM
> To: Robert Hillen
> Cc: user-mode-linux-user@lists.sourceforge.net
> Subject: Re: [uml-user] Not possible to enable eth0 in UML: 
> Device or resource busy
> 
> 
> On Sun, Jan 29, 2006 at 12:08:54AM +0100, Robert Hillen wrote:
> > This happens when logging in to the uml via a telnet port. 
> The problem 
> > is that in this case the /dev/net/tun device remains attached to 3 
> > proceses on the host:
> 
> Nice diagnosis - does this patch below help?
> 
> Index: linux-2.6.15-mm/arch/um/os-Linux/drivers/tuntap_user.c
> ===================================================================
> --- 
> linux-2.6.15-mm.orig/arch/um/os-Linux/drivers/tuntap_user.c   
> 2006-01-03 17:39:46.000000000 -0500
> +++ linux-2.6.15-mm/arch/um/os-Linux/drivers/tuntap_user.c    
> 2006-01-28 21:08:13.000000000 -0500
> @@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate,
>               return(-EINVAL);
>       }
>       *fd_out = ((int *) CMSG_DATA(cmsg))[0];
> +     os_set_exec_close(*fd_out, 1);
>       return(0);
>  }
>  
> @@ -137,7 +138,8 @@ static int tuntap_open(void *data)
>               return(err);
>  
>       if(pri->fixed_config){
> -             pri->fd = os_open_file("/dev/net/tun", 
> of_rdwr(OPENFLAGS()), 0);
> +             pri->fd = os_open_file("/dev/net/tun", 
> +                                    
> of_cloexec(of_rdwr(OPENFLAGS())), 0);
>               if(pri->fd < 0){
>                       printk("Failed to open /dev/net/tun, 
> err = %d\n",
>                              -pri->fd);
> 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to