/* * Handle "background" NFS mount [retry daemon] * * Returns a valid mount command exit code: EX_SUCCESS if successful, * EX_FAIL if a failure occurred. There's nothing to catch the * error return, though, so we use sys_mount_errors to log the * failure. */ static int nfsmount_child(struct nfsmount_info *mi) { unsigned int secs = 1; time_t timeout; timeout = nfs_parse_retry_option(mi->options, NFS_DEF_BG_TIMEOUT_MINUTES); for (;;) { if (sleep(secs)) break; secs <<= 1; if (secs > 120) secs = 120; if (nfs_try_mount(mi)) return EX_SUCCESS; /* retry background mounts when the server is not up */ if (nfs_is_permanent_error(errno) && errno != EOPNOTSUPP) break; if (time(NULL) > timeout) break; sys_mount_errors(mi->hostname, errno, 1, 1); }; sys_mount_errors(mi->hostname, errno, 1, 0); return EX_FAIL; }
/* * Handle "background" NFS mount [first try] * * Returns a valid mount command exit code. * * EX_BG should cause the caller to fork and invoke nfsmount_child. */ static int nfsmount_parent(struct nfsmount_info *mi) { if (nfs_try_mount(mi)) return EX_SUCCESS; if (nfs_is_permanent_error(errno)) { mount_error(mi->spec, mi->node, errno); return EX_FAIL; } sys_mount_errors(mi->hostname, errno, 1, 1); return EX_BG; }
/* * Handle "background" NFS mount [first try] * * Returns a valid mount command exit code. * * EX_BG should cause the caller to fork and invoke nfsmount_child. */ static int nfsmount_parent(struct nfsmount_info *mi) { if (nfs_try_mount(mi)) return EX_SUCCESS; /* retry background mounts when the server is not up */ if (nfs_is_permanent_error(errno) && errno != EOPNOTSUPP) { mount_error(mi->spec, mi->node, errno); return EX_FAIL; } sys_mount_errors(mi->hostname, errno, 1, 1); return EX_BG; }