~ubuntu-branches/ubuntu/dapper/autofs/dapper

« back to all changes in this revision

Viewing changes to 003_race_when_expiring

  • Committer: Bazaar Package Importer
  • Author(s): Steinar H. Gunderson
  • Date: 2005-10-06 14:42:32 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051006144232-6h2yly3gss95xjfl
Tags: 4.1.4-8
* Added a debian/compat file instead of setting DH_COMPAT.
* When purging, check if /usr/bin/ucf exists, and don't use it if it
  doesn't. (Closes: #330556)
* Ship .md5sum files for ucf with the md5sums from the conffiles in sarge,
  so the user won't be asked by ucf on the initial upgrade from sarge to
  an ucf-enabled version. (Closes: #331688)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -ruN -x Makefile.in -x configure autofs-3.1.7.orig/daemon/automount.c autofs-3.1.7/daemon/automount.c
2
 
--- autofs-3.1.7.orig/daemon/automount.c        Thu Jan  4 22:40:53 2001
3
 
+++ autofs-3.1.7/daemon/automount.c     Thu Jan  4 22:40:46 2001
4
 
@@ -141,12 +141,47 @@
5
 
   int rv;
6
 
   
7
 
   if (ap.ioctlfd >= 0) {
8
 
-    ioctl(ap.ioctlfd, AUTOFS_IOC_CATATONIC, 0);
9
 
     close(ap.ioctlfd);
10
 
   }
11
 
+
12
 
+  rv = spawnl(LOG_ERR, PATH_UMOUNT, PATH_UMOUNT, ap.path, NULL);
13
 
+  if (rv) {
14
 
+    chdir(ap.path);
15
 
+    ap.ioctlfd = open(".", O_RDONLY); /* Root directory for ioctl()'s */
16
 
+    chdir("/");
17
 
+    if ( ap.ioctlfd < 0 ) 
18
 
+      syslog(LOG_INFO, "can't reopen ioctlfd\n");
19
 
+    if ( ioctl(ap.ioctlfd, AUTOFS_IOC_PROTOVER, &kproto_version) ) {
20
 
+      syslog(LOG_DEBUG, "kproto on reawaken: %m");
21
 
+      kproto_version = 2;
22
 
+    }
23
 
+  
24
 
+    syslog(LOG_INFO, "using kernel protocol version %d on reawaken", kproto_version);
25
 
+  
26
 
+    if ( kproto_version < 3 ) {
27
 
+      ap.exp_timeout = ap.exp_runfreq = 0;
28
 
+      syslog(LOG_INFO, "kernel does not support timeouts");
29
 
+    } else {
30
 
+      unsigned long timeout;
31
 
+      
32
 
+      ap.exp_runfreq = (ap.exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO;
33
 
+      
34
 
+      timeout = ap.exp_timeout;
35
 
+      ioctl(ap.ioctlfd, AUTOFS_IOC_SETTIMEOUT, &timeout);
36
 
+      
37
 
+      /* We often start several automounters at the same time.  Add some
38
 
+       randomness so we don't all expire at the same time. */
39
 
+      if ( ap.exp_timeout )
40
 
+       alarm(ap.exp_timeout + my_pid % ap.exp_runfreq);
41
 
+      
42
 
+    }
43
 
+
44
 
+    return rv;
45
 
+      
46
 
+  }
47
 
+
48
 
   if (ap.pipefd >= 0)
49
 
     close(ap.pipefd);
50
 
-  rv = spawnl(LOG_ERR, PATH_UMOUNT, PATH_UMOUNT, ap.path, NULL);
51
 
   if (rv == 0 && submount)
52
 
     rmdir(ap.path);
53