1 diff --git a/daemon/spawn.c b/daemon/spawn.c
2 index 0ed873e..78d69c6 100644
9 +#include <sys/mount.h>
11 #include "automount.h"
13 @@ -308,6 +309,8 @@ int spawn_mount(unsigned logopt, ...)
15 ret = do_spawn(logopt, options, prog, (const char **) argv);
16 if (ret & MTAB_NOTUPDATED) {
17 + struct timespec tm = {3, 0};
20 * If the mount succeeded but the mtab was not
21 * updated, then retry the mount with the -f (fake)
22 @@ -329,6 +332,9 @@ int spawn_mount(unsigned logopt, ...)
23 argv[argc - 1] = argv[argc - 2];
24 argv[argc - 2] = arg_fake;
27 + nanosleep(&tm, NULL);
32 @@ -336,9 +342,16 @@ int spawn_mount(unsigned logopt, ...)
34 /* This is not a fatal error */
35 if (ret == MTAB_NOTUPDATED) {
36 - warn(logopt, "Unable to update the mtab file, /proc/mounts "
37 - "and /etc/mtab will differ");
40 + * Version 5 requires that /etc/mtab be in sync with
41 + * /proc/mounts. If we're unable to update matb after
42 + * retrying then we have no choice but umount the mount
43 + * and return a fail.
46 + "Unable to update the mtab file, forcing mount fail!");
48 + ret = MNT_FORCE_FAIL;
52 @@ -395,6 +408,8 @@ int spawn_bind_mount(unsigned logopt, ...)
54 ret = do_spawn(logopt, options, prog, (const char **) argv);
55 if (ret & MTAB_NOTUPDATED) {
56 + struct timespec tm = {3, 0};
59 * If the mount succeeded but the mtab was not
60 * updated, then retry the mount with the -f (fake)
61 @@ -416,6 +431,9 @@ int spawn_bind_mount(unsigned logopt, ...)
62 argv[argc - 1] = argv[argc - 2];
63 argv[argc - 2] = arg_fake;
66 + nanosleep(&tm, NULL);
71 @@ -423,9 +441,16 @@ int spawn_bind_mount(unsigned logopt, ...)
73 /* This is not a fatal error */
74 if (ret == MTAB_NOTUPDATED) {
75 - warn(logopt, "Unable to update the mtab file, /proc/mounts "
76 - "and /etc/mtab will differ");
79 + * Version 5 requires that /etc/mtab be in sync with
80 + * /proc/mounts. If we're unable to update matb after
81 + * retrying then we have no choice but umount the mount
82 + * and return a fail.
85 + "Unable to update the mtab file, forcing mount fail!");
87 + ret = MNT_FORCE_FAIL;
91 diff --git a/include/automount.h b/include/automount.h
92 index 4887da6..fa5cd97 100644
93 --- a/include/automount.h
94 +++ b/include/automount.h
95 @@ -78,6 +78,7 @@ int load_autofs4_module(void);
96 #define MOUNTED_LOCK _PATH_MOUNTED "~" /* mounts' lock file */
97 #define MTAB_NOTUPDATED 0x1000 /* mtab succeded but not updated */
98 #define NOT_MOUNTED 0x0100 /* path notmounted */
99 +#define MNT_FORCE_FAIL -1
100 #define _PROC_MOUNTS "/proc/mounts"
102 /* Constants for lookup modules */
103 diff --git a/modules/mount_bind.c b/modules/mount_bind.c
104 index 04284f5..ef973e1 100644
105 --- a/modules/mount_bind.c
106 +++ b/modules/mount_bind.c
107 @@ -147,7 +147,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
108 if ((!ap->ghost && name_len) || !existed)
109 rmdir_path(ap, fullpath, ap->dev);
115 MODPREFIX "mounted %s type %s on %s",
116 diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
117 index bad21fc..0e7aebe 100644
118 --- a/modules/mount_nfs.c
119 +++ b/modules/mount_nfs.c
120 @@ -233,6 +233,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
124 + /* Failed to update mtab, don't try any more */
125 + if (err == MNT_FORCE_FAIL)
128 /* No hostname, can't be NFS */
131 @@ -275,6 +279,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
136 free_host_list(&hosts);
137 ap->ghost = save_ghost;