lkml.org 
[lkml]   [1998]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: autofs/smbfs - delayed mounting?
On Tue, 1 Dec 1998, Nicholas J. Leon wrote:

> # The patch attached below should fix this... I'll get the fix
> # commited into CVS today. Let me know if this takes care of the problem.
>
> I now getting the smbmount process stuck when running this patch:
>
> 757 ? S 0:00 automount /auto file /etc/autofs.conf
> 758 ? Z 0:00 (mount <zombie>)
> 769 ? S 0:00 smbmount \\tao\c -c mount /auto/tao -u 0 -g 0
>
> root(7)@neko [105 /usr2/root] # strace -p 769
> pause(....
>

I have a similar thing here:

cola:~urban/dl#me | grep smbmount
root 3546 0.0 0.0 1680 0 ? SW Nov 30 0:00
(smbmount.samba)
root 3560 0.0 0.0 1680 0 ? SW Nov 30 0:00
(smbmount.samba)
root 6500 0.0 0.0 1680 0 ? SW Dec 1 0:00
(smbmount.samba)

(and so on ...)
Processes are left running long after the mount is gone.


I also think I know what the problem is. I did a quick reading of the
smbfs code when I looked for solutions to the problem. As I understand it
smbfs keeps the pid of the process making the connection (calling ioctl),
and that should be true since it may need to tell it later that it needs
to reconnect (using kill(pid, SIG...)).

Your patch moves the daemonize() call so that the parent makes the
original ioctl and then exits. The child however waits indefinetly for
someone to wake it up.

My patch shouldn't have this problem (but I can't say that I checked for
zombies when testing it) since it only changes when the parent exits, your
patch also changes when the child is created.

My patch contains a race condition (if the child gets to run for a long
time it may signal the parent before it has installed the signalhandler),
and is also unnecessarily complicated.


The code below is a better version of my solution. It appears to work, and
it doesn't leave sleeping smbmount processes (on my machine).


/Urban

---
Urban Widmark urban@svenskatest.se
Svenska Test AB +46 90 71 71 23


--- smbmount.c.org Wed Dec 2 09:54:00 1998
+++ smbmount.c Wed Dec 2 09:56:22 1998
@@ -191,8 +191,9 @@
}
if (i > 0)
{
- /* parent simply exits */
- exit(0);
+ /* wait for the child to terminate us */
+ while(1)
+ sleep(10);
}
setsid();
chdir("/");
@@ -255,6 +256,7 @@
send_fs_socket(char *mount_point, char *inbuf, char *outbuf)
{
int fd, closed = 0, res = 1;
+ int first_time = 1;

while (1)
{
@@ -289,6 +291,10 @@
close_our_files();
}
#endif
+ if( first_time ) {
+ first_time = 0;
+ kill(getppid(), SIGTERM);
+ }

/*
* Wait for a signal from smbfs ...




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.072 / U:1.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site