From 23b4c97486d88fd3e81b2dd5dbce2c0f2da80e8d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:30:33 +0000 Subject: import autofs-5.0.7-69.el7 --- diff --git a/SOURCES/autofs-5.1.1-improve-scalability-of-direct-mount-path-component-creation.patch b/SOURCES/autofs-5.1.1-improve-scalability-of-direct-mount-path-component-creation.patch new file mode 100644 index 0000000..8ac71db --- /dev/null +++ b/SOURCES/autofs-5.1.1-improve-scalability-of-direct-mount-path-component-creation.patch @@ -0,0 +1,190 @@ +autofs-5.1.1 - improve scalability of direct mount path component + +From: Jeff Mahoney + +With direct mounts, we want to avoid creating path components on +remote file systems unless that file system is the root file system. + +The check boils down to allowing the mkdir if: +1/ If it's the root directory, or +2/ If it's not a remote file system, or +3/ If it's a remote file system that's the root file system + +We can do that without parsing the mount table and can +improve startup time for all cases. + +Signed-off-by: Jeff Mahoney +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/automount.c | 56 +++++++++++++++++++++++++++++++++++++++------------- + include/automount.h | 2 + + include/mounts.h | 1 + lib/mounts.c | 45 ----------------------------------------- + 5 files changed, 45 insertions(+), 60 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -245,6 +245,7 @@ + - use autofs_point to store expire timeout where possibe. + - fix possible NULL derefernce. + - fix work around sss startup delay. ++- improve scalability of direct mount path component. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -135,10 +135,25 @@ void set_thread_mount_request_log_id(str + } + } + ++static int is_remote_fstype(unsigned int fs_type) ++{ ++ int ret = 0; ++ switch (fs_type) { ++ case SMB_SUPER_MAGIC: ++ case CIFS_MAGIC_NUMBER: ++ case NCP_SUPER_MAGIC: ++ case NFS_SUPER_MAGIC: ++ ret = 1; ++ break; ++ }; ++ return ret; ++} ++ + static int do_mkdir(const char *parent, const char *path, mode_t mode) + { + int status; +- struct stat st; ++ mode_t mask; ++ struct stat st, root; + struct statfs fs; + + /* If path exists we're done */ +@@ -151,24 +166,37 @@ static int do_mkdir(const char *parent, + } + + /* +- * If we're trying to create a directory within an autofs fs +- * or the path is contained in a localy mounted fs go ahead. ++ * We don't want to create the path on a remote file system ++ * unless it's the root file system. ++ * An empty parent means it's the root directory and always ok. + */ +- status = -1; +- if (*parent) ++ if (*parent) { + status = statfs(parent, &fs); +- if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) || +- contained_in_local_fs(path)) { +- mode_t mask = umask(0022); +- int ret = mkdir(path, mode); +- (void) umask(mask); +- if (ret == -1) { +- errno = EACCES; +- return 0; ++ if (status == -1) ++ goto fail; ++ ++ if (is_remote_fstype(fs.f_type)) { ++ status = stat(parent, &st); ++ if (status == -1) ++ goto fail; ++ ++ status = stat("/", &root); ++ if (status == -1) ++ goto fail; ++ ++ if (st.st_dev != root.st_dev) ++ goto fail; + } +- return 1; + } + ++ mask = umask(0022); ++ status = mkdir(path, mode); ++ (void) umask(mask); ++ if (status == -1) ++ goto fail; ++ ++ return 1; ++fail: + errno = EACCES; + return 0; + } +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -75,6 +75,8 @@ int load_autofs4_module(void); + #define AUTOFS_SUPER_MAGIC 0x00000187L + #define SMB_SUPER_MAGIC 0x0000517BL + #define CIFS_MAGIC_NUMBER 0xFF534D42L ++#define NCP_SUPER_MAGIC 0x0000564CL ++#define NFS_SUPER_MAGIC 0x00006969L + + #define ATTEMPT_ID_SIZE 24 + +--- autofs-5.0.7.orig/include/mounts.h ++++ autofs-5.0.7/include/mounts.h +@@ -101,7 +101,6 @@ int ext_mount_remove(struct list_head *, + struct mnt_list *get_mnt_list(const char *table, const char *path, int include); + struct mnt_list *reverse_mnt_list(struct mnt_list *list); + void free_mnt_list(struct mnt_list *list); +-int contained_in_local_fs(const char *path); + int is_mounted(const char *table, const char *path, unsigned int type); + int has_fstab_option(const char *opt); + void tree_free_mnt_tree(struct mnt_list *tree); +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -941,51 +941,6 @@ void free_mnt_list(struct mnt_list *list + } + } + +-int contained_in_local_fs(const char *path) +-{ +- struct mnt_list *mnts, *this; +- size_t pathlen = strlen(path); +- int ret; +- +- if (!path || !pathlen || pathlen > PATH_MAX) +- return 0; +- +- mnts = get_mnt_list(_PATH_MOUNTED, "/", 1); +- if (!mnts) +- return 0; +- +- ret = 0; +- +- for (this = mnts; this != NULL; this = this->next) { +- size_t len = strlen(this->path); +- +- if (!strncmp(path, this->path, len)) { +- if (len > 1 && pathlen > len && path[len] != '/') +- continue; +- else if (len == 1 && this->path[0] == '/') { +- /* +- * always return true on rootfs, we don't +- * want to break diskless clients. +- */ +- ret = 1; +- } else if (this->fs_name[0] == '/') { +- if (strlen(this->fs_name) > 1) { +- if (this->fs_name[1] != '/') +- ret = 1; +- } else +- ret = 1; +- } else if (!strncmp("LABEL=", this->fs_name, 6) || +- !strncmp("UUID=", this->fs_name, 5)) +- ret = 1; +- break; +- } +- } +- +- free_mnt_list(mnts); +- +- return ret; +-} +- + static int table_is_mounted(const char *table, const char *path, unsigned int type) + { + struct mntent *mnt; diff --git a/SOURCES/autofs-5.1.2-add-config-option-to-use-mount-request-log-id.patch b/SOURCES/autofs-5.1.2-add-config-option-to-use-mount-request-log-id.patch new file mode 100644 index 0000000..37e3b82 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-config-option-to-use-mount-request-log-id.patch @@ -0,0 +1,148 @@ +autofs-5.1.2 - add config option to use mount request log id + +From: Ian Kent + +Add a configuration option to control whether request ids are added to +mount request log entries. It's default value is to not include the +additional id. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 3 +++ + include/defaults.h | 3 +++ + lib/defaults.c | 18 ++++++++++++++++++ + man/autofs.conf.5.in | 6 ++++++ + redhat/autofs.conf.default.in | 7 +++++++ + samples/autofs.conf.default.in | 7 +++++++ + 7 files changed, 45 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -239,6 +239,7 @@ + - create thread-local ID for mount attempts. + - log functions to prefix messages with attempt_id if available. + - factor out set_thread_mount_request_log_id(). ++- add config option to use mount request log id. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -116,6 +116,9 @@ void set_thread_mount_request_log_id(str + unsigned long *attempt_id; + int status; + ++ if (!defaults_get_use_mount_request_log_id()) ++ return; ++ + attempt_id = pthread_getspecific(key_thread_attempt_id); + if (attempt_id == NULL) { + attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -51,6 +51,8 @@ + #define DEFAULT_USE_HOSTNAME_FOR_MOUNTS "0" + #define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0" + ++#define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0" ++ + /* Config entry flags */ + #define CONF_NONE 0x00000000 + #define CONF_ENV 0x00000001 +@@ -169,6 +171,7 @@ const char *defaults_get_auth_conf_file( + unsigned int defaults_get_map_hash_table_size(void); + unsigned int defaults_use_hostname_for_mounts(void); + unsigned int defaults_disable_not_found_message(void); ++unsigned int defaults_get_use_mount_request_log_id(void); + + unsigned int conf_amd_mount_section_exists(const char *); + char **conf_amd_get_mount_paths(void); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -76,6 +76,8 @@ + #define NAME_USE_HOSTNAME_FOR_MOUNTS "use_hostname_for_mounts" + #define NAME_DISABLE_NOT_FOUND_MESSAGE "disable_not_found_message" + ++#define NAME_USE_MOUNT_REQUEST_LOG_ID "use_mount_request_log_id" ++ + #define NAME_AMD_ARCH "arch" + #define NAME_AMD_AUTO_ATTRCACHE "auto_attrcache" + #define NAME_AMD_AUTO_DIR "auto_dir" +@@ -354,6 +356,11 @@ static int conf_load_autofs_defaults(voi + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_USE_MOUNT_REQUEST_LOG_ID, ++ DEFAULT_USE_MOUNT_REQUEST_LOG_ID, CONF_ENV); ++ if (ret == CFG_FAIL) ++ goto error; ++ + /* LDAP_URI and SEARCH_BASE can occur multiple times */ + while ((co = conf_lookup(sec, NAME_LDAP_URI))) + conf_delete(co->section, co->name); +@@ -1832,6 +1839,17 @@ unsigned int defaults_disable_not_found_ + + return res; + } ++ ++unsigned int defaults_get_use_mount_request_log_id(void) ++{ ++ int res; ++ ++ res = conf_get_yesno(autofs_gbl_sec, NAME_USE_MOUNT_REQUEST_LOG_ID); ++ if (res < 0) ++ res = atoi(DEFAULT_USE_MOUNT_REQUEST_LOG_ID); ++ ++ return res; ++} + + unsigned int conf_amd_mount_section_exists(const char *section) + { +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -141,6 +141,12 @@ The original request to add this log mes + That produces, IMHO, unnecessary noise in the log so a configuration option + has been added to provide the ability to turn it off. The default is "no" + to maintain the current behaviour. ++.TP ++.B use_mount_request_log_id ++.br ++Set whether to use a mount request log id so that log entries for specific ++mount requests can be easily identified in logs that have multiple conncurrent ++requests. Default is don't use mount request log ids. + .SS LDAP Configuration + .P + Configuration settings available are: +--- autofs-5.0.7.orig/redhat/autofs.conf.default.in ++++ autofs-5.0.7/redhat/autofs.conf.default.in +@@ -71,6 +71,13 @@ mount_nfs_default_protocol = 4 + # + # force_standard_program_map_env = no + # ++# use_mount_request_log_id - Set whether to use a mount request log ++# id so that log entries for specific mount ++# requests can be easily identified in logs ++# that have multiple conncurrent requests. ++# ++#use_mount_request_log_id = no ++# + # Define base dn for map dn lookup. + # + # Define server URIs +--- autofs-5.0.7.orig/samples/autofs.conf.default.in ++++ autofs-5.0.7/samples/autofs.conf.default.in +@@ -70,6 +70,13 @@ browse_mode = no + # + # force_standard_program_map_env = no + # ++# use_mount_request_log_id - Set whether to use a mount request log ++# id so that log entries for specific mount ++# requests can be easily identified in logs ++# that have multiple conncurrent requests. ++# ++#use_mount_request_log_id = no ++# + # Define base dn for map dn lookup. + # + # Define server URIs diff --git a/SOURCES/autofs-5.1.2-add-congigure-option-for-limiting-getgrgid_r-stack-usage.patch b/SOURCES/autofs-5.1.2-add-congigure-option-for-limiting-getgrgid_r-stack-usage.patch new file mode 100644 index 0000000..db4c240 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-congigure-option-for-limiting-getgrgid_r-stack-usage.patch @@ -0,0 +1,195 @@ +autofs-5.1.2 - add congigure option for limiting getgrgid_r() stack usage + +From: Ian Kent + +Almost all the time it isn't a problem for glibc to use stack allocation +to store group information during calls to getgrgid_r(). + +But if it is a problem the --enable-limit-getgrgid-size configure option +can be used to limit the buffer size passed to getgrgid_r() (which is used +to decide whether to alloca() local storage for the call). + +The check allows the call to go ahead if the increased buffer size is less +than 0.9 of the thread stack size. + +This isn't ideal because the current stack usage isn't known but should +be ok much of the time. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + configure | 32 +++++++++++++++++++++++++------- + configure.in | 24 +++++++++++++++++------- + include/config.h.in | 3 +++ + lib/mounts.c | 6 ++++-- + 5 files changed, 50 insertions(+), 16 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -249,6 +249,7 @@ + - fix invalid reference in remount_active_mount(). + - increase worker thread per-thread stack size. + - limit getgrgid_r() buffer size. ++- add congigure option for limiting getgrgid_r() stack usage. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/configure ++++ autofs-5.0.7/configure +@@ -743,6 +743,7 @@ enable_ext_env + enable_mount_locking + enable_forced_shutdown + enable_ignore_busy ++enable_limit_getgrgid_size + ' + ac_precious_vars='build_alias + host_alias +@@ -1360,13 +1361,14 @@ Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +- --enable-sloppy-mount enable the use of the -s option to mount +- --disable-ext-env disable search in environment for substitution variable +- --disable-mount-locking disable use of locking when spawning mount command +- --enable-force-shutdown enable USR1 signal to force unlink umount of any +- busy mounts during shutdown +- --enable-ignore-busy enable exit without umounting busy mounts during +- shutdown ++ --enable-sloppy-mount enable the use of the -s option to mount ++ --disable-ext-env disable search in environment for substitution variable ++ --disable-mount-locking disable use of locking when spawning mount command ++ --enable-force-shutdown enable USR1 signal to force unlink umount of any ++ busy mounts during shutdown ++ --enable-ignore-busy enable exit without umounting busy mounts during ++ shutdown ++ --enable-limit-getgrgid-size enable limit stack use of getgrgid_r() + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +@@ -5662,6 +5664,22 @@ $as_echo "#define ENABLE_IGNORE_BUSY_MOU + + fi + ++# ++# Enable exit, ignoring busy mounts. ++# ++# Check whether --enable-limit-getgrgid-size was given. ++if test "${enable_limit_getgrgid_size+set}" = set; then : ++ enableval=$enable_limit_getgrgid_size; ++else ++ enableval=no ++fi ++ ++if test x$enable_limit_getgrgid_size = xyes -o x$enableval = xyes; then ++ ++$as_echo "#define ENABLE_LIMIT_GETGRGID_SIZE 1" >>confdefs.h ++ ++fi ++ + # + # Write Makefile.conf and include/config.h + # +--- autofs-5.0.7.orig/configure.in ++++ autofs-5.0.7/configure.in +@@ -158,7 +158,7 @@ AC_SUBST(sssldir) + # good for portability + # + AC_ARG_ENABLE(sloppy-mount, +-[ --enable-sloppy-mount enable the use of the -s option to mount],, ++[ --enable-sloppy-mount enable the use of the -s option to mount],, + enable_sloppy_mount=auto) + if test x$enable_sloppy_mount = xauto; then + AF_SLOPPY_MOUNT() +@@ -344,7 +344,7 @@ AC_SUBST(DAEMON_LDFLAGS) + # Enable ability to access value in external env variable + # + AC_ARG_ENABLE(ext-env, +-[ --disable-ext-env disable search in environment for substitution variable],, ++[ --disable-ext-env disable search in environment for substitution variable],, + enableval=yes) + if test x$enable_ext_env = xyes -o x$enableval = xyes; then + AC_DEFINE(ENABLE_EXT_ENV, 1, [leave this alone]) +@@ -354,7 +354,7 @@ fi + # Disable use of locking when spawning mount command + # + AC_ARG_ENABLE(mount-locking, +-[ --disable-mount-locking disable use of locking when spawning mount command],, ++[ --disable-mount-locking disable use of locking when spawning mount command],, + enableval=yes) + if test x$enable_mount_locking = xyes -o x$enableval = xyes; then + AC_DEFINE(ENABLE_MOUNT_LOCKING, 1, [Disable use of locking when spawning mount command]) +@@ -364,8 +364,8 @@ fi + # Enable forced shutdown on USR1 signal (unlink umounts all mounts). + # + AC_ARG_ENABLE(forced-shutdown, +-[ --enable-force-shutdown enable USR1 signal to force unlink umount of any +- busy mounts during shutdown],, ++[ --enable-force-shutdown enable USR1 signal to force unlink umount of any ++ busy mounts during shutdown],, + enableval=no) + if test x$enable_forced_shutdown = xyes -o x$enableval = xyes; then + AC_DEFINE(ENABLE_FORCED_SHUTDOWN, 1, [Enable forced shutdown on USR1 signal]) +@@ -375,14 +375,24 @@ fi + # Enable exit, ignoring busy mounts. + # + AC_ARG_ENABLE(ignore-busy, +-[ --enable-ignore-busy enable exit without umounting busy mounts during +- shutdown],, ++[ --enable-ignore-busy enable exit without umounting busy mounts during ++ shutdown],, + enableval=no) + if test x$enable_ignore_busy_mounts = xyes -o x$enableval = xyes; then + AC_DEFINE(ENABLE_IGNORE_BUSY_MOUNTS, 1, [Enable exit, ignoring busy mounts]) + fi + + # ++# Enable exit, ignoring busy mounts. ++# ++AC_ARG_ENABLE(limit-getgrgid-size, ++[ --enable-limit-getgrgid-size enable limit stack use of getgrgid_r()],, ++ enableval=no) ++if test x$enable_limit_getgrgid_size = xyes -o x$enableval = xyes; then ++ AC_DEFINE(ENABLE_LIMIT_GETGRGID_SIZE, 1, [Enable limit stack use of getgrgid_r()]) ++fi ++ ++# + # Write Makefile.conf and include/config.h + # + AC_CONFIG_HEADER(include/config.h) +--- autofs-5.0.7.orig/include/config.h.in ++++ autofs-5.0.7/include/config.h.in +@@ -9,6 +9,9 @@ + /* Enable exit, ignoring busy mounts */ + #undef ENABLE_IGNORE_BUSY_MOUNTS + ++/* Enable limit stack use of getgrgid_r() */ ++#undef ENABLE_LIMIT_GETGRGID_SIZE ++ + /* Disable use of locking when spawning mount command */ + #undef ENABLE_MOUNT_LOCKING + +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1507,8 +1507,10 @@ void set_tsd_user_vars(unsigned int logo + + gr_tmp = NULL; + status = ERANGE; ++#ifdef ENABLE_LIMIT_GETGRGID_SIZE + if (!maxgrpbuf) + maxgrpbuf = detached_thread_stack_size * 0.9; ++#endif + + /* If getting the group name fails go on without it. It's + * used to set an environment variable for program maps +@@ -1532,9 +1534,9 @@ void set_tsd_user_vars(unsigned int logo + tmplen += grplen; + + /* Don't tempt glibc to alloca() larger than is (likely) +- * available on the stack. ++ * available on the stack if limit-getgrgid-size is enabled. + */ +- if (tmplen < maxgrpbuf) ++ if (!maxgrpbuf || (tmplen < maxgrpbuf)) + continue; + + /* Add a message so we know this happened */ diff --git a/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_name.patch b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_name.patch new file mode 100644 index 0000000..2cf4bf0 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_name.patch @@ -0,0 +1,60 @@ +autofs-5.1.2 - add function conf_amd_get_map_name() + +From: Ian Kent + +Add configuration function to get the map_name option from +an amd mount configuration section. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/defaults.h | 1 + + lib/defaults.c | 10 ++++++++++ + 3 files changed, 12 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -225,6 +225,7 @@ + - fix typos in README.amd-maps. + - add ref counting to struct map_source. + - add support for amd browsable option. ++- add function conf_amd_get_map_name(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -191,6 +191,7 @@ char *conf_amd_get_nfs_proto(void); + char *conf_amd_get_nis_domain(void); + unsigned int conf_amd_set_nis_domain(const char *); + char *conf_amd_get_map_defaults(const char *); ++char *conf_amd_get_map_name(const char *); + char *conf_amd_get_map_type(const char *); + char *conf_amd_get_search_path(const char *); + unsigned int conf_amd_get_dismount_interval(const char *); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -105,6 +105,7 @@ + #define NAME_AMD_MAP_DEFAULTS "map_defaults" + #define NAME_AMD_MAP_OPTIONS "map_options" + #define NAME_AMD_MAP_RELOAD_INTERVAL "map_reload_interval" ++#define NAME_AMD_MAP_NAME "map_name" + #define NAME_AMD_MAP_TYPE "map_type" + #define NAME_AMD_MOUNT_TYPE "mount_type" + #define NAME_AMD_PID_FILE "pid_file" +@@ -1914,6 +1915,15 @@ char *conf_amd_get_map_defaults(const ch + + return tmp; + } ++ ++char *conf_amd_get_map_name(const char *section) ++{ ++ char *tmp = NULL; ++ if (section) ++ tmp = conf_get_string(section, NAME_AMD_MAP_NAME); ++ ++ return tmp; ++} + + char *conf_amd_get_map_type(const char *section) + { diff --git a/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_options.patch b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_options.patch new file mode 100644 index 0000000..fd374d3 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_map_options.patch @@ -0,0 +1,64 @@ +autofs-5.1.2 - add function conf_amd_get_map_options() + +From: Ian Kent + +Add configuration function to get the map_options option from +an amd mount configuration section. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/defaults.h | 1 + + lib/defaults.c | 14 ++++++++++++++ + 3 files changed, 16 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -229,6 +229,7 @@ + - add function conf_amd_get_mount_paths(). + - include amd mount sections mounts in master mounts list. + - check for conflicting amd section mounts. ++- add function conf_get_map_options(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -193,6 +193,7 @@ char *conf_amd_get_nis_domain(void); + unsigned int conf_amd_set_nis_domain(const char *); + char *conf_amd_get_map_defaults(const char *); + char *conf_amd_get_map_name(const char *); ++char *conf_amd_get_map_options(const char *); + char *conf_amd_get_map_type(const char *); + char *conf_amd_get_search_path(const char *); + unsigned int conf_amd_get_dismount_interval(const char *); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -493,6 +493,11 @@ static int conf_load_amd_defaults(void) + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_AMD_MAP_OPTIONS, ++ DEFAULT_AMD_MAP_OPTIONS, CONF_NONE); ++ if (ret == CFG_FAIL) ++ goto error; ++ + ret = conf_update(sec, NAME_AMD_MAP_TYPE, + DEFAULT_AMD_MAP_TYPE, CONF_NONE); + if (ret == CFG_FAIL) +@@ -2004,6 +2009,15 @@ char *conf_amd_get_map_name(const char * + + return tmp; + } ++ ++char *conf_amd_get_map_options(const char *section) ++{ ++ char *tmp = NULL; ++ if (section) ++ tmp = conf_get_string(section, NAME_AMD_MAP_OPTIONS); ++ ++ return tmp; ++} + + char *conf_amd_get_map_type(const char *section) + { diff --git a/SOURCES/autofs-5.1.2-add-function-conf_amd_get_mount_paths.patch b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_mount_paths.patch new file mode 100644 index 0000000..94ebfcd --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-function-conf_amd_get_mount_paths.patch @@ -0,0 +1,130 @@ +autofs-5.1.2 - add function conf_amd_get_mount_paths() + +From: Ian Kent + +Add configuration function to get an array of amd mount section +paths. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + include/defaults.h | 1 + lib/defaults.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 82 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -226,6 +226,7 @@ + - add ref counting to struct map_source. + - add support for amd browsable option. + - add function conf_amd_get_map_name(). ++- add function conf_amd_get_mount_paths(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -171,6 +171,7 @@ unsigned int defaults_use_hostname_for_m + unsigned int defaults_disable_not_found_message(void); + + unsigned int conf_amd_mount_section_exists(const char *); ++char **conf_amd_get_mount_paths(void); + char *conf_amd_get_arch(void); + char *conf_amd_get_karch(void); + char *conf_amd_get_os(void); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -763,6 +763,81 @@ static struct conf_option *conf_lookup(c + return co; + } + ++static char **conf_enumerate_amd_mount_sections(void) ++{ ++ struct conf_option *this; ++ unsigned int count; ++ char **paths; ++ char *last; ++ int i, j; ++ ++ last = NULL; ++ count = 0; ++ for (i = 0; i < CFG_TABLE_SIZE; i++) { ++ if (!config->hash[i]) ++ continue; ++ ++ this = config->hash[i]; ++ while (this) { ++ /* Only amd mount section names begin with '/' */ ++ if (*this->section != '/') { ++ this = this->next; ++ continue; ++ } ++ ++ if (!last || ++ strcmp(this->section, last)) ++ count ++; ++ last = this->section; ++ this = this->next; ++ } ++ } ++ ++ if (!count) ++ return NULL; ++ ++ paths = (char **) malloc(((count + 1) * sizeof(char *))); ++ if (!paths) ++ return NULL; ++ memset(paths, 0, ((count + 1) * sizeof(char *))); ++ ++ last = NULL; ++ j = 0; ++ ++ for (i = 0; i < CFG_TABLE_SIZE; i++) { ++ if (!config->hash[i]) ++ continue; ++ ++ this = config->hash[i]; ++ while (this) { ++ /* Only amd mount section names begin with '/' */ ++ if (*this->section != '/') { ++ this = this->next; ++ continue; ++ } ++ ++ if (!last || ++ strcmp(this->section, last)) { ++ char *path = strdup(this->section); ++ if (!path) ++ goto fail; ++ paths[j++] = path; ++ } ++ last = this->section; ++ this = this->next; ++ } ++ } ++ ++ return paths; ++ ++fail: ++ i = 0; ++ while (paths[i]) ++ free(paths[i++]); ++ free(paths); ++ return NULL; ++} ++ + static unsigned int conf_section_exists(const char *section) + { + struct conf_option *co; +@@ -1758,6 +1833,11 @@ unsigned int conf_amd_mount_section_exis + return conf_section_exists(section); + } + ++char **conf_amd_get_mount_paths(void) ++{ ++ return conf_enumerate_amd_mount_sections(); ++} ++ + char *conf_amd_get_arch(void) + { + return conf_get_string(amd_gbl_sec, NAME_AMD_ARCH); diff --git a/SOURCES/autofs-5.1.2-add-master-read-wait-option.patch b/SOURCES/autofs-5.1.2-add-master-read-wait-option.patch new file mode 100644 index 0000000..78dcc22 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-master-read-wait-option.patch @@ -0,0 +1,197 @@ +autofs-5.1.2 - add master read wait option + +From: Ian Kent + +Add command line and configuration options to set the amount of time to +wait for the master map to become available at program start. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 11 +++++++++-- + include/defaults.h | 2 ++ + lib/defaults.c | 17 +++++++++++++++++ + man/autofs.conf.5.in | 5 +++++ + man/automount.8 | 4 ++++ + redhat/autofs.conf.default.in | 7 +++++++ + samples/autofs.conf.default.in | 7 +++++++ + 8 files changed, 52 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -207,6 +207,7 @@ + - fix use-after-free in st_queue_handler(). + - add config option to supress not found log message. + - wait for master map available at start. ++- add master read wait option. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -2082,10 +2082,11 @@ int main(int argc, char *argv[]) + unsigned ghost, logging, daemon_check; + unsigned dumpmaps, foreground, have_global_options; + unsigned master_read; ++ int master_wait; + time_t timeout; + time_t age = time(NULL); + struct rlimit rlim; +- const char *options = "+hp:t:vmdD:fVrO:l:n:CF"; ++ const char *options = "+hp:t:vmdD:fVrO:l:n:CFM"; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"pid-file", 1, 0, 'p'}, +@@ -2102,6 +2103,7 @@ int main(int argc, char *argv[]) + {"set-log-priority", 1, 0, 'l'}, + {"dont-check-daemon", 0, 0, 'C'}, + {"force", 0, 0, 'F'}, ++ {"master-wait", 1, 0, 'M'}, + {0, 0, 0, 0} + }; + +@@ -2122,6 +2124,7 @@ int main(int argc, char *argv[]) + nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check); + + kpkt_len = get_kpkt_len(); ++ master_wait = defaults_get_master_wait(); + timeout = defaults_get_timeout(); + ghost = defaults_get_browse_mode(); + logging = defaults_get_logging(); +@@ -2181,6 +2184,10 @@ int main(int argc, char *argv[]) + dumpmaps = 1; + break; + ++ case 'M': ++ master_wait = getnumopt(optarg, opt); ++ break; ++ + case 'O': + if (!have_global_options) { + global_options = strdup(optarg); +@@ -2502,7 +2509,7 @@ int main(int argc, char *argv[]) + * a signal is received, in which case exit returning an + * error. + */ +- if (!do_master_read_master(master_list, -1)) { ++ if (!do_master_read_master(master_list, master_wait)) { + logerr("%s: failed to read master map!", program); + master_kill(master_list); + release_flag_file(); +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -25,6 +25,7 @@ + #define DEFAULT_MASTER_MAP_NAME "auto.master" + + #define DEFAULT_TIMEOUT "600" ++#define DEFAULT_MASTER_WAIT "-1" + #define DEFAULT_NEGATIVE_TIMEOUT "60" + #define DEFAULT_MOUNT_WAIT "-1" + #define DEFAULT_UMOUNT_WAIT "12" +@@ -152,6 +153,7 @@ void defaults_conf_release(void); + const char *defaults_get_master_map(void); + int defaults_master_set(void); + unsigned int defaults_get_timeout(void); ++int defaults_get_master_wait(void); + unsigned int defaults_get_negative_timeout(void); + unsigned int defaults_get_browse_mode(void); + unsigned int defaults_get_logging(void); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -47,6 +47,7 @@ + #define NAME_MASTER_MAP "master_map_name" + + #define NAME_TIMEOUT "timeout" ++#define NAME_MASTER_WAIT "master_wait" + #define NAME_NEGATIVE_TIMEOUT "negative_timeout" + #define NAME_BROWSE_MODE "browse_mode" + #define NAME_LOGGING "logging" +@@ -287,6 +288,11 @@ static int conf_load_autofs_defaults(voi + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_MASTER_WAIT, ++ DEFAULT_MASTER_WAIT, CONF_ENV); ++ if (ret == CFG_FAIL) ++ goto error; ++ + ret = conf_update(sec, NAME_NEGATIVE_TIMEOUT, + DEFAULT_NEGATIVE_TIMEOUT, CONF_ENV); + if (ret == CFG_FAIL) +@@ -1568,6 +1574,17 @@ unsigned int defaults_get_timeout(void) + return (unsigned int) timeout; + } + ++int defaults_get_master_wait(void) ++{ ++ long wait; ++ ++ wait = conf_get_number(autofs_gbl_sec, NAME_MASTER_WAIT); ++ if (wait < 0) ++ wait = atol(DEFAULT_MASTER_WAIT); ++ ++ return (int) wait; ++} ++ + unsigned int defaults_get_negative_timeout(void) + { + long n_timeout; +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -30,6 +30,11 @@ default is 10 minutes, but the default i + overrides this and sets the timeout to 5 minutes to be consistent + with earlier autofs releases. + .TP ++.B master_wait ++sets the default maximum time to wait for the master map to become ++available if it cannot be read at program start (program default -1, ++wait forever). ++.TP + .B negative_timeout + .br + Set the default timeout for caching failed key lookups (program default +--- autofs-5.0.7.orig/man/automount.8 ++++ autofs-5.0.7/man/automount.8 +@@ -37,6 +37,10 @@ The internal program default is 10 minut + installed configuration overrides this and sets the timeout + to 5 minutes to be consistent with earlier autofs releases. + .TP ++.I "\-M , \-\-master-wait " ++Set the maximum time to wait for the master map to become available ++if it cannot be read at program start. ++.TP + .I "\-n , \-\-negative\-timeout " + Set the default timeout for caching failed key lookups. The default is 60 seconds. + .TP +--- autofs-5.0.7.orig/redhat/autofs.conf.default.in ++++ autofs-5.0.7/redhat/autofs.conf.default.in +@@ -14,6 +14,13 @@ + # + timeout = 300 + # ++# master_wait - set the default maximum time to wait for the ++# master map to become available if it cannot ++# be read at program start (default -1, wait ++# forever). ++# ++#master_wait = -1 ++# + # negative_timeout - set the default negative timeout for + # failed mount attempts (default 60). + # +--- autofs-5.0.7.orig/samples/autofs.conf.default.in ++++ autofs-5.0.7/samples/autofs.conf.default.in +@@ -14,6 +14,13 @@ + # + timeout = 300 + # ++# master_wait - set the default maximum time to wait for the ++# master map to become available if it cannot ++# be read at program start (default -1, wait ++# forever). ++# ++# master_wait = -1 ++# + # negative_timeout - set the default negative timeout for + # failed mount attempts (default 60). + # diff --git a/SOURCES/autofs-5.1.2-add-ref-counting-to-struct-map_source.patch b/SOURCES/autofs-5.1.2-add-ref-counting-to-struct-map_source.patch new file mode 100644 index 0000000..3968130 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-ref-counting-to-struct-map_source.patch @@ -0,0 +1,216 @@ +autofs-5.1.2 - add ref counting to struct map_source + +From: Ian Kent + +amd map format maps that are type "auto" frequently refer to the +current map in their map entries. + +While this isn't a problem for relatively small maps it can be very +wasteful for large maps and even more so for maps that have multi- +component keys that trigger type "auto" mounts as they progress down +the directory tree. + +So add a reference count in order for amd type "auto" mounts to use +the parent map if it matches. + +sun format maps are much less likley to use the same map and if they +do they are usually trivial, one line maps, so it isn't a problem. + +But, more importantly, sun format maps need to track recursive inclusion +and inclusion depth for a given map source when plus map inclusion is +used which prevents the map soucre from being shared. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/indirect.c | 7 ++++- + include/master.h | 3 ++ + lib/master.c | 22 +++++++++++++++++ + modules/mount_autofs.c | 60 ++++++++++++++++++++++++++++++++----------------- + 5 files changed, 72 insertions(+), 21 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -223,6 +223,7 @@ + - fix argc off by one in mount_autofs.c. + - fix _strncmp() usage. + - fix typos in README.amd-maps. ++- add ref counting to struct map_source. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -96,7 +96,12 @@ static int do_mount_autofs_indirect(stru + struct mnt_list *mnts; + int ret; + +- ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; ++ /* If the map is being shared the exp_timeout can't be inherited ++ * from the map source since it may be different so the autofs ++ * point exp_runfreq must have already been set. ++ */ ++ if (ap->entry->maps->ref <= 1) ++ ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; + + if (ops->version && !do_force_unlink) { + ap->flags |= MOUNT_FLAG_REMOUNT; +--- autofs-5.0.7.orig/include/master.h ++++ autofs-5.0.7/include/master.h +@@ -23,6 +23,7 @@ + #define MAP_FLAG_FORMAT_AMD 0x0001 + + struct map_source { ++ unsigned int ref; + unsigned int flags; + char *type; + char *format; +@@ -89,6 +90,8 @@ struct map_source * + master_add_map_source(struct master_mapent *, char *, char *, time_t, int, const char **); + struct map_source * + master_find_map_source(struct master_mapent *, const char *, const char *, int, const char **); ++struct map_source * ++master_get_map_source(struct master_mapent *, const char *, const char *, int, const char **); + void master_free_map_source(struct map_source *, unsigned int); + struct map_source * + master_find_source_instance(struct map_source *, const char *, const char *, int, const char **); +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -180,6 +180,7 @@ master_add_map_source(struct master_mape + if (!source) + return NULL; + memset(source, 0, sizeof(struct map_source)); ++ source->ref = 1; + + if (type) { + ntype = strdup(type); +@@ -231,6 +232,8 @@ master_add_map_source(struct master_mape + + this = __master_find_map_source(entry, type, format, argc, tmpargv); + if (this) { ++ error(entry->ap->logopt, ++ "map source used without taking reference"); + this->age = age; + master_free_map_source(source, 0); + master_source_unlock(entry); +@@ -329,8 +332,27 @@ struct map_source *master_find_map_sourc + return source; + } + ++struct map_source * ++master_get_map_source(struct master_mapent *entry, ++ const char *type, const char *format, ++ int argc, const char **argv) ++{ ++ struct map_source *source = NULL; ++ ++ master_source_readlock(entry); ++ source = __master_find_map_source(entry, type, format, argc, argv); ++ if (source) ++ source->ref++; ++ master_source_unlock(entry); ++ ++ return source; ++} ++ + static void __master_free_map_source(struct map_source *source, unsigned int free_cache) + { ++ /* instance map sources are not ref counted */ ++ if (source->ref && --source->ref) ++ return; + if (source->type) + free(source->type); + if (source->format) +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -208,18 +208,37 @@ int mount_mount(struct autofs_point *ap, + } + if (info->map) + argv[0] = info->map; ++ ++ if (options) { ++ p = options; ++ while ((p = strchr(p, ',')) != NULL) { ++ if (*p == ',') { ++ *p = '\0'; ++ p++; ++ } ++ argv[argc++] = p; ++ } ++ } ++ argv[argc] = NULL; ++ + /* +- * If the parent map format is amd and the format isn't +- * specified in the map entry set it from the parent map +- * source. ++ * For amd type "auto" the map is often re-used so check ++ * if the the parent map can be used and use it if it ++ * matches. ++ * ++ * Also if the parent map format is amd and the format ++ * isn't specified in the map entry set it from the parent ++ * map source. + */ +- if (!info->format && ap->entry->maps) { ++ source = NULL; ++ if (ap->entry->maps && ap->entry->maps->flags & MAP_FLAG_FORMAT_AMD) { + struct map_source *s = ap->entry->maps; ++ + /* + * For amd maps, if the format and source type aren't + * specified try and set them from the parent. + */ +- if (s->flags & MAP_FLAG_FORMAT_AMD) { ++ if (!info->format) { + info->format = strdup("amd"); + if (!info->format) + warn(ap->logopt, MODPREFIX +@@ -231,23 +250,18 @@ int mount_mount(struct autofs_point *ap, + "failed to set amd map type"); + } + } +- } + +- if (options) { +- p = options; +- while ((p = strchr(p, ',')) != NULL) { +- if (*p == ',') { +- *p = '\0'; +- p++; +- } +- argv[argc++] = p; +- } ++ source = master_get_map_source(ap->entry, ++ info->type, info->format, ++ argc, argv); ++ if (source) ++ entry->maps = source; + } +- argv[argc] = NULL; + +- source = master_add_map_source(entry, +- info->type, info->format, +- time(NULL), argc, argv); ++ if (!source) ++ source = master_add_map_source(entry, ++ info->type, info->format, ++ time(NULL), argc, argv); + if (!source) { + error(ap->logopt, + MODPREFIX "failed to add map source to entry"); +@@ -256,7 +270,13 @@ int mount_mount(struct autofs_point *ap, + return 1; + } + free_map_type_info(info); +- source->exp_timeout = timeout; ++ /* The exp_timeout can't be inherited if the map is shared, so ++ * the autofs point exp_runfreq must be set here. ++ */ ++ if (source->ref <= 1) ++ source->exp_timeout = timeout; ++ else ++ nap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; + + mounts_mutex_lock(ap); + diff --git a/SOURCES/autofs-5.1.2-add-sss-master-map-wait-config-option.patch b/SOURCES/autofs-5.1.2-add-sss-master-map-wait-config-option.patch new file mode 100644 index 0000000..a4f6d3d --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-sss-master-map-wait-config-option.patch @@ -0,0 +1,172 @@ +autofs-5.1.2 - add sss master map wait config option + +From: Ian Kent + +When sssd is starting up it can sometimes return "no such entry" for a +short time until it has read in the LDAP map information. This affects +reading the master map at autofs startup and results in no automount +mounts if sssd is the primary map source. + +This problem should be resolved in sssd but it's a problem for the +moment so a configuration option, sss_master_map_wait, has been added +to work around it. + +The internal program default is 0, don't wait. If the work around is +needed try setting this to 10 seconds to work around it. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/defaults.h | 2 ++ + lib/defaults.c | 17 +++++++++++++++++ + man/autofs.conf.5.in | 7 +++++++ + modules/lookup_sss.c | 7 ++++--- + redhat/autofs.conf.default.in | 10 ++++++++++ + samples/autofs.conf.default.in | 10 ++++++++++ + 7 files changed, 51 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -241,6 +241,7 @@ + - factor out set_thread_mount_request_log_id(). + - add config option to use mount request log id. + - work around sss startup delay. ++- add sss master map wait config option. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -51,6 +51,7 @@ + #define DEFAULT_USE_HOSTNAME_FOR_MOUNTS "0" + #define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0" + ++#define DEFAULT_SSS_MASTER_MAP_WAIT "0" + #define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0" + + /* Config entry flags */ +@@ -171,6 +172,7 @@ const char *defaults_get_auth_conf_file( + unsigned int defaults_get_map_hash_table_size(void); + unsigned int defaults_use_hostname_for_mounts(void); + unsigned int defaults_disable_not_found_message(void); ++unsigned int defaults_get_sss_master_map_wait(void); + unsigned int defaults_get_use_mount_request_log_id(void); + + unsigned int conf_amd_mount_section_exists(const char *); +--- autofs-5.0.7.orig/lib/defaults.c ++++ autofs-5.0.7/lib/defaults.c +@@ -76,6 +76,7 @@ + #define NAME_USE_HOSTNAME_FOR_MOUNTS "use_hostname_for_mounts" + #define NAME_DISABLE_NOT_FOUND_MESSAGE "disable_not_found_message" + ++#define NAME_SSS_MASTER_MAP_WAIT "sss_master_map_wait" + #define NAME_USE_MOUNT_REQUEST_LOG_ID "use_mount_request_log_id" + + #define NAME_AMD_ARCH "arch" +@@ -356,6 +357,11 @@ static int conf_load_autofs_defaults(voi + if (ret == CFG_FAIL) + goto error; + ++ ret = conf_update(sec, NAME_SSS_MASTER_MAP_WAIT, ++ DEFAULT_SSS_MASTER_MAP_WAIT, CONF_ENV); ++ if (ret == CFG_FAIL) ++ goto error; ++ + ret = conf_update(sec, NAME_USE_MOUNT_REQUEST_LOG_ID, + DEFAULT_USE_MOUNT_REQUEST_LOG_ID, CONF_ENV); + if (ret == CFG_FAIL) +@@ -1850,6 +1856,17 @@ unsigned int defaults_get_use_mount_requ + + return res; + } ++ ++unsigned int defaults_get_sss_master_map_wait(void) ++{ ++ int res; ++ ++ res = conf_get_yesno(autofs_gbl_sec, NAME_SSS_MASTER_MAP_WAIT); ++ if (res < 0) ++ res = atoi(DEFAULT_SSS_MASTER_MAP_WAIT); ++ ++ return res; ++} + + unsigned int conf_amd_mount_section_exists(const char *section) + { +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -142,6 +142,13 @@ That produces, IMHO, unnecessary noise i + has been added to provide the ability to turn it off. The default is "no" + to maintain the current behaviour. + .TP ++.B sss_master_map_wait ++.br ++Set the time to wait and retry if sssd returns "no such entry" when starting ++up. When sssd is starting up it can sometimes return "no such entry" for a ++short time until it has read in the LDAP map information. Default is 0 seconds, ++don't wait. ++.TP + .B use_mount_request_log_id + .br + Set whether to use a mount request log id so that log entries for specific +--- autofs-5.0.7.orig/modules/lookup_sss.c ++++ autofs-5.0.7/modules/lookup_sss.c +@@ -32,8 +32,6 @@ + + /* Half a second between retries */ + #define SETAUTOMOUNTENT_MASTER_INTERVAL 500000000 +-/* Try for 10 seconds */ +-#define SETAUTOMOUNTENT_MASTER_RETRIES 10 * 2 + + #define MODPREFIX "lookup(sss): " + +@@ -304,7 +302,10 @@ int lookup_read_master(struct master *ma + if (ret != ENOENT) + return NSS_STATUS_UNAVAIL; + +- retries = SETAUTOMOUNTENT_MASTER_RETRIES; ++ retries = defaults_get_sss_master_map_wait() * 2; ++ if (retries <= 0) ++ return NSS_STATUS_NOTFOUND; ++ + ret = setautomntent_wait(logopt, + ctxt, ctxt->mapname, &sss_ctxt, + retries); +--- autofs-5.0.7.orig/redhat/autofs.conf.default.in ++++ autofs-5.0.7/redhat/autofs.conf.default.in +@@ -173,6 +173,16 @@ mount_nfs_default_protocol = 4 + # + #disable_not_found_message = "no" + # ++# sss_master_map_wait - When sssd is starting up it can sometimes return ++# "no such entry" for a short time until it has read ++# in the LDAP map information. Internal default is 0 ++# seconds, don't wait but if there is a problem with ++# autofs not finding the master map at startup (when ++# it should) then try setting this to 10 to work ++# around it. ++# ++#sss_master_map_wait = 0 ++# + # Otions for the amd parser within autofs. + # + # amd configuration options that are aren't used, haven't been +--- autofs-5.0.7.orig/samples/autofs.conf.default.in ++++ autofs-5.0.7/samples/autofs.conf.default.in +@@ -172,6 +172,16 @@ browse_mode = no + # + #disable_not_found_message = "no" + # ++# sss_master_map_wait - When sssd is starting up it can sometimes return ++# "no such entry" for a short time until it has read ++# in the LDAP map information. Internal default is 0 ++# seconds, don't wait but if there is a problem with ++# autofs not finding the master map at startup (when ++# it should) then try setting this to 10 to work ++# around it. ++# ++#sss_master_map_wait = 0 ++# + # Otions for the amd parser within autofs. + # + # amd configuration options that are aren't used, haven't been diff --git a/SOURCES/autofs-5.1.2-add-support-for-amd-browsable-option.patch b/SOURCES/autofs-5.1.2-add-support-for-amd-browsable-option.patch new file mode 100644 index 0000000..2570d29 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-support-for-amd-browsable-option.patch @@ -0,0 +1,355 @@ +autofs-5.1.2 - add support for amd browsable option + +From: Ian Kent + +Add support for the "browsable_dirs" configuration option and the +pseudo mount option "browsable" of amd format maps. + +Note that support for the configuration option "browsable_dirs = full" +and the pseudo mount option "fullybrowsable" of type auto map entries +cannot be implemented using the existing kernel to user space autofs +implementation. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + README.amd-maps | 2 + daemon/lookup.c | 106 ++++++++++++++++++++++++++++++++--------- + lib/master_parse.y | 14 ++++- + man/autofs.conf.5.in | 7 ++ + modules/amd_parse.y | 3 - + modules/mount_autofs.c | 8 +-- + modules/parse_amd.c | 2 + redhat/autofs.conf.default.in | 7 +- + samples/autofs.conf.default.in | 7 +- + 10 files changed, 120 insertions(+), 37 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -224,6 +224,7 @@ + - fix _strncmp() usage. + - fix typos in README.amd-maps. + - add ref counting to struct map_source. ++- add support for amd browsable option. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/README.amd-maps ++++ autofs-5.0.7/README.amd-maps +@@ -101,7 +101,7 @@ What hasn't been implemented + ---------------------------- + + The configuration options fully_qualified_hosts, unmount_on_exit and +-browsable_dirs (and a couple of others) aren't implemented. ++browsable_dirs = full (and a couple of others) aren't implemented. + + Map types (sources) ndbm, passwd are not implemented. + The map source "sss" can't be used for amd format maps. +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -663,6 +663,56 @@ int lookup_nss_read_map(struct autofs_po + return 0; + } + ++static char *make_browse_path(unsigned int logopt, ++ const char *root, const char *key, ++ const char *prefix) ++{ ++ unsigned int l_prefix; ++ unsigned int k_len, r_len; ++ char *k_start; ++ char *path; ++ ++ k_start = (char *) key; ++ k_len = strlen(key); ++ l_prefix = 0; ++ ++ if (prefix) { ++ l_prefix = strlen(prefix); ++ ++ if (l_prefix > k_len) ++ return NULL; ++ ++ /* If the prefix doesn't match the beginning ++ * of the key this entry isn't a sub directory ++ * at this level. ++ */ ++ if (strncmp(key, prefix, l_prefix)) ++ return NULL; ++ ++ /* Directory entry starts following the prefix */ ++ k_start += l_prefix; ++ } ++ ++ /* No remaining "/" allowed here */ ++ if (strchr(k_start, '/')) ++ return NULL; ++ ++ r_len = strlen(root); ++ ++ if ((r_len + strlen(k_start)) > KEY_MAX_LEN) ++ return NULL; ++ ++ path = malloc(r_len + k_len + 2); ++ if (!path) { ++ warn(logopt, "failed to allocate full path"); ++ return NULL; ++ } ++ ++ sprintf(path, "%s/%s", root, k_start); ++ ++ return path; ++} ++ + int lookup_ghost(struct autofs_point *ap, const char *root) + { + struct master_mapent *entry = ap->entry; +@@ -706,10 +756,19 @@ int lookup_ghost(struct autofs_point *ap + if (!me->mapent) + goto next; + +- if (!strcmp(me->key, "*")) ++ /* Wildcard cannot be a browse directory and amd map ++ * keys may end with the wildcard. ++ */ ++ if (strchr(me->key, '*')) + goto next; + ++ /* This will also take care of amd "/defaults" entry as ++ * amd map keys are not allowd to start with "/" ++ */ + if (*me->key == '/') { ++ if (map->flags & MAP_FLAG_FORMAT_AMD) ++ goto next; ++ + /* It's a busy multi-mount - leave till next time */ + if (list_empty(&me->multi_list)) + error(ap->logopt, +@@ -717,12 +776,10 @@ int lookup_ghost(struct autofs_point *ap + goto next; + } + +- fullpath = malloc(strlen(me->key) + strlen(root) + 3); +- if (!fullpath) { +- warn(ap->logopt, "failed to allocate full path"); ++ fullpath = make_browse_path(ap->logopt, ++ root, me->key, ap->pref); ++ if (!fullpath) + goto next; +- } +- sprintf(fullpath, "%s/%s", root, me->key); + + ret = stat(fullpath, &st); + if (ret == -1 && errno != ENOENT) { +@@ -732,6 +789,17 @@ int lookup_ghost(struct autofs_point *ap + goto next; + } + ++ /* Directory already exists? */ ++ if (!ret) { ++ /* Shouldn't need this ++ me->dev = st.st_dev; ++ me->ino = st.st_ino; ++ */ ++ debug(ap->logopt, "me->dev %d me->ino %d", me->dev, me->ino); ++ free(fullpath); ++ goto next; ++ } ++ + ret = mkdir_path(fullpath, 0555); + if (ret < 0 && errno != EEXIST) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); +@@ -1238,28 +1306,23 @@ void lookup_close_lookup(struct autofs_p + return; + } + +-static char *make_fullpath(const char *root, const char *key) ++static char *make_fullpath(struct autofs_point *ap, const char *key) + { ++ char *path = NULL; + int l; +- char *path; + +- if (*key == '/') { ++ if (*key != '/') ++ path = make_browse_path(ap->logopt, ap->path, key, ap->pref); ++ else { + l = strlen(key) + 1; + if (l > KEY_MAX_LEN) +- return NULL; ++ goto out; + path = malloc(l); + if (!path) +- return NULL; ++ goto out; + strcpy(path, key); +- } else { +- l = strlen(key) + 1 + strlen(root) + 1; +- if (l > KEY_MAX_LEN) +- return NULL; +- path = malloc(l); +- if (!path) +- return NULL; +- sprintf(path, "%s/%s", root, key); + } ++out: + return path; + } + +@@ -1290,13 +1353,14 @@ void lookup_prune_one_cache(struct autof + + key = strdup(me->key); + me = cache_enumerate(mc, me); +- if (!key || !strcmp(key, "*")) { ++ /* Don't consider any entries with a wildcard */ ++ if (!key || strchr(key, '*')) { + if (key) + free(key); + continue; + } + +- path = make_fullpath(ap->path, key); ++ path = make_fullpath(ap, key); + if (!path) { + warn(ap->logopt, "can't malloc storage for path"); + free(key); +--- autofs-5.0.7.orig/lib/master_parse.y ++++ autofs-5.0.7/lib/master_parse.y +@@ -806,14 +806,22 @@ int master_parse_entry(const char *buffe + + if (format && !strcmp(format, "amd")) { + unsigned int loglevel = conf_amd_get_log_options(); ++ unsigned int flags = conf_amd_get_flags(path); ++ + if (loglevel <= LOG_DEBUG && loglevel > LOG_INFO) + logopt = LOGOPT_DEBUG; + else if (loglevel <= LOG_INFO && loglevel > LOG_ERR) + logopt = LOGOPT_VERBOSE; +- /* amd mounts don't support browse mode */ +- ghost = 0; +- } + ++ /* It isn't possible to provide the fullybrowsable amd ++ * browsing functionality within the autofs framework. ++ * This flag will not be set if browsable_dirs = full ++ * in the configuration or fullybrowsable is present as ++ * an option. ++ */ ++ if (flags & CONF_BROWSABLE_DIRS) ++ ghost = 1; ++ } + + if (timeout < 0) { + /* +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -348,7 +348,12 @@ and that will be done. + .TP + .B browsable_dirs + .br +-Not yet implemented. ++Allow map keys to be shown in directory listings. This option ++can have values of "yes" or "no". The default is "no". A variation ++of this option, "browsable", can be used as a pseudo mount option ++in type "auto" map entries to provide provide browsing funtionality ++in sub-mounts. The amd "browsable_dirs = full" option cannot be ++implemented within the current autofs framework and is not supported. + .TP + .B exec_map_timeout + .br +--- autofs-5.0.7.orig/modules/amd_parse.y ++++ autofs-5.0.7/modules/amd_parse.y +@@ -432,8 +432,7 @@ option_assignment: MAP_OPTION OPTION_ASS + + options: OPTION + { +- if (!strcmp($1, "browsable") || +- !strcmp($1, "fullybrowsable") || ++ if (!strcmp($1, "fullybrowsable") || + !strcmp($1, "nounmount") || + !strcmp($1, "unmount")) { + sprintf(msg_buf, "option %s is not currently " +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -121,11 +121,13 @@ int mount_mount(struct autofs_point *ap, + while (*comma != '\0' && *comma != ',') + comma++; + +- if (_strncmp("nobrowse", cp, 8) == 0) ++ if (_strncmp("nobrowse", cp, 8) == 0 || ++ _strncmp("nobrowsable", cp, 11) == 0) + ghost = 0; + else if (_strncmp("nobind", cp, 6) == 0) + nobind = 1; +- else if (_strncmp("browse", cp, 6) == 0) ++ else if (_strncmp("browse", cp, 6) == 0 || ++ _strncmp("browsable", cp, 9) == 0) + ghost = 1; + else if (_strncmp("symlink", cp, 7) == 0) + symlnk = 1; +@@ -286,8 +288,6 @@ int mount_mount(struct autofs_point *ap, + nap->pref = am_entry->pref; + am_entry->pref = NULL; + } +- /* amd mounts don't support browse mode */ +- nap->flags &= ~MOUNT_FLAG_GHOST; + } + + if (handle_mounts_startup_cond_init(&suc)) { +--- autofs-5.0.7.orig/modules/parse_amd.c ++++ autofs-5.0.7/modules/parse_amd.c +@@ -932,7 +932,7 @@ static int do_auto_mount(struct autofs_p + } + + return do_mount(ap, ap->path, +- name, strlen(name), target, "autofs", NULL); ++ name, strlen(name), target, "autofs", entry->opts); + } + + static int do_link_mount(struct autofs_point *ap, const char *name, +--- autofs-5.0.7.orig/redhat/autofs.conf.default.in ++++ autofs-5.0.7/redhat/autofs.conf.default.in +@@ -264,8 +264,6 @@ mount_nfs_default_protocol = 4 + # is a sensible option to implement and that will be + # done. + # +-# browsable_dirs - not yet implemented. +-# + # exec_map_timeout - a timeout is not currently used for + # for program maps, might be implemented. + # +@@ -308,6 +306,11 @@ mount_nfs_default_protocol = 4 + # takes its default value from the autofs internal default + # of 600 seconds. + # ++# browsable_dirs - make map keys visible in directory listings. ++# Note that support for the "fullybrowsable" option cannot ++# be added using the existing kernel to user space autofs ++# implementation. ++# + # autofs_use_lofs - if set to "yes" autofs will attempt to use bind + # mounts for type "auto" when possible. + # +--- autofs-5.0.7.orig/samples/autofs.conf.default.in ++++ autofs-5.0.7/samples/autofs.conf.default.in +@@ -263,8 +263,6 @@ browse_mode = no + # is a sensible option to implement and that will be + # done. + # +-# browsable_dirs - not yet implemented. +-# + # exec_map_timeout - a timeout is not currently used for + # for program maps, might be implemented. + # +@@ -307,6 +305,11 @@ browse_mode = no + # takes its default value from the autofs internal default + # of 600 seconds. + # ++# browsable_dirs - make map keys visible in directory listings. ++# Note that support for the "fullybrowsable" option cannot ++# be added using the existing kernel to user space autofs ++# implementation. ++# + # autofs_use_lofs - if set to "yes" autofs will attempt to use bind + # mounts for type "auto" when possible. + # diff --git a/SOURCES/autofs-5.1.2-add-the-mount-requestor-s-pid-to-pending_args.patch b/SOURCES/autofs-5.1.2-add-the-mount-requestor-s-pid-to-pending_args.patch new file mode 100644 index 0000000..0d7d077 --- /dev/null +++ b/SOURCES/autofs-5.1.2-add-the-mount-requestor-s-pid-to-pending_args.patch @@ -0,0 +1,56 @@ +autofs-5.1.2 - add the mount requestor's pid to pending_args + +From: Lars R. Damerow + +This will make it easier to log more information about the requesting +process as the mount request proceeds. + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 1 + + daemon/indirect.c | 1 + + include/automount.h | 1 + + 4 files changed, 4 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -235,6 +235,7 @@ + - handle amd cache option all in amd type auto mounts. + - fix bogus check in expire_cleanup(). + - delay submount exit for amd submounts. ++- add the mount requestor's pid to pending_args. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -1465,6 +1465,7 @@ int handle_packet_missing_direct(struct + mt->type = NFY_MOUNT; + mt->uid = pkt->uid; + mt->gid = pkt->gid; ++ mt->pid = pkt->pid; + mt->wait_queue_token = pkt->wait_queue_token; + + status = pthread_create(&thid, &th_attr_detached, do_mount_direct, mt); +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -860,6 +860,7 @@ int handle_packet_missing_indirect(struc + mt->dev = pkt->dev; + mt->uid = pkt->uid; + mt->gid = pkt->gid; ++ mt->pid = pkt->pid; + mt->wait_queue_token = pkt->wait_queue_token; + + status = pthread_create(&thid, &th_attr_detached, do_mount_indirect, mt); +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -425,6 +425,7 @@ struct pending_args { + unsigned int len; /* Name field len */ + uid_t uid; /* uid of requestor */ + gid_t gid; /* gid of requestor */ ++ pid_t pid; /* pid of requestor */ + unsigned long wait_queue_token; /* Associated kernel wait token */ + }; + diff --git a/SOURCES/autofs-5.1.2-capture-cache-option-and-its-settings-during-parsing.patch b/SOURCES/autofs-5.1.2-capture-cache-option-and-its-settings-during-parsing.patch new file mode 100644 index 0000000..239c133 --- /dev/null +++ b/SOURCES/autofs-5.1.2-capture-cache-option-and-its-settings-during-parsing.patch @@ -0,0 +1,86 @@ +autofs-5.1.2 - capture cache option and its settings during parsing + +From: Ian Kent + +The amd map format parser was not aware of the optional sync +parameter of the cache option. + +Make the parser aware of the sync option and capture the cache +option and its settings during map parsing. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/parse_amd.h | 7 +++++++ + modules/amd_parse.y | 12 +++++++++--- + modules/amd_tok.l | 2 +- + 4 files changed, 18 insertions(+), 4 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -230,6 +230,7 @@ + - include amd mount sections mounts in master mounts list. + - check for conflicting amd section mounts. + - add function conf_get_map_options(). ++- capture cache option and its settings during parsing. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/parse_amd.h ++++ autofs-5.0.7/include/parse_amd.h +@@ -39,9 +39,16 @@ + #define AMD_DEFAULTS_RESET 0x02000000 + #define AMD_DEFAULTS_MASK 0xff000000 + ++#define AMD_CACHE_OPTION_NONE 0x0000 ++#define AMD_CACHE_OPTION_INC 0x0001 ++#define AMD_CACHE_OPTION_ALL 0x0002 ++#define AMD_CACHE_OPTION_REGEXP 0x0004 ++#define AMD_CACHE_OPTION_SYNC 0x8000 ++ + struct amd_entry { + char *path; + unsigned long flags; ++ unsigned int cache_opts; + char *type; + char *map_type; + char *pref; +--- autofs-5.0.7.orig/modules/amd_parse.y ++++ autofs-5.0.7/modules/amd_parse.y +@@ -424,9 +424,14 @@ option_assignment: MAP_OPTION OPTION_ASS + } + | MAP_OPTION OPTION_ASSIGN CACHE_OPTION + { +- sprintf(msg_buf, "option %s is not used, autofs " +- "default caching is always used", $1); +- amd_info(msg_buf); ++ if (strncmp($3, "inc", 3)) ++ entry.cache_opts = AMD_CACHE_OPTION_INC; ++ else if (strncmp($3, "all", 3)) ++ entry.cache_opts = AMD_CACHE_OPTION_ALL; ++ else if (strncmp($3, "re", 2)) ++ entry.cache_opts = AMD_CACHE_OPTION_REGEXP; ++ if (strstr($3, "sync")) ++ entry.cache_opts |= AMD_CACHE_OPTION_SYNC; + } + ; + +@@ -534,6 +539,7 @@ static int amd_msg(const char *s) + static void local_init_vars(void) + { + memset(&entry, 0, sizeof(entry)); ++ entry.cache_opts = AMD_CACHE_OPTION_NONE; + memset(opts, 0, sizeof(opts)); + } + +--- autofs-5.0.7.orig/modules/amd_tok.l ++++ autofs-5.0.7/modules/amd_tok.l +@@ -101,7 +101,7 @@ NOPT ({SSTR}|(({IP4ADDR}(\/{V4MASK})?)| + MAPOPT (fs|type|maptype|pref|sublink|cache) + MNTOPT (opts|addopts|remopts) + FSOPTS (rhost|rfs|dev|cachedir|mount|unmount|umount|delay) +-CHEOPT (mapdefault|none|inc|re|regexp|all) ++CHEOPT ((mapdefault|none|inc|re|regexp|all)(,sync)?) + MAPTYPE (file|nis|nisplus|ldap|hesiod|exec|ndbm|passwd|union) + FSTYPE_LOCAL (link|linkx|lofs|ufs|ext2|ext3|ext4|xfs|jfs|cdfs|cachefs) + FSTYPE_NET (nfs|nfsx|nfsl|host) diff --git a/SOURCES/autofs-5.1.2-check-NFS-server-availability-on-local-mount-fallback.patch b/SOURCES/autofs-5.1.2-check-NFS-server-availability-on-local-mount-fallback.patch new file mode 100644 index 0000000..1a12258 --- /dev/null +++ b/SOURCES/autofs-5.1.2-check-NFS-server-availability-on-local-mount-fallback.patch @@ -0,0 +1,96 @@ +autofs-5.1.2 - check NFS server availability on local mount fallback + +From: Ian Kent + +The availability probe isn't done for anything autofs thinks is a +local mount because it's the local machine. + +It first tries a bind mount and if that fails it falls back to trying +a local NFS mount. If the local NFS server is not running mount.nfs(8) +can suffer a lengthy timeout. + +So check for the bind mount fallback case and check if an NFS server +is responding before trying the mount. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/rpc_subs.c | 11 +++++++++++ + modules/mount_nfs.c | 15 ++++++++++++++- + 3 files changed, 26 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -215,6 +215,7 @@ + - make lookup_nss_read_master() return nss status. + - make set_direct_mount_catatonic() more general. + - set autofs mounts catatonic at exit. ++- check NFS server availability on local mount fallback. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -1053,6 +1053,7 @@ static int __rpc_ping(const char *host, + + int rpc_ping(const char *host, long seconds, long micros, unsigned int option) + { ++ unsigned long vers4 = NFS4_VERSION; + unsigned long vers3 = NFS3_VERSION; + unsigned long vers2 = NFS2_VERSION; + int status; +@@ -1065,6 +1066,12 @@ int rpc_ping(const char *host, long seco + if (status > 0) + return RPC_PING_V3 | RPC_PING_UDP; + ++ /* UDP isn't recommended for NFSv4, don't bother checking it. ++ status = __rpc_ping(host, vers4, IPPROTO_UDP, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V4 | RPC_PING_UDP; ++ */ ++ + status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option); + if (status > 0) + return RPC_PING_V2 | RPC_PING_TCP; +@@ -1073,6 +1080,10 @@ int rpc_ping(const char *host, long seco + if (status > 0) + return RPC_PING_V3 | RPC_PING_TCP; + ++ status = __rpc_ping(host, vers4, IPPROTO_TCP, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V4 | RPC_PING_TCP; ++ + return status; + } + +--- autofs-5.0.7.orig/modules/mount_nfs.c ++++ autofs-5.0.7/modules/mount_nfs.c +@@ -347,6 +347,19 @@ dont_probe: + strcat(loc, ":"); + strcat(loc, this->path); + ++ /* If this is a fallback from a bind mount failure ++ * check if the local NFS server is available to try ++ * and prevent lengthy mount failure waits. ++ */ ++ if (this->proximity == PROXIMITY_LOCAL) { ++ char *host = this->name ? this->name : "localhost"; ++ int ret; ++ ++ ret = rpc_ping(host, 2, 0, RPC_CLOSE_DEFAULT); ++ if (ret <= 0) ++ goto next; ++ } ++ + if (nfsoptions && *nfsoptions) { + debug(ap->logopt, + MODPREFIX "calling mount -t %s " SLOPPY +@@ -369,7 +382,7 @@ dont_probe: + free_host_list(&hosts); + return 0; + } +- ++next: + free(loc); + this = this->next; + } diff --git a/SOURCES/autofs-5.1.2-check-for-conflicting-amd-section-mounts.patch b/SOURCES/autofs-5.1.2-check-for-conflicting-amd-section-mounts.patch new file mode 100644 index 0000000..6a7ea94 --- /dev/null +++ b/SOURCES/autofs-5.1.2-check-for-conflicting-amd-section-mounts.patch @@ -0,0 +1,113 @@ +autofs-5.1.2 - check for conflicting amd section mounts + +From: Ian Kent + +Allowing the addition of amd section mounts to the master mounts list +can lead to conflicting mount point paths. + +Check for conflicts and skip the amd mount section mounts if a conflict +with the master map mounts is found. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + include/master.h | 1 + lib/master.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- + 3 files changed, 58 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -228,6 +228,7 @@ + - add function conf_amd_get_map_name(). + - add function conf_amd_get_mount_paths(). + - include amd mount sections mounts in master mounts list. ++- check for conflicting amd section mounts. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/master.h ++++ autofs-5.0.7/include/master.h +@@ -106,6 +106,7 @@ void master_source_lock_cleanup(void *); + void master_source_current_wait(struct master_mapent *); + void master_source_current_signal(struct master_mapent *); + struct master_mapent *master_find_mapent(struct master *, const char *); ++unsigned int master_partial_match_mapent(struct master *, const char *); + struct autofs_point *__master_find_submount(struct autofs_point *, const char *); + struct autofs_point *master_find_submount(struct autofs_point *, const char *); + struct amd_entry *__master_find_amdmount(struct autofs_point *, const char *); +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -710,6 +710,53 @@ struct master_mapent *master_find_mapent + return NULL; + } + ++unsigned int master_partial_match_mapent(struct master *master, const char *path) ++{ ++ struct list_head *head, *p; ++ size_t path_len = strlen(path); ++ int ret = 0; ++ ++ head = &master->mounts; ++ list_for_each(p, head) { ++ struct master_mapent *entry; ++ size_t entry_len; ++ size_t cmp_len; ++ ++ entry = list_entry(p, struct master_mapent, list); ++ ++ entry_len = strlen(entry->path); ++ cmp_len = min(entry_len, path_len); ++ ++ if (!strncmp(entry->path, path, cmp_len)) { ++ /* paths are equal, matching master map entry ? */ ++ if (entry_len == path_len) { ++ if (entry->maps && ++ entry->maps->flags & MAP_FLAG_FORMAT_AMD) ++ ret = 1; ++ else ++ ret = -1; ++ break; ++ } ++ ++ /* amd mount conflicts with entry mount */ ++ if (entry_len > path_len && ++ *(entry->path + path_len) == '/') { ++ ret = -1; ++ break; ++ } ++ ++ /* entry mount conflicts with amd mount */ ++ if (entry_len < path_len && ++ *(path + entry_len) == '/') { ++ ret = -1; ++ break; ++ } ++ } ++ } ++ ++ return ret; ++} ++ + struct autofs_point *__master_find_submount(struct autofs_point *ap, const char *path) + { + struct list_head *head, *p; +@@ -936,10 +983,16 @@ static void master_add_amd_mount_section + char *type = NULL; + char *map = NULL; + +- entry = master_find_mapent(master, path); +- if (entry) { ++ ret = master_partial_match_mapent(master, path); ++ if (ret) { ++ /* If this amd entry is already present in the ++ * master map it's not a duplicate, don't issue ++ * an error message. ++ */ ++ if (ret == 1) ++ goto next; + info(m_logopt, +- "ignoring duplicate amd section mount %s", ++ "amd section mount path conflict, %s ignored", + path); + goto next; + } diff --git a/SOURCES/autofs-5.1.2-create-thread-local-ID-for-mount-attempts.patch b/SOURCES/autofs-5.1.2-create-thread-local-ID-for-mount-attempts.patch new file mode 100644 index 0000000..84a130c --- /dev/null +++ b/SOURCES/autofs-5.1.2-create-thread-local-ID-for-mount-attempts.patch @@ -0,0 +1,177 @@ +autofs-5.1.2 - create thread-local ID for mount attempts + +From: Lars R. Damerow + +This patch creates key_thread_attempt_id as a pthread key and populates it +in each new thread serving a mount attempt. This ID can be used in output logs +as an easy string to grep for, allowing admins to quickly see a mount attempt's +log entries without the messages from other attempts interleaved. + +The contents of the ID are intended to be opaque, but to get a chance at +a unique value for each mount attempt, this patch does a very simple hash +computation of the thread's wait_queue_token, the pid of the requesting +process, and the key for the mount. The hash is based on the public domain +sdbm library. + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 24 ++++++++++++++++++++++++ + daemon/direct.c | 17 +++++++++++++++++ + daemon/indirect.c | 17 +++++++++++++++++ + include/automount.h | 6 ++++++ + 5 files changed, 65 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -236,6 +236,7 @@ + - fix bogus check in expire_cleanup(). + - delay submount exit for amd submounts. + - add the mount requestor's pid to pending_args. ++- create thread-local ID for mount attempts. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -89,6 +89,7 @@ struct startup_cond suc = { + PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0}; + + pthread_key_t key_thread_stdenv_vars; ++pthread_key_t key_thread_attempt_id = (pthread_key_t) 0L; + + #define MAX_OPEN_FILES 10240 + +@@ -98,6 +99,17 @@ static int umount_all(struct autofs_poin + + extern struct master *master_list; + ++/* simple string hash based on public domain sdbm library */ ++unsigned long sdbm_hash(const char *str, unsigned long seed) ++{ ++ unsigned long hash = seed; ++ char c; ++ ++ while ((c = *str++)) ++ hash = c + (hash << 6) + (hash << 16) - hash; ++ return hash; ++} ++ + static int do_mkdir(const char *parent, const char *path, mode_t mode) + { + int status; +@@ -2441,6 +2453,18 @@ int main(int argc, char *argv[]) + program); + master_kill(master_list); + res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ release_flag_file(); ++ macro_free_global_table(); ++ exit(1); ++ } ++ ++ status = pthread_key_create(&key_thread_attempt_id, free); ++ if (status) { ++ logerr("%s: failed to create thread data key for attempt ID!", ++ program); ++ master_kill(master_list); ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); + close(start_pipefd[1]); + release_flag_file(); + macro_free_global_table(); +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -1210,6 +1210,8 @@ static void *do_mount_direct(void *arg) + struct autofs_point *ap; + struct stat st; + int status, state; ++ char attempt_id_comp[20]; ++ unsigned long *attempt_id; + + args = (struct pending_args *) arg; + +@@ -1219,6 +1221,21 @@ static void *do_mount_direct(void *arg) + + ap = mt.ap; + ++ attempt_id = pthread_getspecific(key_thread_attempt_id); ++ if (attempt_id == NULL) { ++ attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); ++ if (attempt_id == NULL) ++ fatal(ENOMEM); ++ snprintf(attempt_id_comp, 20, "%ld", mt.wait_queue_token); ++ *attempt_id = sdbm_hash(attempt_id_comp, 0); ++ snprintf(attempt_id_comp, 20, "%u", mt.pid); ++ *attempt_id = sdbm_hash(attempt_id_comp, *attempt_id); ++ *attempt_id = sdbm_hash(mt.name, *attempt_id); ++ status = pthread_setspecific(key_thread_attempt_id, attempt_id); ++ if (status != 0) ++ fatal(status); ++ } ++ + args->signaled = 1; + status = pthread_cond_signal(&args->cond); + if (status) +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -726,6 +726,8 @@ static void *do_mount_indirect(void *arg + char buf[PATH_MAX + 1]; + struct stat st; + int len, status, state; ++ char attempt_id_comp[20]; ++ unsigned long *attempt_id; + + args = (struct pending_args *) arg; + +@@ -735,6 +737,21 @@ static void *do_mount_indirect(void *arg + + ap = mt.ap; + ++ attempt_id = pthread_getspecific(key_thread_attempt_id); ++ if (attempt_id == NULL) { ++ attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); ++ if (attempt_id == NULL) ++ fatal(ENOMEM); ++ snprintf(attempt_id_comp, 20, "%ld", mt.wait_queue_token); ++ *attempt_id = sdbm_hash(attempt_id_comp, 0); ++ snprintf(attempt_id_comp, 20, "%u", mt.pid); ++ *attempt_id = sdbm_hash(attempt_id_comp, *attempt_id); ++ *attempt_id = sdbm_hash(mt.name, *attempt_id); ++ status = pthread_setspecific(key_thread_attempt_id, attempt_id); ++ if (status != 0) ++ fatal(status); ++ } ++ + args->signaled = 1; + status = pthread_cond_signal(&args->cond); + if (status) +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -76,6 +76,8 @@ int load_autofs4_module(void); + #define SMB_SUPER_MAGIC 0x0000517BL + #define CIFS_MAGIC_NUMBER 0xFF534D42L + ++#define ATTEMPT_ID_SIZE 24 ++ + /* This sould be enough for at least 20 host aliases */ + #define HOST_ENT_BUF_SIZE 2048 + +@@ -241,6 +243,8 @@ const char **copy_argv(int argc, const c + int compare_argv(int argc1, const char **argv1, int argc2, const char **argv2); + int free_argv(int argc, const char **argv); + ++unsigned long sdbm_hash(const char *str, unsigned long seed); ++ + void dump_core(void); + int aquire_lock(void); + void release_lock(void); +@@ -480,6 +484,8 @@ struct thread_stdenv_vars { + + extern pthread_key_t key_thread_stdenv_vars; + ++extern pthread_key_t key_thread_attempt_id; ++ + struct kernel_mod_version { + unsigned int major; + unsigned int minor; diff --git a/SOURCES/autofs-5.1.2-delay-submount-exit-for-amd-submounts.patch b/SOURCES/autofs-5.1.2-delay-submount-exit-for-amd-submounts.patch new file mode 100644 index 0000000..557fae9 --- /dev/null +++ b/SOURCES/autofs-5.1.2-delay-submount-exit-for-amd-submounts.patch @@ -0,0 +1,59 @@ +autofs-5.1.2 - delay submount exit for amd submounts + +From: Ian Kent + +For amd format maps it's better to not expire away submounts (amd +type "auto" mounts) straight way. + +This is because of the common heavy reuse of maps in amd maps and +we want to try and avoid constantly re-reading large maps. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/state.c | 18 +++++++++++++++--- + 2 files changed, 16 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -234,6 +234,7 @@ + - handle map_option cache for top level mounts. + - handle amd cache option all in amd type auto mounts. + - fix bogus check in expire_cleanup(). ++- delay submount exit for amd submounts. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/state.c ++++ autofs-5.0.7/daemon/state.c +@@ -132,15 +132,27 @@ void expire_cleanup(void *arg) + * mount expires in a reasonable time. Just skip + * one expire check after it's no longer busy before + * allowing it to shutdown. ++ * ++ * But if this mount point is an amd format map it ++ * is better to keep the mount around longer. This ++ * is because of the common heavy reuse of maps in ++ * amd maps and we want to try and avoid constantly ++ * re-reading large maps. + */ + if (ap->submount && !success) { + rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle); + if (!rv && idle && ap->submount > 1) { +- next = ST_SHUTDOWN_PENDING; +- break; ++ struct map_source *map = ap->entry->maps; ++ ++ if (ap->submount > 4 || ++ !(map->flags & MAP_FLAG_FORMAT_AMD)) { ++ next = ST_SHUTDOWN_PENDING; ++ break; ++ } + } + ap->submount++; +- } ++ } else if (ap->submount > 1) ++ ap->submount = 1; + + if (ap->state == ST_EXPIRE && !ap->submount) + alarm_add(ap, ap->exp_runfreq); diff --git a/SOURCES/autofs-5.1.2-dont-fail-on-master-map-read-fail-timeout.patch b/SOURCES/autofs-5.1.2-dont-fail-on-master-map-read-fail-timeout.patch new file mode 100644 index 0000000..e4ed574 --- /dev/null +++ b/SOURCES/autofs-5.1.2-dont-fail-on-master-map-read-fail-timeout.patch @@ -0,0 +1,45 @@ +autofs-5.1.2 - dont exit on master map read fail timeout + +From: Ian Kent + +If there is a persistent master map read failure autofs should +continue on after the configured retry wait, as it would have +done previously. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 12 ++++++++---- + 2 files changed, 9 insertions(+), 4 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -209,6 +209,7 @@ + - wait for master map available at start. + - add master read wait option. + - fix included master map not found return. ++- dont exit on master map read fail timeout. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -2510,10 +2510,14 @@ int main(int argc, char *argv[]) + * error. + */ + if (!do_master_read_master(master_list, master_wait)) { +- logerr("%s: failed to read master map!", program); +- master_kill(master_list); +- release_flag_file(); +- exit(3); ++ logmsg("%s: warning: could not read at least one " ++ "map source after waiting, continuing ...", ++ program); ++ /* ++ * Failed to read master map, continue with what ++ * we have anyway. ++ */ ++ master_read_master(master_list, age, 1); + } + } + diff --git a/SOURCES/autofs-5.1.2-dont-return-until-after-master-map-retry-read.patch b/SOURCES/autofs-5.1.2-dont-return-until-after-master-map-retry-read.patch new file mode 100644 index 0000000..9412bc3 --- /dev/null +++ b/SOURCES/autofs-5.1.2-dont-return-until-after-master-map-retry-read.patch @@ -0,0 +1,71 @@ +autofs-5.1.2 - don't return until after master map retry read + +From: Ian Kent + +The master map read retry needs to be done before returning success +at startup or there can be problems trying to access automount mounts +before they are mounted. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 31 ++++++++++--------------------- + 2 files changed, 11 insertions(+), 21 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -211,6 +211,7 @@ + - fix included master map not found return. + - dont exit on master map read fail timeout. + - set sane default master read wait timeout. ++- don't return until after master map retry read. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -2483,27 +2483,6 @@ int main(int argc, char *argv[]) + + master_read = master_read_master(master_list, age, 0); + if (!master_read) { +- if (foreground) +- logerr("%s: failed to read master map, " +- "will retry!", +- program); +- else +- logerr("%s: failed to read master map, " +- "will retry in background!", +- program); +- } +- +- /* +- * Mmm ... reset force unlink umount so we don't also do this +- * in future when we receive a HUP signal. +- */ +- do_force_unlink = 0; +- +- st_stat = 0; +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); +- +- if (!master_read) { + /* + * Read master map, waiting until it is available, unless + * a signal is received, in which case exit returning an +@@ -2521,6 +2500,16 @@ int main(int argc, char *argv[]) + } + } + ++ /* ++ * Mmm ... reset force unlink umount so we don't also do this ++ * in future when we receive a HUP signal. ++ */ ++ do_force_unlink = 0; ++ ++ st_stat = 0; ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ + state_mach_thid = pthread_self(); + statemachine(NULL); + diff --git a/SOURCES/autofs-5.1.2-factor-out-set-thread-mount-request-log-id.patch b/SOURCES/autofs-5.1.2-factor-out-set-thread-mount-request-log-id.patch new file mode 100644 index 0000000..f715c43 --- /dev/null +++ b/SOURCES/autofs-5.1.2-factor-out-set-thread-mount-request-log-id.patch @@ -0,0 +1,143 @@ +autofs-5.1.2 - factor out set_thread_mount_request_log_id() + +From: Ian Kent + +Factor out setting the thread mount request log id. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 24 +++++++++++++++++++++++- + daemon/direct.c | 17 +---------------- + daemon/indirect.c | 17 +---------------- + include/automount.h | 3 ++- + 5 files changed, 28 insertions(+), 34 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -238,6 +238,7 @@ + - add the mount requestor's pid to pending_args. + - create thread-local ID for mount attempts. + - log functions to prefix messages with attempt_id if available. ++- factor out set_thread_mount_request_log_id(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -100,7 +100,7 @@ static int umount_all(struct autofs_poin + extern struct master *master_list; + + /* simple string hash based on public domain sdbm library */ +-unsigned long sdbm_hash(const char *str, unsigned long seed) ++static unsigned long sdbm_hash(const char *str, unsigned long seed) + { + unsigned long hash = seed; + char c; +@@ -110,6 +110,28 @@ unsigned long sdbm_hash(const char *str, + return hash; + } + ++void set_thread_mount_request_log_id(struct pending_args *mt) ++{ ++ char attempt_id_comp[20]; ++ unsigned long *attempt_id; ++ int status; ++ ++ attempt_id = pthread_getspecific(key_thread_attempt_id); ++ if (attempt_id == NULL) { ++ attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); ++ if (attempt_id == NULL) ++ fatal(ENOMEM); ++ snprintf(attempt_id_comp, 20, "%ld", mt->wait_queue_token); ++ *attempt_id = sdbm_hash(attempt_id_comp, 0); ++ snprintf(attempt_id_comp, 20, "%u", mt->pid); ++ *attempt_id = sdbm_hash(attempt_id_comp, *attempt_id); ++ *attempt_id = sdbm_hash(mt->name, *attempt_id); ++ status = pthread_setspecific(key_thread_attempt_id, attempt_id); ++ if (status != 0) ++ fatal(status); ++ } ++} ++ + static int do_mkdir(const char *parent, const char *path, mode_t mode) + { + int status; +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -1210,8 +1210,6 @@ static void *do_mount_direct(void *arg) + struct autofs_point *ap; + struct stat st; + int status, state; +- char attempt_id_comp[20]; +- unsigned long *attempt_id; + + args = (struct pending_args *) arg; + +@@ -1221,20 +1219,7 @@ static void *do_mount_direct(void *arg) + + ap = mt.ap; + +- attempt_id = pthread_getspecific(key_thread_attempt_id); +- if (attempt_id == NULL) { +- attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); +- if (attempt_id == NULL) +- fatal(ENOMEM); +- snprintf(attempt_id_comp, 20, "%ld", mt.wait_queue_token); +- *attempt_id = sdbm_hash(attempt_id_comp, 0); +- snprintf(attempt_id_comp, 20, "%u", mt.pid); +- *attempt_id = sdbm_hash(attempt_id_comp, *attempt_id); +- *attempt_id = sdbm_hash(mt.name, *attempt_id); +- status = pthread_setspecific(key_thread_attempt_id, attempt_id); +- if (status != 0) +- fatal(status); +- } ++ set_thread_mount_request_log_id(&mt); + + args->signaled = 1; + status = pthread_cond_signal(&args->cond); +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -726,8 +726,6 @@ static void *do_mount_indirect(void *arg + char buf[PATH_MAX + 1]; + struct stat st; + int len, status, state; +- char attempt_id_comp[20]; +- unsigned long *attempt_id; + + args = (struct pending_args *) arg; + +@@ -737,20 +735,7 @@ static void *do_mount_indirect(void *arg + + ap = mt.ap; + +- attempt_id = pthread_getspecific(key_thread_attempt_id); +- if (attempt_id == NULL) { +- attempt_id = (unsigned long *) calloc(1, sizeof(unsigned long)); +- if (attempt_id == NULL) +- fatal(ENOMEM); +- snprintf(attempt_id_comp, 20, "%ld", mt.wait_queue_token); +- *attempt_id = sdbm_hash(attempt_id_comp, 0); +- snprintf(attempt_id_comp, 20, "%u", mt.pid); +- *attempt_id = sdbm_hash(attempt_id_comp, *attempt_id); +- *attempt_id = sdbm_hash(mt.name, *attempt_id); +- status = pthread_setspecific(key_thread_attempt_id, attempt_id); +- if (status != 0) +- fatal(status); +- } ++ set_thread_mount_request_log_id(&mt); + + args->signaled = 1; + status = pthread_cond_signal(&args->cond); +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -243,7 +243,8 @@ const char **copy_argv(int argc, const c + int compare_argv(int argc1, const char **argv1, int argc2, const char **argv2); + int free_argv(int argc, const char **argv); + +-unsigned long sdbm_hash(const char *str, unsigned long seed); ++struct pending_args; ++void set_thread_mount_request_log_id(struct pending_args *mt); + + void dump_core(void); + int aquire_lock(void); diff --git a/SOURCES/autofs-5.1.2-fix-_strncmp-usage.patch b/SOURCES/autofs-5.1.2-fix-_strncmp-usage.patch new file mode 100644 index 0000000..f8e2455 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-_strncmp-usage.patch @@ -0,0 +1,64 @@ +autofs-5.1.2 - fix _strncmp() usage + +From: Ian Kent + +A change to fix nfs mount options changed to using a custom strncmp() +function. + +While the usage of the function is correct in the nfs and bind mount +modules it isn't correct in the autofs and ext2 mount modules. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_autofs.c | 12 ++++++------ + modules/mount_ext2.c | 2 +- + 3 files changed, 8 insertions(+), 7 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -221,6 +221,7 @@ + - fix short memory allocation in lookup_amd_instance(). + - fix count_mounts() function. + - fix argc off by one in mount_autofs.c. ++- fix _strncmp() usage. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -121,17 +121,17 @@ int mount_mount(struct autofs_point *ap, + while (*comma != '\0' && *comma != ',') + comma++; + +- if (_strncmp(cp, "nobrowse", 8) == 0) ++ if (_strncmp("nobrowse", cp, 8) == 0) + ghost = 0; +- else if (_strncmp(cp, "nobind", 6) == 0) ++ else if (_strncmp("nobind", cp, 6) == 0) + nobind = 1; +- else if (_strncmp(cp, "browse", 6) == 0) ++ else if (_strncmp("browse", cp, 6) == 0) + ghost = 1; +- else if (_strncmp(cp, "symlink", 7) == 0) ++ else if (_strncmp("symlink", cp, 7) == 0) + symlnk = 1; +- else if (_strncmp(cp, "hosts", 5) == 0) ++ else if (_strncmp("hosts", cp, 5) == 0) + hosts = 1; +- else if (_strncmp(cp, "timeout=", 8) == 0) { ++ else if (_strncmp("timeout=", cp, 8) == 0) { + char *val = strchr(cp, '='); + unsigned tout; + if (val) { +--- autofs-5.0.7.orig/modules/mount_ext2.c ++++ autofs-5.0.7/modules/mount_ext2.c +@@ -82,7 +82,7 @@ int mount_mount(struct autofs_point *ap, + + if (options && options[0]) { + for (p = options; (p1 = strchr(p, ',')); p = p1) +- if (!_strncmp(p, "ro", p1 - p) && ++p1 - p == sizeof("ro")) ++ if (!_strncmp("ro", p, p1 - p) && ++p1 - p == sizeof("ro")) + ro = 1; + if (!strcmp(p, "ro")) + ro = 1; diff --git a/SOURCES/autofs-5.1.2-fix-argc-off-by-one-in-mount_autofs_c.patch b/SOURCES/autofs-5.1.2-fix-argc-off-by-one-in-mount_autofs_c.patch new file mode 100644 index 0000000..6f56dec --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-argc-off-by-one-in-mount_autofs_c.patch @@ -0,0 +1,55 @@ +autofs-5.1.2 - fix argc off by one in mount_autofs.c + +From: Ian Kent + +The mount_autofs.c module incorrectly calculates the number of +arguments to its map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_autofs.c | 8 ++++---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -220,6 +220,7 @@ + - update and add README for old autofs schema. + - fix short memory allocation in lookup_amd_instance(). + - fix count_mounts() function. ++- fix argc off by one in mount_autofs.c. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -179,11 +179,11 @@ int mount_mount(struct autofs_point *ap, + + if (options) { + char *t = options; +- do { ++ while ((t = strchr(t, ',')) != NULL) { + argc++; + if (*t == ',') + t++; +- } while ((t = strchr(t, ',')) != NULL); ++ } + } + argv = (const char **) alloca((argc + 1) * sizeof(char *)); + +@@ -235,13 +235,13 @@ int mount_mount(struct autofs_point *ap, + + if (options) { + p = options; +- do { ++ while ((p = strchr(p, ',')) != NULL) { + if (*p == ',') { + *p = '\0'; + p++; + } + argv[argc++] = p; +- } while ((p = strchr(p, ',')) != NULL); ++ } + } + argv[argc] = NULL; + diff --git a/SOURCES/autofs-5.1.2-fix-bogus-check-in-expire_cleanup.patch b/SOURCES/autofs-5.1.2-fix-bogus-check-in-expire_cleanup.patch new file mode 100644 index 0000000..f227f35 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-bogus-check-in-expire_cleanup.patch @@ -0,0 +1,35 @@ +autofs-5.1.2 - fix bogus check in expire_cleanup() + +From: Ian Kent + +ap->submount can never be 0 here. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/state.c | 4 +--- + 2 files changed, 2 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -233,6 +233,7 @@ + - capture cache option and its settings during parsing. + - handle map_option cache for top level mounts. + - handle amd cache option all in amd type auto mounts. ++- fix bogus check in expire_cleanup(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/state.c ++++ autofs-5.0.7/daemon/state.c +@@ -139,9 +139,7 @@ void expire_cleanup(void *arg) + next = ST_SHUTDOWN_PENDING; + break; + } +- +- if (ap->submount++ == 0) +- ap->submount = 2; ++ ap->submount++; + } + + if (ap->state == ST_EXPIRE && !ap->submount) diff --git a/SOURCES/autofs-5.1.2-fix-count_mounts-function.patch b/SOURCES/autofs-5.1.2-fix-count_mounts-function.patch new file mode 100644 index 0000000..4c42995 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-count_mounts-function.patch @@ -0,0 +1,34 @@ +autofs-5.1.2 - fix count_mounts() function + +From: Ian Kent + +count_mounts() gets the number of mounts wrong, make it include the +base directory also. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -219,6 +219,7 @@ + - honor last rw in mount options when doing a bind mount. + - update and add README for old autofs schema. + - fix short memory allocation in lookup_amd_instance(). ++- fix count_mounts() function. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -392,7 +392,7 @@ int count_mounts(struct autofs_point *ap + counter.count = 0; + counter.dev = dev; + +- if (walk_tree(path, counter_fn, 0, ap, &counter) == -1) ++ if (walk_tree(path, counter_fn, 1, ap, &counter) == -1) + return -1; + + return counter.count; diff --git a/SOURCES/autofs-5.1.2-fix-included-master-map-not-found-return.patch b/SOURCES/autofs-5.1.2-fix-included-master-map-not-found-return.patch new file mode 100644 index 0000000..1660ed1 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-included-master-map-not-found-return.patch @@ -0,0 +1,89 @@ +autofs-5.1.2 - fix included master map not found return + +From: Ian Kent + +When retrying the master map read at startup a not found return is needed +when there is no map rather than an unknown or unavailable for the retry +logic to work. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 6 ++++-- + modules/lookup_file.c | 18 ++++++++++++------ + 3 files changed, 17 insertions(+), 8 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -208,6 +208,7 @@ + - add config option to supress not found log message. + - wait for master map available at start. + - add master read wait option. ++- fix included master map not found return. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -241,7 +241,7 @@ int lookup_nss_read_master(struct master + } + + /* First one gets it */ +- result = NSS_STATUS_UNKNOWN; ++ result = NSS_STATUS_SUCCESS; + head = &nsslist; + list_for_each(p, head) { + struct nss_source *this; +@@ -282,8 +282,10 @@ int lookup_nss_read_master(struct master + } + } + +- if (result == NSS_STATUS_UNKNOWN) { ++ if (result == NSS_STATUS_UNKNOWN || ++ result == NSS_STATUS_NOTFOUND) { + debug(logopt, "no map - continuing to next source"); ++ result = NSS_STATUS_SUCCESS; + continue; + } + +--- autofs-5.0.7.orig/modules/lookup_file.c ++++ autofs-5.0.7/modules/lookup_file.c +@@ -463,6 +463,8 @@ int lookup_read_master(struct master *ma + + f = open_fopen_r(ctxt->mapname); + if (!f) { ++ if (errno == ENOENT) ++ return NSS_STATUS_NOTFOUND; + error(logopt, + MODPREFIX "could not open master map file %s", + ctxt->mapname); +@@ -506,12 +508,14 @@ int lookup_read_master(struct master *ma + MODPREFIX + "failed to read included master map %s", + master->name); +- /* +- * If we're starting up wee need the whole +- * master map initially, so tell the upper +- * layer to retry. +- */ +- master->read_fail = 1; ++ if (status != NSS_STATUS_NOTFOUND) { ++ /* ++ * If we're starting up wee need the whole ++ * master map initially, so tell the upper ++ * layer to retry. ++ */ ++ master->read_fail = 1; ++ } + } + master->depth--; + master->recurse = 0; +@@ -712,6 +716,8 @@ int lookup_read_map(struct autofs_point + + f = open_fopen_r(ctxt->mapname); + if (!f) { ++ if (errno == ENOENT) ++ return NSS_STATUS_NOTFOUND; + error(ap->logopt, + MODPREFIX "could not open map file %s", ctxt->mapname); + return NSS_STATUS_UNAVAIL; diff --git a/SOURCES/autofs-5.1.2-fix-invalid-reference-in-remount_active_mount.patch b/SOURCES/autofs-5.1.2-fix-invalid-reference-in-remount_active_mount.patch new file mode 100644 index 0000000..17dcabf --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-invalid-reference-in-remount_active_mount.patch @@ -0,0 +1,38 @@ +autofs-5.1.2 - fix invalid reference in remount_active_mount() + +From: Ian Kent + +remount_active_mount() can be called with the map entry pointer NULL +so it must be checked before use when getting the automount timeout. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 6 ++++-- + 2 files changed, 5 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1721,8 +1721,10 @@ static int remount_active_mount(struct a + if (fd == -1) + return REMOUNT_OPEN_FAIL; + +- error(ap->logopt, "ap->type %d type %u", ap->type, type); +- timeout = get_exp_timeout(ap, me->source); ++ if (!me) ++ timeout = get_exp_timeout(ap, NULL); ++ else ++ timeout = get_exp_timeout(ap, me->source); + + /* Re-reading the map, set timeout and return */ + if (ap->state == ST_READMAP) { +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -246,6 +246,7 @@ + - fix possible NULL derefernce. + - fix work around sss startup delay. + - improve scalability of direct mount path component. ++- fix invalid reference in remount_active_mount(). + + 25/07/2012 autofs-5.0.7 + ======================= diff --git a/SOURCES/autofs-5.1.2-fix-possible-NULL-derefernce.patch b/SOURCES/autofs-5.1.2-fix-possible-NULL-derefernce.patch new file mode 100644 index 0000000..0e41a56 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-possible-NULL-derefernce.patch @@ -0,0 +1,48 @@ +autofs-5.1.2 - fix possible NULL derefernce + +From: Ian Kent + +In modules/mount_autofs.c:mount_mount() a NULL pointer dereference is +(unlikley but) possible. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_autofs.c | 15 +++++++++------ + 2 files changed, 10 insertions(+), 6 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -243,6 +243,7 @@ + - work around sss startup delay. + - add sss master map wait config option. + - use autofs_point to store expire timeout where possibe. ++- fix possible NULL derefernce. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -280,13 +280,16 @@ int mount_mount(struct autofs_point *ap, + + if (source->flags & MAP_FLAG_FORMAT_AMD) { + struct amd_entry *am_entry = __master_find_amdmount(ap, entry->path); +- if (am_entry && am_entry->pref) { +- nap->pref = am_entry->pref; +- am_entry->pref = NULL; +- } + +- if (am_entry->cache_opts & AMD_CACHE_OPTION_ALL) +- nap->flags |= MOUNT_FLAG_AMD_CACHE_ALL; ++ if (am_entry) { ++ if (am_entry->pref) { ++ nap->pref = am_entry->pref; ++ am_entry->pref = NULL; ++ } ++ ++ if (am_entry->cache_opts & AMD_CACHE_OPTION_ALL) ++ nap->flags |= MOUNT_FLAG_AMD_CACHE_ALL; ++ } + } + + if (handle_mounts_startup_cond_init(&suc)) { diff --git a/SOURCES/autofs-5.1.2-fix-short-memory-allocation-in-lookup_amd_instance.patch b/SOURCES/autofs-5.1.2-fix-short-memory-allocation-in-lookup_amd_instance.patch new file mode 100644 index 0000000..c1d5878 --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-short-memory-allocation-in-lookup_amd_instance.patch @@ -0,0 +1,33 @@ +autofs-5.1.2 - fix short memory allocation in lookup_amd_instance() + +From: Ian Kent + +Fix off by one memory allocation size in lookup_amd_instance(). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -218,6 +218,7 @@ + - check NFS server availability on local mount fallback. + - honor last rw in mount options when doing a bind mount. + - update and add README for old autofs schema. ++- fix short memory allocation in lookup_amd_instance(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -802,7 +802,7 @@ static int lookup_amd_instance(struct au + return NSS_STATUS_UNKNOWN; + } + +- m_key = malloc(strlen(ap->path) + strlen(me->multi->key) + 1); ++ m_key = malloc(strlen(ap->path) + strlen(me->multi->key) + 2); + if (!m_key) { + error(ap->logopt, + "failed to allocate storage for search key"); diff --git a/SOURCES/autofs-5.1.2-fix-typos-in-README.amd-maps.patch b/SOURCES/autofs-5.1.2-fix-typos-in-README.amd-maps.patch new file mode 100644 index 0000000..d8d52db --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-typos-in-README.amd-maps.patch @@ -0,0 +1,75 @@ +autofs-5.1.2 - fix typos in README.amd-maps + +From: Ian Kent + +Fix a few typos and try and clearify some statements in the README. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + README.amd-maps | 15 ++++++++------- + 2 files changed, 9 insertions(+), 7 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -222,6 +222,7 @@ + - fix count_mounts() function. + - fix argc off by one in mount_autofs.c. + - fix _strncmp() usage. ++- fix typos in README.amd-maps. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/README.amd-maps ++++ autofs-5.0.7/README.amd-maps +@@ -7,7 +7,8 @@ The ability to parse amd format maps has + How to use amd maps in autofs + ----------------------------- + +-To add amd map parsing to autofs new "format" module has been added. ++To add amd map parsing to autofs a new "format" module has been added. ++ + To use this new map format module the existing master map syntax is + used as described below. + +@@ -20,7 +21,7 @@ For amd format maps this becomes: + /amd/mp   file,amd:amd.mp + + which will use file as the map source and the amd format parser for +-the map. But see the section below on configuration below for how to ++the map. But see the section below on configuration for how to + eliminate the need to specify "map-type,format" in the master map. + + Configuration sub-system changes +@@ -42,18 +43,18 @@ All that's needed to add an existing amd + add it below the autofs configuration. Apart from changing the amd + "[ global ]" section name to "[ amd ]" nothing else should need to be + changed. However, quite a few amd configuration options don't have +-meaning within autofs. When these options are seen it should be logged. ++meaning within autofs. When these options are seen they are logged. + + Be aware that, if the an old configuration exists and the configuration + hasn't been updated after the installation, changes to the the old + configuration will override changes to the new configuration because + backward compatibility takes priority over the new implementation. + +-The amd per-map sections have two functions, to allow per-mount ++The amd per-mount sections have two functions, to allow per-mount + configuration, as it does in amd, and to allow master map entries to + avoid the need to specify the "type,format" part of the master map +-entry so they can use the nsswitch map source functionality in the +-same way autofs master map entries do. ++entry. This allows them to use the nsswitch map source functionality ++in the same way autofs master map entries do. + + If a section for an amd mount is added below the global amd section + using the mount point path (as is done in amd.conf) then autofs will +@@ -63,7 +64,7 @@ be given in the master map entry the map + as it is in amd and will no be used. + + If a mount point is present in the master map and the source of the +-map is nis then it should be sufficient to use (for example): ++map is nis then it is sufficient to use (for example): + + /amd/mp           amd.mp + diff --git a/SOURCES/autofs-5.1.2-fix-work-around-sss-startup-delay.patch b/SOURCES/autofs-5.1.2-fix-work-around-sss-startup-delay.patch new file mode 100644 index 0000000..3497b5d --- /dev/null +++ b/SOURCES/autofs-5.1.2-fix-work-around-sss-startup-delay.patch @@ -0,0 +1,41 @@ +autofs-5.1.2 - fix work around sss startup delay + +From: Ian Kent + +If a sss startup delay has been configured to non-zero autofs will +wait up to the configured time and return NSS_STATUS_UNAVAIL or +NSS_STATUS_NOTFOUND even if setautomntent_wait() returns success. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/lookup_sss.c | 8 +++++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -244,6 +244,7 @@ + - add sss master map wait config option. + - use autofs_point to store expire timeout where possibe. + - fix possible NULL derefernce. ++- fix work around sss startup delay. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/lookup_sss.c ++++ autofs-5.0.7/modules/lookup_sss.c +@@ -309,9 +309,11 @@ int lookup_read_master(struct master *ma + ret = setautomntent_wait(logopt, + ctxt, ctxt->mapname, &sss_ctxt, + retries); +- if (ret == ENOENT) +- return NSS_STATUS_NOTFOUND; +- return NSS_STATUS_UNAVAIL; ++ if (ret) { ++ if (ret == ENOENT) ++ return NSS_STATUS_NOTFOUND; ++ return NSS_STATUS_UNAVAIL; ++ } + } + + count = 0; diff --git a/SOURCES/autofs-5.1.2-handle-amd-cache-option-all-in-amd-type-auto-mounts.patch b/SOURCES/autofs-5.1.2-handle-amd-cache-option-all-in-amd-type-auto-mounts.patch new file mode 100644 index 0000000..2673388 --- /dev/null +++ b/SOURCES/autofs-5.1.2-handle-amd-cache-option-all-in-amd-type-auto-mounts.patch @@ -0,0 +1,121 @@ +autofs-5.1.2 - handle amd cache option all in amd type auto mounts + +From: Ian Kent + +In order to read in the map at mount time autofs submounts must be +set as browasble but amd type auto mounts that have the cache:=all +option set need to read in the map without the browse option being +set. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/lookup_ldap.c | 10 ++++++---- + modules/lookup_nisplus.c | 10 ++++++---- + modules/lookup_sss.c | 10 ++++++---- + modules/lookup_yp.c | 10 ++++++---- + modules/mount_autofs.c | 3 +++ + 6 files changed, 28 insertions(+), 16 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -232,6 +232,7 @@ + - add function conf_get_map_options(). + - capture cache option and its settings during parsing. + - handle map_option cache for top level mounts. ++- handle amd cache option all in amd type auto mounts. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/lookup_ldap.c ++++ autofs-5.0.7/modules/lookup_ldap.c +@@ -2797,11 +2797,13 @@ static int read_one_map(struct autofs_po + int rv, l; + + /* +- * If we don't need to create directories then there's no use +- * reading the map. We always need to read the whole map for +- * direct mounts in order to mount the triggers. ++ * If we don't need to create directories (or don't need ++ * to read an amd cache:=all map) then there's no use ++ * reading the map. We always need to read the whole map ++ * for direct mounts in order to mount the triggers. + */ +- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) { ++ if (ap->type != LKP_DIRECT && ++ !(ap->flags & (MOUNT_FLAG_GHOST|MOUNT_FLAG_AMD_CACHE_ALL))) { + debug(ap->logopt, "map read not needed, so not done"); + return NSS_STATUS_SUCCESS; + } +--- autofs-5.0.7.orig/modules/lookup_nisplus.c ++++ autofs-5.0.7/modules/lookup_nisplus.c +@@ -239,11 +239,13 @@ int lookup_read_map(struct autofs_point + master_source_current_signal(ap->entry); + + /* +- * If we don't need to create directories then there's no use +- * reading the map. We always need to read the whole map for +- * direct mounts in order to mount the triggers. ++ * If we don't need to create directories (or don't need ++ * to read an amd cache:=all map) then there's no use ++ * reading the map. We always need to read the whole map ++ * for direct mounts in order to mount the triggers. + */ +- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) { ++ if (ap->type != LKP_DIRECT && ++ !(ap->flags & (MOUNT_FLAG_GHOST|MOUNT_FLAG_AMD_CACHE_ALL))) { + debug(ap->logopt, "map read not needed, so not done"); + return NSS_STATUS_SUCCESS; + } +--- autofs-5.0.7.orig/modules/lookup_sss.c ++++ autofs-5.0.7/modules/lookup_sss.c +@@ -340,11 +340,13 @@ int lookup_read_map(struct autofs_point + mc = source->mc; + + /* +- * If we don't need to create directories then there's no use +- * reading the map. We always need to read the whole map for +- * direct mounts in order to mount the triggers. ++ * If we don't need to create directories (or don't need ++ * to read an amd cache:=all map) then there's no use ++ * reading the map. We always need to read the whole map ++ * for direct mounts in order to mount the triggers. + */ +- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) { ++ if (ap->type != LKP_DIRECT && ++ !(ap->flags & (MOUNT_FLAG_GHOST|MOUNT_FLAG_AMD_CACHE_ALL))) { + debug(ap->logopt, "map read not needed, so not done"); + return NSS_STATUS_SUCCESS; + } +--- autofs-5.0.7.orig/modules/lookup_yp.c ++++ autofs-5.0.7/modules/lookup_yp.c +@@ -401,11 +401,13 @@ int lookup_read_map(struct autofs_point + master_source_current_signal(ap->entry); + + /* +- * If we don't need to create directories then there's no use +- * reading the map. We always need to read the whole map for +- * direct mounts in order to mount the triggers. ++ * If we don't need to create directories (or don't need ++ * to read an amd cache:=all map) then there's no use ++ * reading the map. We always need to read the whole map ++ * for direct mounts in order to mount the triggers. + */ +- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) { ++ if (ap->type != LKP_DIRECT && ++ !(ap->flags & (MOUNT_FLAG_GHOST|MOUNT_FLAG_AMD_CACHE_ALL))) { + debug(ap->logopt, "map read not needed, so not done"); + return NSS_STATUS_SUCCESS; + } +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -288,6 +288,9 @@ int mount_mount(struct autofs_point *ap, + nap->pref = am_entry->pref; + am_entry->pref = NULL; + } ++ ++ if (am_entry->cache_opts & AMD_CACHE_OPTION_ALL) ++ nap->flags |= MOUNT_FLAG_AMD_CACHE_ALL; + } + + if (handle_mounts_startup_cond_init(&suc)) { diff --git a/SOURCES/autofs-5.1.2-handle-map_option-cache-for-top-level-mounts.patch b/SOURCES/autofs-5.1.2-handle-map_option-cache-for-top-level-mounts.patch new file mode 100644 index 0000000..1535822 --- /dev/null +++ b/SOURCES/autofs-5.1.2-handle-map_option-cache-for-top-level-mounts.patch @@ -0,0 +1,113 @@ +autofs-5.1.2 - handle map_option cache for top level mounts + +From: Ian Kent + +In order to read in the map at mount time autofs top level mounts +must be set as browsasble but amd top level mounts that have the +map_option cache:=all set need to read in the map without the browse +option being set. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/automount.h | 3 +++ + lib/master.c | 15 +++++++++++++++ + lib/master_parse.y | 16 ++++++++++++++++ + man/autofs.conf.5.in | 8 ++++++-- + 5 files changed, 41 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -231,6 +231,7 @@ + - check for conflicting amd section mounts. + - add function conf_get_map_options(). + - capture cache option and its settings during parsing. ++- handle map_option cache for top level mounts. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -505,6 +505,9 @@ struct kernel_mod_version { + /* Use symlinks instead of bind mounting local mounts */ + #define MOUNT_FLAG_SYMLINK 0x0040 + ++/* Read amd map even if it's not to be ghosted (browsable) */ ++#define MOUNT_FLAG_AMD_CACHE_ALL 0x0080 ++ + struct autofs_point { + pthread_t thid; + char *path; /* Mount point name */ +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -982,6 +982,7 @@ static void master_add_amd_mount_section + unsigned int ghost = 0; + char *type = NULL; + char *map = NULL; ++ char *opts; + + ret = master_partial_match_mapent(master, path); + if (ret) { +@@ -1036,6 +1037,20 @@ static void master_add_amd_mount_section + goto next; + } + ++ opts = conf_amd_get_map_options(path); ++ if (opts) { ++ /* autofs uses the equivalent of cache:=inc,sync ++ * (except for file maps which use cache:=all,sync) ++ * but if the map is large then it may be necessary ++ * to read the whole map at startup even if browsing ++ * is is not enabled, so look for cache:=all in the ++ * map_options configuration entry. ++ */ ++ if (strstr(opts, "cache:=all")) ++ entry->ap->flags |= MOUNT_FLAG_AMD_CACHE_ALL; ++ free(opts); ++ } ++ + type = conf_amd_get_map_type(path); + argv[0] = map; + argv[1] = NULL; +--- autofs-5.0.7.orig/lib/master_parse.y ++++ autofs-5.0.7/lib/master_parse.y +@@ -856,6 +856,22 @@ int master_parse_entry(const char *buffe + if (negative_timeout) + entry->ap->negative_timeout = negative_timeout; + ++ if (format && !strcmp(format, "amd")) { ++ char *opts = conf_amd_get_map_options(path); ++ if (opts) { ++ /* autofs uses the equivalent of cache:=inc,sync ++ * (except for file maps which use cache:=all,sync) ++ * but if the map is large then it may be necessary ++ * to read the whole map at startup even if browsing ++ * is is not enabled, so look for cache:=all in the ++ * map_options configuration entry. ++ */ ++ if (strstr(opts, "cache:=all")) ++ entry->ap->flags |= MOUNT_FLAG_AMD_CACHE_ALL; ++ free(opts); ++ } ++ } ++ + /* + source = master_find_map_source(entry, type, format, + local_argc, (const char **) local_argv); +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -284,8 +284,12 @@ protocol version. + .BR cache_duration ", " map_reload_interval ", " map_options + .br + The map entry cache is continually updated and stale entries +-cleaned on re-load, which is done when map changes aredetected +-so these configuration entries are not used by autofs. ++cleaned on re-load, which is done when map changes are detected ++so these configuration entries are not used by autofs. An ++exception to this is the case where the map is large. In this ++case it may be necessary to read the whole map at startup even if ++browsing is is not enabled. Adding the cache:=all option to ++map_options can be used to for this. + .TP + .B localhost_address + This is not used within autofs. This configuration option was diff --git a/SOURCES/autofs-5.1.2-honor-last-rw-in-mount-options-when-doing-a-bind-mount.patch b/SOURCES/autofs-5.1.2-honor-last-rw-in-mount-options-when-doing-a-bind-mount.patch new file mode 100644 index 0000000..9e3b68d --- /dev/null +++ b/SOURCES/autofs-5.1.2-honor-last-rw-in-mount-options-when-doing-a-bind-mount.patch @@ -0,0 +1,43 @@ +autofs-5.1.2 - honor last rw in mount options when doing a bind mount + +From: David Jeffery + +mount(8) will use the last ro/rw option in its options list. +e.g. "mount -o ro,rw" will make a read-write mount while +"mount -o rw,ro" will make a read-only mount. + +The patch changes the option parsing for mount_mount() in +modules/mount_nfs.c to clear the ro variable when a "rw" +option is seen. This will handle occurrences of both "ro" +and "rw" options, resulting in a read-only option being +passed to a bind mount only if the option order would also +have resulted in an nfs mount being read-only. + +Signed-off-by: David Jeffery +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_nfs.c | 2 ++ + 2 files changed, 3 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -216,6 +216,7 @@ + - make set_direct_mount_catatonic() more general. + - set autofs mounts catatonic at exit. + - check NFS server availability on local mount fallback. ++- honor last rw in mount options when doing a bind mount. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/mount_nfs.c ++++ autofs-5.0.7/modules/mount_nfs.c +@@ -180,6 +180,8 @@ int mount_mount(struct autofs_point *ap, + with bind mounts */ + else if (_strncmp("ro", cp, o_len) == 0) + ro = 1; ++ else if (_strncmp("rw", cp, o_len) == 0) ++ ro = 0; + /* and jump over trailing white space */ + memcpy(nfsp, cp, comma - cp + 1); + nfsp += comma - cp + 1; diff --git a/SOURCES/autofs-5.1.2-include-amd-mount-section-mounts-in-master-mounts-list.patch b/SOURCES/autofs-5.1.2-include-amd-mount-section-mounts-in-master-mounts-list.patch new file mode 100644 index 0000000..89de602 --- /dev/null +++ b/SOURCES/autofs-5.1.2-include-amd-mount-section-mounts-in-master-mounts-list.patch @@ -0,0 +1,236 @@ +autofs-5.1.2 - include amd mount section mounts in master mounts list + +From: Ian Kent + +Currently a master map entry is required for amd format maps and +top level amd mount path configuration sections can only used to +provide additional per-mount configuration. + +But being able to use the top level amd format mount path +configuration sections alone allows potentially incompatible +master map entries to not be included in the master map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + README.amd-maps | 49 +++++++++++++++++++++---- + lib/master.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 152 insertions(+), 7 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -227,6 +227,7 @@ + - add support for amd browsable option. + - add function conf_amd_get_map_name(). + - add function conf_amd_get_mount_paths(). ++- include amd mount sections mounts in master mounts list. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/README.amd-maps ++++ autofs-5.0.7/README.amd-maps +@@ -9,8 +9,10 @@ How to use amd maps in autofs + + To add amd map parsing to autofs a new "format" module has been added. + +-To use this new map format module the existing master map syntax is +-used as described below. ++There are two ways to use this new map format module. First, the existing ++master map syntax can be used as described below, and second, sections that ++use the top level mount path may be added to the autofs configuration below ++the "amd" section in much the same way as is done with amd. + + The master map entry syntax is: + +@@ -21,8 +23,22 @@ For amd format maps this becomes: + /amd/mp   file,amd:amd.mp + + which will use file as the map source and the amd format parser for +-the map. But see the section below on configuration for how to +-eliminate the need to specify "map-type,format" in the master map. ++the map. ++ ++In order to use nsswitch to specify the map source an amd per-mount ++section needs to be added to the autofs configuration so autofs ++knows the master map entry is an amd format mount. ++ ++If an amd-per-mount section is added to the autofs configuration a ++corresponding master map entry is optional. If both are present the ++map name given in the master map entry will override a "map_name" ++option in the amd per-mount section. ++ ++If an amd per-mount section is used alone then not giving the "map_type" ++option will alow the use of nsswicth for map selection. ++ ++See below for an example of an amd per-mount configuration entry. ++ + + Configuration sub-system changes + -------------------------------- +@@ -56,12 +72,19 @@ avoid the need to specify the "type,form + entry. This allows them to use the nsswitch map source functionality + in the same way autofs master map entries do. + ++If amd per-mount sections are present in the autofs configuration ++their corresponding master map entries are optional. This allows ++amd maps to be used without adding incompatible entries to the autofs ++master map in shared infrastructure environments. ++ + If a section for an amd mount is added below the global amd section + using the mount point path (as is done in amd.conf) then autofs will + know the map format is amd (it doesn't matter if there are no other +-configuration options in the mount point section). Since the map must +-be given in the master map entry the map_name option is not mandatory +-as it is in amd and will no be used. ++configuration options in the mount point section). ++ ++If there is a corresponding master map entry the map given in the ++master map entry will be used over the map_name option if it is ++present in an amd per-mount section. + + If a mount point is present in the master map and the source of the + map is nis then it is sufficient to use (for example): +@@ -86,6 +109,18 @@ or + [ /amd/mp ] + map_type = nis + ++An example of an amd per-mount configuration entry is: ++ ++[ amd ] ++... ++ ++[ /test ] ++map_name = /etc/amd.test ++#map_type = file ++#search_path = /etc ++#browsable_dirs = yes | no ++browsable_dirs = yes ++ + + amd map options that can be used + -------------------------------- +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -910,6 +910,114 @@ struct master *master_new(const char *na + return master; + } + ++static void master_add_amd_mount_section_mounts(struct master *master, time_t age) ++{ ++ unsigned int m_logopt = master->logopt; ++ struct master_mapent *entry; ++ struct map_source *source; ++ unsigned int loglevel; ++ unsigned int logopt; ++ unsigned int flags; ++ char *argv[2]; ++ char **paths; ++ int ret; ++ int i; ++ ++ loglevel = conf_amd_get_log_options(); ++ ++ paths = conf_amd_get_mount_paths(); ++ if (!paths) ++ return; ++ ++ i = 0; ++ while (paths[i]) { ++ const char *path = paths[i]; ++ unsigned int ghost = 0; ++ char *type = NULL; ++ char *map = NULL; ++ ++ entry = master_find_mapent(master, path); ++ if (entry) { ++ info(m_logopt, ++ "ignoring duplicate amd section mount %s", ++ path); ++ goto next; ++ } ++ ++ map = conf_amd_get_map_name(path); ++ if (!map) { ++ error(m_logopt, ++ "failed to get map name for amd section mount %s", ++ path); ++ goto next; ++ } ++ ++ entry = master_new_mapent(master, path, age); ++ if (!entry) { ++ error(m_logopt, ++ "failed to allocate new amd section mount %s", ++ path); ++ goto next; ++ } ++ ++ logopt = m_logopt; ++ if (loglevel <= LOG_DEBUG && loglevel > LOG_INFO) ++ logopt = LOGOPT_DEBUG; ++ else if (loglevel <= LOG_INFO && loglevel > LOG_ERR) ++ logopt = LOGOPT_VERBOSE; ++ ++ /* It isn't possible to provide the fullybrowsable amd ++ * browsing functionality within the autofs framework. ++ * This flag will not be set if browsable_dirs = full ++ * in the configuration or fullybrowsable is present as ++ * an option. ++ */ ++ flags = conf_amd_get_flags(path); ++ if (flags & CONF_BROWSABLE_DIRS) ++ ghost = 1; ++ ++ ret = master_add_autofs_point(entry, logopt, 0, ghost, 0); ++ if (!ret) { ++ error(m_logopt, "failed to add autofs_point"); ++ master_free_mapent(entry); ++ goto next; ++ } ++ ++ type = conf_amd_get_map_type(path); ++ argv[0] = map; ++ argv[1] = NULL; ++ ++ source = master_add_map_source(entry, type, "amd", ++ age, 1, (const char **) argv); ++ if (!source) { ++ error(m_logopt, ++ "failed to add source for amd section mount %s", ++ path); ++ master_free_mapent(entry); ++ goto next; ++ } ++ ++ source->exp_timeout = conf_amd_get_dismount_interval(path); ++ source->master_line = 0; ++ ++ entry->age = age; ++ entry->current = NULL; ++ ++ master_add_mapent(master, entry); ++next: ++ if (type) ++ free(type); ++ if (map) ++ free(map); ++ i++; ++ } ++ ++ i = 0; ++ while (paths[i]) ++ free(paths[i++]); ++ free(paths); ++} ++ + int master_read_master(struct master *master, time_t age, int readall) + { + unsigned int logopt = master->logopt; +@@ -938,6 +1046,7 @@ int master_read_master(struct master *ma + master_init_scan(); + lookup_nss_read_master(master, age); + cache_unlock(nc); ++ master_add_amd_mount_section_mounts(master, age); + master_mutex_unlock(); + + if (!master->read_fail) diff --git a/SOURCES/autofs-5.1.2-increase-worker-thread-per-thread-stack-size.patch b/SOURCES/autofs-5.1.2-increase-worker-thread-per-thread-stack-size.patch new file mode 100644 index 0000000..b429a7d --- /dev/null +++ b/SOURCES/autofs-5.1.2-increase-worker-thread-per-thread-stack-size.patch @@ -0,0 +1,68 @@ +autofs-5.1.2 - increase worker thread per-thread stack size + +From: Ian Kent + +automount(8) uses a worker thread per-thread stack size of 1M which is +sufficient for its needs. + +But some glibc functions (such as nscd_getgr_r()) use alloca() to allocate +working storage that can have an arbitary size. Since alloca() never fails +there is no way to check for stack overflow. This has been fixed in more +recent versions of glibc. + +But for older version of glibc all that can be done by automount to avoid +this is to increase the stack size. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 14 +++++++++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -247,6 +247,7 @@ + - fix work around sss startup delay. + - improve scalability of direct mount path component. + - fix invalid reference in remount_active_mount(). ++- increase worker thread per-thread stack size. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -81,6 +81,7 @@ static int cloexec_works = 0; + /* Attributes for creating detached and joinable threads */ + pthread_attr_t th_attr; + pthread_attr_t th_attr_detached; ++size_t detached_thread_stack_size = PTHREAD_STACK_MIN * 144; + + struct master_readmap_cond mrc = { + PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, NULL, 0, 0, 0, 0}; +@@ -2483,7 +2484,7 @@ int main(int argc, char *argv[]) + + #ifdef _POSIX_THREAD_ATTR_STACKSIZE + if (pthread_attr_setstacksize( +- &th_attr_detached, PTHREAD_STACK_MIN*64)) { ++ &th_attr_detached, detached_thread_stack_size)) { + logerr("%s: failed to set stack size thread attribute!", + program); + res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +@@ -2494,6 +2495,17 @@ int main(int argc, char *argv[]) + } + #endif + ++ if (pthread_attr_getstacksize( ++ &th_attr_detached, &detached_thread_stack_size)) { ++ logerr("%s: failed to get detached thread stack size!", ++ program); ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ release_flag_file(); ++ macro_free_global_table(); ++ exit(1); ++ } ++ + info(logging, "Starting automounter version %s, master map %s", + version, master_list->name); + info(logging, "using kernel protocol version %d.%02d", diff --git a/SOURCES/autofs-5.1.2-limit-getgrgid_r-buffer-size.patch b/SOURCES/autofs-5.1.2-limit-getgrgid_r-buffer-size.patch new file mode 100644 index 0000000..0ab3f0b --- /dev/null +++ b/SOURCES/autofs-5.1.2-limit-getgrgid_r-buffer-size.patch @@ -0,0 +1,118 @@ +autofs-5.1.2 - limit getgrgid_r() buffer size + +From: Ian Kent + +Some older versions of glibc use stack allocation to store group +information during calls to getgrgid_r(). But before doing this +it checks if the size of the response info. can fit in the user +supplied buffer and returns ERANGE if it can't. + +Now automount(8) doesn't check if the size of the buffer it is +passing is larger than it's stack size. That's not vey accurrate +since current stack usage isn't known but better than not checking +at all. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 47 +++++++++++++++++++++++++++++++++-------------- + 2 files changed, 34 insertions(+), 14 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -248,6 +248,7 @@ + - improve scalability of direct mount path component. + - fix invalid reference in remount_active_mount(). + - increase worker thread per-thread stack size. ++- limit getgrgid_r() buffer size. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -48,6 +48,9 @@ static const char mnt_name_template[] + static struct kernel_mod_version kver = {0, 0}; + static const char kver_options_template[] = "fd=%d,pgrp=%u,minproto=3,maxproto=5"; + ++extern size_t detached_thread_stack_size; ++static size_t maxgrpbuf = 0; ++ + #define EXT_MOUNTS_HASH_SIZE 50 + + struct ext_mount { +@@ -1503,14 +1506,22 @@ void set_tsd_user_vars(unsigned int logo + } + + gr_tmp = NULL; ++ status = ERANGE; ++ if (!maxgrpbuf) ++ maxgrpbuf = detached_thread_stack_size * 0.9; ++ ++ /* If getting the group name fails go on without it. It's ++ * used to set an environment variable for program maps ++ * which may or may not use it so it isn't critical to ++ * operation. ++ */ ++ + tmplen = grplen; + while (1) { + char *tmp = realloc(gr_tmp, tmplen + 1); + if (!tmp) { + error(logopt, "failed to malloc buffer for getgrgid_r"); +- if (gr_tmp) +- free(gr_tmp); +- goto free_tsv_home; ++ goto no_group; + } + gr_tmp = tmp; + pgr = &gr; +@@ -1519,22 +1530,29 @@ void set_tsd_user_vars(unsigned int logo + if (status != ERANGE) + break; + tmplen += grplen; ++ ++ /* Don't tempt glibc to alloca() larger than is (likely) ++ * available on the stack. ++ */ ++ if (tmplen < maxgrpbuf) ++ continue; ++ ++ /* Add a message so we know this happened */ ++ debug(logopt, "group buffer allocation would be too large"); ++ break; + } + +- if (status || !pgr) { ++no_group: ++ if (status || !pgr) + error(logopt, "failed to get group info from getgrgid_r"); +- free(gr_tmp); +- goto free_tsv_home; ++ else { ++ tsv->group = strdup(gr.gr_name); ++ if (!tsv->group) ++ error(logopt, "failed to malloc buffer for group"); + } + +- tsv->group = strdup(gr.gr_name); +- if (!tsv->group) { +- error(logopt, "failed to malloc buffer for group"); ++ if (gr_tmp) + free(gr_tmp); +- goto free_tsv_home; +- } +- +- free(gr_tmp); + + status = pthread_setspecific(key_thread_stdenv_vars, tsv); + if (status) { +@@ -1545,7 +1563,8 @@ void set_tsd_user_vars(unsigned int logo + return; + + free_tsv_group: +- free(tsv->group); ++ if (tsv->group) ++ free(tsv->group); + free_tsv_home: + free(tsv->home); + free_tsv_user: diff --git a/SOURCES/autofs-5.1.2-log-functions-to-prefix-messages-with-attempt_id-if-available.patch b/SOURCES/autofs-5.1.2-log-functions-to-prefix-messages-with-attempt_id-if-available.patch new file mode 100644 index 0000000..089f96c --- /dev/null +++ b/SOURCES/autofs-5.1.2-log-functions-to-prefix-messages-with-attempt_id-if-available.patch @@ -0,0 +1,293 @@ +autofs-5.1.2 - log functions to prefix messages with attempt_id if available + +From: Lars R. Damerow + +Now that there should be a mount attempt id try and include it in log entries. + +Signed-off-by: Lars R. Damerow +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + lib/log.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++----------- + 2 files changed, 137 insertions(+), 28 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -237,6 +237,7 @@ + - delay submount exit for amd submounts. + - add the mount requestor's pid to pending_args. + - create thread-local ID for mount attempts. ++- log functions to prefix messages with attempt_id if available. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/log.c ++++ autofs-5.0.7/lib/log.c +@@ -32,6 +32,26 @@ static unsigned int logging_to_syslog = + static unsigned int do_verbose = 0; /* Verbose feedback option */ + static unsigned int do_debug = 0; /* Full debug output */ + ++static char *prepare_attempt_prefix(const char *msg) ++{ ++ unsigned long *attempt_id; ++ char buffer[ATTEMPT_ID_SIZE + 1]; ++ char *prefixed_msg = NULL; ++ ++ attempt_id = pthread_getspecific(key_thread_attempt_id); ++ if (attempt_id) { ++ int len = sizeof(buffer) + 1 + strlen(msg) + 1; ++ ++ snprintf(buffer, ATTEMPT_ID_SIZE, "%02lx", *attempt_id); ++ prefixed_msg = (char *) calloc(len, sizeof(char)); ++ strcpy(prefixed_msg, buffer); ++ strcat(prefixed_msg, "|"); ++ strcat(prefixed_msg, msg); ++ } ++ ++ return prefixed_msg; ++} ++ + void set_log_norm(void) + { + do_verbose = 0; +@@ -72,124 +92,212 @@ void set_log_debug_ap(struct autofs_poin + void log_info(unsigned int logopt, const char *msg, ...) + { + unsigned int opt_log = logopt & (LOGOPT_DEBUG | LOGOPT_VERBOSE); ++ char *prefixed_msg; + va_list ap; + + if (!do_debug && !do_verbose && !opt_log) + return; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_INFO, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_INFO, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); + ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void log_notice(unsigned int logopt, const char *msg, ...) + { + unsigned int opt_log = logopt & (LOGOPT_DEBUG | LOGOPT_VERBOSE); ++ char *prefixed_msg; + va_list ap; + + if (!do_debug && !do_verbose && !opt_log) + return; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_NOTICE, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_NOTICE, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); + ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void log_warn(unsigned int logopt, const char *msg, ...) + { + unsigned int opt_log = logopt & (LOGOPT_DEBUG | LOGOPT_VERBOSE); ++ char *prefixed_msg; + va_list ap; + + if (!do_debug && !do_verbose && !opt_log) + return; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_WARNING, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_WARNING, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); + ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void log_error(unsigned logopt, const char *msg, ...) + { ++ char *prefixed_msg; + va_list ap; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_ERR, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_ERR, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); ++ ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void log_crit(unsigned logopt, const char *msg, ...) + { ++ char *prefixed_msg; + va_list ap; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_CRIT, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_CRIT, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); ++ ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void log_debug(unsigned int logopt, const char *msg, ...) + { + unsigned int opt_log = logopt & LOGOPT_DEBUG; ++ char *prefixed_msg; + va_list ap; + + if (!do_debug && !opt_log) + return; + ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_WARNING, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_WARNING, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); + ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + + void logmsg(const char *msg, ...) + { ++ char *prefixed_msg; + va_list ap; ++ ++ prefixed_msg = prepare_attempt_prefix(msg); ++ + va_start(ap, msg); +- if (logging_to_syslog) +- vsyslog(LOG_CRIT, msg, ap); +- else { +- vfprintf(stderr, msg, ap); ++ if (logging_to_syslog) { ++ if (prefixed_msg) ++ vsyslog(LOG_CRIT, prefixed_msg, ap); ++ else ++ vsyslog(LOG_INFO, msg, ap); ++ } else { ++ if (prefixed_msg) ++ vfprintf(stderr, prefixed_msg, ap); ++ else ++ vfprintf(stderr, msg, ap); + fputc('\n', stderr); + } + va_end(ap); ++ ++ if (prefixed_msg) ++ free(prefixed_msg); ++ + return; + } + diff --git a/SOURCES/autofs-5.1.2-make-lookup_nss_read_master-return-nss-status.patch b/SOURCES/autofs-5.1.2-make-lookup_nss_read_master-return-nss-status.patch new file mode 100644 index 0000000..d9d09e6 --- /dev/null +++ b/SOURCES/autofs-5.1.2-make-lookup_nss_read_master-return-nss-status.patch @@ -0,0 +1,99 @@ +autofs-5.1.2 - make lookup_nss_read_master() return nss status + +From: Ian Kent + +Currently lookup_nss_read_master() uses a boolean return but in order +for the master map retry read to function properly when trying to read +plus included maps it needs to return an NSS status instead. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 14 ++++++++++---- + modules/lookup_dir.c | 2 +- + modules/lookup_file.c | 2 +- + 4 files changed, 13 insertions(+), 6 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -212,6 +212,7 @@ + - dont exit on master map read fail timeout. + - set sane default master read wait timeout. + - don't return until after master map retry read. ++- make lookup_nss_read_master() return nss status. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -175,7 +175,7 @@ int lookup_nss_read_master(struct master + if (result == NSS_STATUS_UNAVAIL) + master->read_fail = 1; + +- return !result; ++ return result; + } else { + char *name = master->name; + char *tmp; +@@ -225,7 +225,7 @@ int lookup_nss_read_master(struct master + if (result == NSS_STATUS_UNAVAIL) + master->read_fail = 1; + +- return !result; ++ return result; + } + } + } +@@ -237,7 +237,7 @@ int lookup_nss_read_master(struct master + if (!list_empty(&nsslist)) + free_sources(&nsslist); + error(logopt, "can't to read name service switch config."); +- return 0; ++ return NSS_STATUS_UNAVAIL; + } + + /* First one gets it */ +@@ -282,6 +282,12 @@ int lookup_nss_read_master(struct master + } + } + ++ /* We've been instructed to move onto the next source */ ++ if (result == NSS_STATUS_TRYAGAIN) { ++ result = NSS_STATUS_SUCCESS; ++ continue; ++ } ++ + if (result == NSS_STATUS_UNKNOWN || + result == NSS_STATUS_NOTFOUND) { + debug(logopt, "no map - continuing to next source"); +@@ -302,7 +308,7 @@ int lookup_nss_read_master(struct master + if (!list_empty(&nsslist)) + free_sources(&nsslist); + +- return !result; ++ return result; + } + + static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t age) +--- autofs-5.0.7.orig/modules/lookup_dir.c ++++ autofs-5.0.7/modules/lookup_dir.c +@@ -154,7 +154,7 @@ static int include_file(struct master *m + master->depth++; + debug(logopt, MODPREFIX "include: %s", master->name); + status = lookup_nss_read_master(master, age); +- if (!status) { ++ if (status != NSS_STATUS_SUCCESS) { + warn(logopt, + MODPREFIX + "failed to read included master map %s", +--- autofs-5.0.7.orig/modules/lookup_file.c ++++ autofs-5.0.7/modules/lookup_file.c +@@ -503,7 +503,7 @@ int lookup_read_master(struct master *ma + master->recurse = 1; + master->depth++; + status = lookup_nss_read_master(master, age); +- if (!status) { ++ if (status != NSS_STATUS_SUCCESS) { + warn(logopt, + MODPREFIX + "failed to read included master map %s", diff --git a/SOURCES/autofs-5.1.2-make-set_direct_mount_catatonic-more-general.patch b/SOURCES/autofs-5.1.2-make-set_direct_mount_catatonic-more-general.patch new file mode 100644 index 0000000..14e6cf0 --- /dev/null +++ b/SOURCES/autofs-5.1.2-make-set_direct_mount_catatonic-more-general.patch @@ -0,0 +1,219 @@ +autofs-5.1.2 - make set_direct_mount_catatonic() more general + +From: Ian Kent + +Setting direct mounts catatonic at exit doesn't go far enough. + +To avoid possible hang on access of automount managed paths when +the daemon has exited all mounted autofs file systems must be set +catatonic when the daemon exits. + +Start by making set_direct_mount_catatonic() able to handle the +different types of autofs mounts and move it to the mounts function +library. +--- + CHANGELOG | 1 + daemon/direct.c | 69 +++---------------------------------------------------- + include/mounts.h | 1 + lib/mounts.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 71 insertions(+), 64 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -213,6 +213,7 @@ + - set sane default master read wait timeout. + - don't return until after master map retry read. + - make lookup_nss_read_master() return nss status. ++- make set_direct_mount_catatonic() more general. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -82,65 +82,6 @@ static void mnts_cleanup(void *arg) + return; + } + +-/* When exiting direct mount triggers must be set catatonic, regardless +- * of whether they are busy on not, to avoid a hang on access once the +- * daemon has gone away. +- */ +-static int set_direct_mount_catatonic(struct autofs_point *ap, struct mapent *me, int ioctlfd) +-{ +- struct ioctl_ops *ops = get_ioctl_ops(); +- unsigned int opened = 0; +- char buf[MAX_ERR_BUF]; +- int fd = -1; +- int error; +- +- /* In case the miscellaneous device isn't being used try +- * and use an existing ioctl control fd. In this case if +- * we don't already have an ioctl fd the mount can't be +- * set catatonic if it's covered. +- */ +- if (ioctlfd >= 0) +- fd = ioctlfd; +- else if (me->ioctlfd >= 0) +- fd = me->ioctlfd; +- else { +- error = ops->open(ap->logopt, &fd, me->dev, me->key); +- if (error == -1) { +- int err = errno; +- char *estr; +- +- estr = strerror_r(errno, buf, MAX_ERR_BUF); +- error(ap->logopt, +- "failed to open ioctlfd for %s, error: %s", +- me->key, estr); +- return err; +- } +- opened = 1; +- } +- +- if (fd >= 0) { +- error = ops->catatonic(ap->logopt, fd); +- if (error == -1) { +- int err = errno; +- char *estr; +- +- estr = strerror_r(errno, buf, MAX_ERR_BUF); +- error(ap->logopt, +- "failed to set %s catatonic, error: %s", +- me->key, estr); +- if (opened) +- ops->close(ap->logopt, fd); +- return err; +- } +- if (opened) +- ops->close(ap->logopt, fd); +- } +- +- debug(ap->logopt, "set %s catatonic", me->key); +- +- return 0; +-} +- + int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me) + { + struct ioctl_ops *ops = get_ioctl_ops(); +@@ -190,19 +131,19 @@ int do_umount_autofs_direct(struct autof + "ask umount returned busy for %s", + me->key); + if (ap->state != ST_READMAP) +- set_direct_mount_catatonic(ap, me, ioctlfd); ++ set_mount_catatonic(ap, me, ioctlfd); + if (opened) + ops->close(ap->logopt, ioctlfd); + return 1; + } else { + me->ioctlfd = -1; +- set_direct_mount_catatonic(ap, me, ioctlfd); ++ set_mount_catatonic(ap, me, ioctlfd); + ops->close(ap->logopt, ioctlfd); + goto force_umount; + } + } + me->ioctlfd = -1; +- set_direct_mount_catatonic(ap, me, ioctlfd); ++ set_mount_catatonic(ap, me, ioctlfd); + ops->close(ap->logopt, ioctlfd); + } else { + error(ap->logopt, +@@ -297,12 +238,12 @@ int umount_autofs_direct(struct autofs_p + if (!error) + goto done; + +- error = set_direct_mount_catatonic(ap, me, me->ioctlfd); ++ error = set_mount_catatonic(ap, me, me->ioctlfd); + if (!error) + goto done; + + /* We really need to set this, last ditch attempt */ +- set_direct_mount_catatonic(ap, me, -1); ++ set_mount_catatonic(ap, me, -1); + done: + me = cache_enumerate(mc, me); + } +--- autofs-5.0.7.orig/include/mounts.h ++++ autofs-5.0.7/include/mounts.h +@@ -114,6 +114,7 @@ void set_tsd_user_vars(unsigned int, uid + const char *mount_type_str(unsigned int); + void notify_mount_result(struct autofs_point *, const char *, time_t, const char *); + int try_remount(struct autofs_point *, struct mapent *, unsigned int); ++int set_mount_catatonic(struct autofs_point *, struct mapent *, int); + int umount_ent(struct autofs_point *, const char *); + int mount_multi_triggers(struct autofs_point *, struct mapent *, const char *, unsigned int, const char *); + int umount_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *); +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1894,6 +1894,70 @@ int try_remount(struct autofs_point *ap, + return 0; + } + ++/* ++ * When exiting mounts need be set catatonic, regardless of whether they ++ * are busy on not, to avoid a hang on access once the daemon has gone ++ * away. ++ */ ++int set_mount_catatonic(struct autofs_point *ap, struct mapent *me, int ioctlfd) ++{ ++ struct ioctl_ops *ops = get_ioctl_ops(); ++ unsigned int opened = 0; ++ char buf[MAX_ERR_BUF]; ++ char *path; ++ int fd = -1; ++ int error; ++ dev_t dev; ++ ++ path = ap->path; ++ dev = ap->dev; ++ if (me && (ap->type == LKP_DIRECT || *me->key == '/')) { ++ path = me->key; ++ dev = me->dev; ++ } ++ ++ if (ioctlfd >= 0) ++ fd = ioctlfd; ++ else if (me && me->ioctlfd >= 0) ++ fd = me->ioctlfd; ++ else { ++ error = ops->open(ap->logopt, &fd, dev, path); ++ if (error == -1) { ++ int err = errno; ++ char *estr; ++ ++ estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ error(ap->logopt, ++ "failed to open ioctlfd for %s, error: %s", ++ path, estr); ++ return err; ++ } ++ opened = 1; ++ } ++ ++ if (fd >= 0) { ++ error = ops->catatonic(ap->logopt, fd); ++ if (error == -1) { ++ int err = errno; ++ char *estr; ++ ++ estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ error(ap->logopt, ++ "failed to set %s catatonic, error: %s", ++ path, estr); ++ if (opened) ++ ops->close(ap->logopt, fd); ++ return err; ++ } ++ if (opened) ++ ops->close(ap->logopt, fd); ++ } ++ ++ debug(ap->logopt, "set %s catatonic", path); ++ ++ return 0; ++} ++ + int umount_ent(struct autofs_point *ap, const char *path) + { + int rv; diff --git a/SOURCES/autofs-5.1.2-set-autofs-mounts-catatonic-at-exit.patch b/SOURCES/autofs-5.1.2-set-autofs-mounts-catatonic-at-exit.patch new file mode 100644 index 0000000..bac2be6 --- /dev/null +++ b/SOURCES/autofs-5.1.2-set-autofs-mounts-catatonic-at-exit.patch @@ -0,0 +1,207 @@ +autofs-5.1.2 - set autofs mounts catatonic at exit + +From: Ian Kent + +Setting direct mounts catatonic at exit doesn't go far enough. + +To avoid possible hang on access of automount managed paths when +the daemon has exited all mounted autofs file systems must be set +catatonic when the daemon exits. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/automount.c | 1 + daemon/direct.c | 17 ++++--------- + daemon/indirect.c | 3 -- + include/mounts.h | 3 +- + lib/mounts.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + 6 files changed, 78 insertions(+), 16 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -214,6 +214,7 @@ + - don't return until after master map retry read. + - make lookup_nss_read_master() return nss status. + - make set_direct_mount_catatonic() more general. ++- set autofs mounts catatonic at exit. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -1732,6 +1732,7 @@ int handle_mounts_exit(struct autofs_poi + */ + ret = umount_autofs(ap, NULL, 1); + if (!ret) { ++ set_indirect_mount_tree_catatonic(ap); + handle_mounts_cleanup(ap); + return 1; + } +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -130,20 +130,16 @@ int do_umount_autofs_direct(struct autof + error(ap->logopt, + "ask umount returned busy for %s", + me->key); +- if (ap->state != ST_READMAP) +- set_mount_catatonic(ap, me, ioctlfd); + if (opened) + ops->close(ap->logopt, ioctlfd); + return 1; + } else { + me->ioctlfd = -1; +- set_mount_catatonic(ap, me, ioctlfd); + ops->close(ap->logopt, ioctlfd); + goto force_umount; + } + } + me->ioctlfd = -1; +- set_mount_catatonic(ap, me, ioctlfd); + ops->close(ap->logopt, ioctlfd); + } else { + error(ap->logopt, +@@ -173,8 +169,11 @@ int do_umount_autofs_direct(struct autof + warn(ap->logopt, "mount point %s is in use", me->key); + if (ap->state == ST_SHUTDOWN_FORCE) + goto force_umount; +- else ++ else { ++ if (ap->state != ST_READMAP) ++ set_direct_mount_tree_catatonic(ap, me); + return 0; ++ } + break; + case ENOTDIR: + error(ap->logopt, "mount point is not a directory"); +@@ -238,12 +237,8 @@ int umount_autofs_direct(struct autofs_p + if (!error) + goto done; + +- error = set_mount_catatonic(ap, me, me->ioctlfd); +- if (!error) +- goto done; +- +- /* We really need to set this, last ditch attempt */ +- set_mount_catatonic(ap, me, -1); ++ if (ap->state != ST_READMAP) ++ set_direct_mount_tree_catatonic(ap, me); + done: + me = cache_enumerate(mc, me); + } +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -286,9 +286,6 @@ int umount_autofs_indirect(struct autofs + #endif + } + +- if (ap->shutdown) +- ops->catatonic(ap->logopt, ap->ioctlfd); +- + ops->close(ap->logopt, ap->ioctlfd); + ap->ioctlfd = -1; + sched_yield(); +--- autofs-5.0.7.orig/include/mounts.h ++++ autofs-5.0.7/include/mounts.h +@@ -114,7 +114,8 @@ void set_tsd_user_vars(unsigned int, uid + const char *mount_type_str(unsigned int); + void notify_mount_result(struct autofs_point *, const char *, time_t, const char *); + int try_remount(struct autofs_point *, struct mapent *, unsigned int); +-int set_mount_catatonic(struct autofs_point *, struct mapent *, int); ++void set_indirect_mount_tree_catatonic(struct autofs_point *); ++void set_direct_mount_tree_catatonic(struct autofs_point *, struct mapent *); + int umount_ent(struct autofs_point *, const char *); + int mount_multi_triggers(struct autofs_point *, struct mapent *, const char *, unsigned int, const char *); + int umount_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *); +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1899,7 +1899,7 @@ int try_remount(struct autofs_point *ap, + * are busy on not, to avoid a hang on access once the daemon has gone + * away. + */ +-int set_mount_catatonic(struct autofs_point *ap, struct mapent *me, int ioctlfd) ++static int set_mount_catatonic(struct autofs_point *ap, struct mapent *me, int ioctlfd) + { + struct ioctl_ops *ops = get_ioctl_ops(); + unsigned int opened = 0; +@@ -1926,6 +1926,9 @@ int set_mount_catatonic(struct autofs_po + int err = errno; + char *estr; + ++ if (errno == ENOENT) ++ return 0; ++ + estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(ap->logopt, + "failed to open ioctlfd for %s, error: %s", +@@ -1958,6 +1961,70 @@ int set_mount_catatonic(struct autofs_po + return 0; + } + ++static void set_multi_mount_tree_catatonic(struct autofs_point *ap, struct mapent *me) ++{ ++ if (!list_empty(&me->multi_list)) { ++ struct list_head *head = &me->multi_list; ++ struct list_head *p; ++ ++ list_for_each(p, head) { ++ struct mapent *this; ++ ++ this = list_entry(p, struct mapent, multi_list); ++ set_mount_catatonic(ap, this, this->ioctlfd); ++ } ++ } ++} ++ ++void set_indirect_mount_tree_catatonic(struct autofs_point *ap) ++{ ++ struct master_mapent *entry = ap->entry; ++ struct map_source *map; ++ struct mapent_cache *mc; ++ struct mapent *me; ++ ++ if (!is_mounted(_PROC_MOUNTS, ap->path, MNTS_AUTOFS)) ++ return; ++ ++ map = entry->maps; ++ while (map) { ++ mc = map->mc; ++ cache_readlock(mc); ++ me = cache_enumerate(mc, NULL); ++ while (me) { ++ /* Skip negative map entries and wildcard entries */ ++ if (!me->mapent) ++ goto next; ++ ++ if (!strcmp(me->key, "*")) ++ goto next; ++ ++ /* Only need to set offset mounts catatonic */ ++ if (me->multi && me->multi == me) ++ set_multi_mount_tree_catatonic(ap, me); ++next: ++ me = cache_enumerate(mc, me); ++ } ++ cache_unlock(mc); ++ map = map->next; ++ } ++ ++ /* By the time this function is called ap->ioctlfd will have ++ * been closed so don't try and use it. ++ */ ++ set_mount_catatonic(ap, NULL, -1); ++ ++ return; ++} ++ ++void set_direct_mount_tree_catatonic(struct autofs_point *ap, struct mapent *me) ++{ ++ /* Set offset mounts catatonic for this mapent */ ++ if (me->multi && me->multi == me) ++ set_multi_mount_tree_catatonic(ap, me); ++ set_mount_catatonic(ap, me, me->ioctlfd); ++} ++ + int umount_ent(struct autofs_point *ap, const char *path) + { + int rv; diff --git a/SOURCES/autofs-5.1.2-set-sane-default-master-read-wait-timeout.patch b/SOURCES/autofs-5.1.2-set-sane-default-master-read-wait-timeout.patch new file mode 100644 index 0000000..d1954ad --- /dev/null +++ b/SOURCES/autofs-5.1.2-set-sane-default-master-read-wait-timeout.patch @@ -0,0 +1,85 @@ +autofs-5.1.2 - set sane default master read wait timeout + +From: Ian Kent + +If an unused map source is configured in nss, with the default +of waiting indefinitely, autofs will not start. + +To restore the previous behaviour of this case set a sensible +default timeout for the configuration option master_wait. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/defaults.h | 2 +- + man/autofs.conf.5.in | 4 ++-- + redhat/autofs.conf.default.in | 6 +++--- + samples/autofs.conf.default.in | 6 +++--- + 5 files changed, 10 insertions(+), 9 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -210,6 +210,7 @@ + - add master read wait option. + - fix included master map not found return. + - dont exit on master map read fail timeout. ++- set sane default master read wait timeout. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/defaults.h ++++ autofs-5.0.7/include/defaults.h +@@ -25,7 +25,7 @@ + #define DEFAULT_MASTER_MAP_NAME "auto.master" + + #define DEFAULT_TIMEOUT "600" +-#define DEFAULT_MASTER_WAIT "-1" ++#define DEFAULT_MASTER_WAIT "10" + #define DEFAULT_NEGATIVE_TIMEOUT "60" + #define DEFAULT_MOUNT_WAIT "-1" + #define DEFAULT_UMOUNT_WAIT "12" +--- autofs-5.0.7.orig/man/autofs.conf.5.in ++++ autofs-5.0.7/man/autofs.conf.5.in +@@ -32,8 +32,8 @@ with earlier autofs releases. + .TP + .B master_wait + sets the default maximum time to wait for the master map to become +-available if it cannot be read at program start (program default -1, +-wait forever). ++available if it cannot be read at program start (program default 10, ++wait for 10 seconds then continue). + .TP + .B negative_timeout + .br +--- autofs-5.0.7.orig/redhat/autofs.conf.default.in ++++ autofs-5.0.7/redhat/autofs.conf.default.in +@@ -16,10 +16,10 @@ timeout = 300 + # + # master_wait - set the default maximum time to wait for the + # master map to become available if it cannot +-# be read at program start (default -1, wait +-# forever). ++# be read at program start (default 10, wait ++# for 10 seconds then continue). + # +-#master_wait = -1 ++#master_wait = 10 + # + # negative_timeout - set the default negative timeout for + # failed mount attempts (default 60). +--- autofs-5.0.7.orig/samples/autofs.conf.default.in ++++ autofs-5.0.7/samples/autofs.conf.default.in +@@ -16,10 +16,10 @@ timeout = 300 + # + # master_wait - set the default maximum time to wait for the + # master map to become available if it cannot +-# be read at program start (default -1, wait +-# forever). ++# be read at program start (default 10, wait ++# for 10 seconds then continue). + # +-# master_wait = -1 ++# master_wait = 10 + # + # negative_timeout - set the default negative timeout for + # failed mount attempts (default 60). diff --git a/SOURCES/autofs-5.1.2-update-and-add-README-for-old-autofs-schema.patch b/SOURCES/autofs-5.1.2-update-and-add-README-for-old-autofs-schema.patch new file mode 100644 index 0000000..b5e2d55 --- /dev/null +++ b/SOURCES/autofs-5.1.2-update-and-add-README-for-old-autofs-schema.patch @@ -0,0 +1,87 @@ +autofs-5.1.2 - update and add README for old autofs schema + +From: Ian Kent + +The distribution file samples/autofs.schema is very old and is +incorrect. + +This schema was added to the discribution long ago when it was +not clear what schema to use for Linux autofs information. + +The schema was updated (at least to have consistent OIDs) somewhere +along the line but the autofs distribution copy was never updated. +The schema has now been updated in autofs but it is not recommended +for use as the schema for autofs map information. + +The rfc2307 or, preferably the, rfc2307bis schema is the recommened +schema to use. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + README.autofs-schema | 22 ++++++++++++++++++++++ + samples/autofs.schema.new | 23 +++++++++++++++++++++++ + 3 files changed, 46 insertions(+) + create mode 100644 README.autofs-schema + +--- /dev/null ++++ autofs-5.0.7/README.autofs-schema +@@ -0,0 +1,22 @@ ++autofs schema ++============= ++ ++The distribution file samples/autofs.schema is very old and is ++incorrect. ++ ++This schema was added to the discribution long ago when it was ++not clear what schema to use for Linux autofs information. ++ ++The schema was corrected somewhere along the line but the autofs ++distribution copy was never updated. The schema has now been ++updated but it is not recommended for use as the schema for autofs ++map information. ++ ++The rfc2307 or, preferably the, rfc2307bis schema is the recommened ++schema to use. ++ ++Note: Upstream the schema file was updated but in RHEL-6 the old ++schema file has been left in place and the updated schema file ++add as autofs.schema.new. ++ ++Ian +--- /dev/null ++++ autofs-5.0.7/samples/autofs.schema.new +@@ -0,0 +1,23 @@ ++# Depends upon core.schema and cosine.schema ++ ++# OID Base is 1.3.6.1.4.1.2312.4 ++# ++# Attribute types are under 1.3.6.1.4.1.2312.4.1 ++# Object classes are under 1.3.6.1.4.1.2312.4.2 ++# Syntaxes are under 1.3.6.1.4.1.2312.4.3 ++ ++# Attribute Type Definitions ++ ++attributetype ( 1.3.6.1.4.1.2312.4.1.2 NAME 'automountInformation' ++ DESC 'Information used by the autofs automounter' ++ EQUALITY caseExactMatch ++ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) ++ ++objectclass ( 1.3.6.1.4.1.2312.4.2.3 NAME 'automount' SUP top STRUCTURAL ++ DESC 'An entry in an automounter map' ++ MUST ( cn $ automountInformation $ objectclass ) ++ MAY ( description ) ) ++ ++objectclass ( 1.3.6.1.4.1.2312.4.2.2 NAME 'automountMap' SUP top STRUCTURAL ++ DESC 'An group of related automount objects' ++ MUST ( ou ) ) +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -217,6 +217,7 @@ + - set autofs mounts catatonic at exit. + - check NFS server availability on local mount fallback. + - honor last rw in mount options when doing a bind mount. ++- update and add README for old autofs schema. + + 25/07/2012 autofs-5.0.7 + ======================= diff --git a/SOURCES/autofs-5.1.2-use-autofs_point-to-store-expire-timeout-where-possibe.patch b/SOURCES/autofs-5.1.2-use-autofs_point-to-store-expire-timeout-where-possibe.patch new file mode 100644 index 0000000..179a812 --- /dev/null +++ b/SOURCES/autofs-5.1.2-use-autofs_point-to-store-expire-timeout-where-possibe.patch @@ -0,0 +1,290 @@ +autofs-5.1.2 - use autofs_point to store expire timeout where possibe + +From: Ian Kent + +For technical reasons the expire timeout is stored in the map entry source +rather than the struct autofs_point and must be stored in the map source for +direct (and offset) mounts. + +But with the map source re-use needed by amd format type "auto" mounts the +timeout can't be stored in the map source since the it may be different for +mounts that share the map source. + +So use the struct autofs_point where possible. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 6 +++--- + daemon/indirect.c | 2 +- + daemon/state.c | 12 +++++++----- + include/automount.h | 1 + + include/mounts.h | 2 ++ + lib/master.c | 5 ++++- + lib/master_parse.y | 27 +++++++++++++-------------- + lib/mounts.c | 27 +++++++++++++++++++++------ + modules/mount_autofs.c | 12 ++++-------- + 10 files changed, 57 insertions(+), 38 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -242,6 +242,7 @@ + - add config option to use mount request log id. + - work around sss startup delay. + - add sss master map wait config option. ++- use autofs_point to store expire timeout where possibe. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -312,7 +312,7 @@ static int unlink_active_mounts(struct a + + if (tree_get_mnt_list(mnts, &list, me->key, 1)) { + if (ap->state == ST_READMAP) { +- time_t tout = me->source->exp_timeout; ++ time_t tout = get_exp_timeout(ap, me->source); + int save_ioctlfd, ioctlfd; + + save_ioctlfd = ioctlfd = me->ioctlfd; +@@ -518,7 +518,7 @@ int mount_autofs_direct(struct autofs_po + } + + mc = map->mc; +- timeout = map->exp_timeout; ++ timeout = get_exp_timeout(ap, map); + cache_readlock(mc); + pthread_cleanup_push(cache_lock_cleanup, mc); + me = cache_enumerate(mc, NULL); +@@ -674,7 +674,7 @@ int mount_autofs_offset(struct autofs_po + struct ioctl_ops *ops = get_ioctl_ops(); + char buf[MAX_ERR_BUF]; + struct mnt_params *mp; +- time_t timeout = me->source->exp_timeout; ++ time_t timeout = get_exp_timeout(ap, me->source); + struct stat st; + int ioctlfd, status, ret; + const char *hosts_map_name = "-hosts"; +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -87,7 +87,7 @@ static int do_mount_autofs_indirect(stru + { + const char *str_indirect = mount_type_str(t_indirect); + struct ioctl_ops *ops = get_ioctl_ops(); +- time_t timeout = ap->entry->maps->exp_timeout; ++ time_t timeout = get_exp_timeout(ap, ap->entry->maps); + char *options = NULL; + const char *hosts_map_name = "-hosts"; + const char *map_name = hosts_map_name; +--- autofs-5.0.7.orig/daemon/state.c ++++ autofs-5.0.7/daemon/state.c +@@ -407,6 +407,7 @@ static void do_readmap_mount(struct auto + if (valid) { + struct mapent_cache *vmc = valid->mc; + struct ioctl_ops *ops = get_ioctl_ops(); ++ time_t timeout; + time_t runfreq; + + cache_unlock(vmc); +@@ -428,9 +429,10 @@ static void do_readmap_mount(struct auto + cache_set_ino_index(vmc, me->key, me->dev, me->ino); + cache_unlock(vmc); + /* Set timeout and calculate the expire run frequency */ +- ops->timeout(ap->logopt, valid->ioctlfd, map->exp_timeout); +- if (map->exp_timeout) { +- runfreq = (map->exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO; ++ timeout = get_exp_timeout(ap, map); ++ ops->timeout(ap->logopt, valid->ioctlfd, timeout); ++ if (timeout) { ++ runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; + if (ap->exp_runfreq) + ap->exp_runfreq = min(ap->exp_runfreq, runfreq); + else +@@ -442,7 +444,7 @@ static void do_readmap_mount(struct auto + debug(ap->logopt, + "%s is mounted", me->key); + } else +- do_mount_autofs_direct(ap, mnts, me, map->exp_timeout); ++ do_mount_autofs_direct(ap, mnts, me, get_exp_timeout(ap, map)); + + return; + } +@@ -491,7 +493,7 @@ static void *do_readmap(void *arg) + + if (ap->type == LKP_INDIRECT) { + struct ioctl_ops *ops = get_ioctl_ops(); +- time_t timeout = ap->entry->maps->exp_timeout; ++ time_t timeout = get_exp_timeout(ap, ap->entry->maps); + ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; + ops->timeout(ap->logopt, ap->ioctlfd, timeout); + lookup_prune_cache(ap, now); +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -527,6 +527,7 @@ struct autofs_point { + dev_t dev; /* "Device" number assigned by kernel */ + struct master_mapent *entry; /* Master map entry for this mount */ + unsigned int type; /* Type of map direct or indirect */ ++ time_t exp_timeout; /* Indirect mount expire timeout */ + time_t exp_runfreq; /* Frequency for polling for timeouts */ + time_t negative_timeout; /* timeout in secs for failed mounts */ + unsigned int flags; /* autofs mount flags */ +--- autofs-5.0.7.orig/include/mounts.h ++++ autofs-5.0.7/include/mounts.h +@@ -112,6 +112,8 @@ int tree_find_mnt_ents(struct mnt_list * + int tree_is_mounted(struct mnt_list *mnts, const char *path, unsigned int type); + void set_tsd_user_vars(unsigned int, uid_t, gid_t); + const char *mount_type_str(unsigned int); ++void set_exp_timeout(struct autofs_point *ap, struct map_source *source, time_t timeout); ++time_t get_exp_timeout(struct autofs_point *ap, struct map_source *source); + void notify_mount_result(struct autofs_point *, const char *, time_t, const char *); + int try_remount(struct autofs_point *, struct mapent *, unsigned int); + void set_indirect_mount_tree_catatonic(struct autofs_point *); +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -99,6 +99,7 @@ int master_add_autofs_point(struct maste + ap->negative_timeout = defaults_get_negative_timeout(); + else + ap->negative_timeout = global_negative_timeout; ++ ap->exp_timeout = defaults_get_timeout(); + ap->exp_runfreq = 0; + ap->flags = 0; + if (ghost) +@@ -980,6 +981,7 @@ static void master_add_amd_mount_section + while (paths[i]) { + const char *path = paths[i]; + unsigned int ghost = 0; ++ time_t timeout; + char *type = NULL; + char *map = NULL; + char *opts; +@@ -1065,7 +1067,8 @@ static void master_add_amd_mount_section + goto next; + } + +- source->exp_timeout = conf_amd_get_dismount_interval(path); ++ timeout = conf_amd_get_dismount_interval(path); ++ set_exp_timeout(entry->ap, source, timeout); + source->master_line = 0; + + entry->age = age; +--- autofs-5.0.7.orig/lib/master_parse.y ++++ autofs-5.0.7/lib/master_parse.y +@@ -823,19 +823,6 @@ int master_parse_entry(const char *buffe + ghost = 1; + } + +- if (timeout < 0) { +- /* +- * If no timeout is given get the timout from the +- * first map (if it exists) or the config for amd +- * maps. +- */ +- if (format && !strcmp(format, "amd")) +- timeout = conf_amd_get_dismount_interval(path); +- else if (entry->maps) +- timeout = entry->maps->exp_timeout; +- else +- timeout = default_timeout; +- } + + if (!entry->ap) { + ret = master_add_autofs_point(entry, logopt, nobind, ghost, 0); +@@ -856,6 +843,18 @@ int master_parse_entry(const char *buffe + if (negative_timeout) + entry->ap->negative_timeout = negative_timeout; + ++ if (timeout < 0) { ++ /* ++ * If no timeout is given get the timout from the ++ * autofs point, or the first map, or the config ++ * for amd maps. ++ */ ++ if (format && !strcmp(format, "amd")) ++ timeout = conf_amd_get_dismount_interval(path); ++ else ++ timeout = get_exp_timeout(entry->ap, entry->maps); ++ } ++ + if (format && !strcmp(format, "amd")) { + char *opts = conf_amd_get_map_options(path); + if (opts) { +@@ -890,7 +889,7 @@ int master_parse_entry(const char *buffe + local_free_vars(); + return 0; + } +- source->exp_timeout = timeout; ++ set_exp_timeout(entry->ap, source, timeout); + source->master_line = lineno; + + entry->age = age; +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1616,6 +1616,24 @@ const char *mount_type_str(const unsigne + return (pos == type_count ? NULL : str_type[pos]); + } + ++void set_exp_timeout(struct autofs_point *ap, ++ struct map_source *source, time_t timeout) ++{ ++ ap->exp_timeout = timeout; ++ if (source) ++ source->exp_timeout = timeout; ++} ++ ++time_t get_exp_timeout(struct autofs_point *ap, struct map_source *source) ++{ ++ time_t timeout = ap->exp_timeout; ++ ++ if (source && ap->type == LKP_DIRECT) ++ timeout = source->exp_timeout; ++ ++ return timeout; ++} ++ + void notify_mount_result(struct autofs_point *ap, + const char *path, time_t timeout, const char *type) + { +@@ -1747,12 +1765,9 @@ static int remount_active_mount(struct a + ops->open(ap->logopt, &fd, devid, path); + if (fd == -1) + return REMOUNT_OPEN_FAIL; +- else { +- if (type == t_indirect || type == t_offset) +- timeout = ap->entry->maps->exp_timeout; +- else +- timeout = me->source->exp_timeout; +- } ++ ++ error(ap->logopt, "ap->type %d type %u", ap->type, type); ++ timeout = get_exp_timeout(ap, me->source); + + /* Re-reading the map, set timeout and return */ + if (ap->state == ST_READMAP) { +--- autofs-5.0.7.orig/modules/mount_autofs.c ++++ autofs-5.0.7/modules/mount_autofs.c +@@ -57,7 +57,7 @@ int mount_mount(struct autofs_point *ap, + int nobind = ap->flags & MOUNT_FLAG_NOBIND; + int ghost = ap->flags & MOUNT_FLAG_GHOST; + int symlnk = ap->flags & MOUNT_FLAG_SYMLINK; +- time_t timeout = ap->entry->maps->exp_timeout; ++ time_t timeout = get_exp_timeout(ap, ap->entry->maps); + unsigned logopt = ap->logopt; + struct map_type_info *info; + struct master *master; +@@ -272,13 +272,9 @@ int mount_mount(struct autofs_point *ap, + return 1; + } + free_map_type_info(info); +- /* The exp_timeout can't be inherited if the map is shared, so +- * the autofs point exp_runfreq must be set here. +- */ +- if (source->ref <= 1) +- source->exp_timeout = timeout; +- else +- nap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; ++ ++ set_exp_timeout(nap, NULL, timeout); ++ nap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; + + mounts_mutex_lock(ap); + diff --git a/SOURCES/autofs-5.1.2-wait-for-master-map-available-at-start.patch b/SOURCES/autofs-5.1.2-wait-for-master-map-available-at-start.patch new file mode 100644 index 0000000..22d275f --- /dev/null +++ b/SOURCES/autofs-5.1.2-wait-for-master-map-available-at-start.patch @@ -0,0 +1,280 @@ +autofs-5.1.2 - wait for master map available at start + +From: Ian Kent + +If the network map source isn't available at start the master map +can't be read. In this case we should wait until it is available +so we can get a startup map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + daemon/automount.c | 81 +++++++++++++++++++++++++++++++++++++++++------ + daemon/lookup.c | 8 ++++ + lib/master.c | 3 + + modules/lookup_file.c | 6 +++ + modules/lookup_nisplus.c | 14 +++++--- + modules/lookup_yp.c | 13 +++++-- + 7 files changed, 108 insertions(+), 18 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -206,6 +206,7 @@ + - add configuration option to use fqdn in mounts. + - fix use-after-free in st_queue_handler(). + - add config option to supress not found log message. ++- wait for master map available at start. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -1379,9 +1379,10 @@ static void *do_read_master(void *arg) + return NULL; + } + +-static int do_hup_signal(struct master *master, time_t age) ++static int do_hup_signal(struct master *master) + { + unsigned int logopt = master->logopt; ++ time_t age = time(NULL); + pthread_t thid; + int status; + +@@ -1470,7 +1471,7 @@ static void *statemachine(void *arg) + break; + + case SIGHUP: +- do_hup_signal(master_list, time(NULL)); ++ do_hup_signal(master_list); + break; + + default: +@@ -2031,12 +2032,56 @@ static void remove_empty_args(char **arg + *argc = j; + } + ++static int do_master_read_master(struct master *master, int wait) ++{ ++ sigset_t signalset; ++ /* Wait must be at least 1 second */ ++ unsigned int retry_wait = 2; ++ unsigned int elapsed = 0; ++ int max_wait = wait; ++ int ret = 0; ++ time_t age; ++ ++ sigemptyset(&signalset); ++ sigaddset(&signalset, SIGTERM); ++ sigaddset(&signalset, SIGINT); ++ sigaddset(&signalset, SIGHUP); ++ sigprocmask(SIG_UNBLOCK, &signalset, NULL); ++ ++ while (1) { ++ struct timespec t = { retry_wait, 0 }; ++ ++ age = time(NULL); ++ if (master_read_master(master, age, 0)) { ++ ret = 1; ++ break; ++ } ++ ++ if (nanosleep(&t, NULL) == -1) ++ break; ++ ++ if (max_wait > 0) { ++ elapsed += retry_wait; ++ if (elapsed >= max_wait) { ++ logmsg("problem reading master map, " ++ "maximum wait exceeded"); ++ break; ++ } ++ } ++ } ++ ++ sigprocmask(SIG_BLOCK, &signalset, NULL); ++ ++ return ret; ++} ++ + int main(int argc, char *argv[]) + { + int res, opt, status; + int logpri = -1; + unsigned ghost, logging, daemon_check; + unsigned dumpmaps, foreground, have_global_options; ++ unsigned master_read; + time_t timeout; + time_t age = time(NULL); + struct rlimit rlim; +@@ -2429,14 +2474,16 @@ int main(int argc, char *argv[]) + dh_tirpc = dlopen("libtirpc.so.1", RTLD_NOW); + #endif + +- if (!master_read_master(master_list, age, 0)) { +- master_kill(master_list); +- *pst_stat = 3; +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); +- release_flag_file(); +- macro_free_global_table(); +- exit(3); ++ master_read = master_read_master(master_list, age, 0); ++ if (!master_read) { ++ if (foreground) ++ logerr("%s: failed to read master map, " ++ "will retry!", ++ program); ++ else ++ logerr("%s: failed to read master map, " ++ "will retry in background!", ++ program); + } + + /* +@@ -2449,6 +2496,20 @@ int main(int argc, char *argv[]) + res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); + close(start_pipefd[1]); + ++ if (!master_read) { ++ /* ++ * Read master map, waiting until it is available, unless ++ * a signal is received, in which case exit returning an ++ * error. ++ */ ++ if (!do_master_read_master(master_list, -1)) { ++ logerr("%s: failed to read master map!", program); ++ master_kill(master_list); ++ release_flag_file(); ++ exit(3); ++ } ++ } ++ + state_mach_thid = pthread_self(); + statemachine(NULL); + +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -241,6 +241,7 @@ int lookup_nss_read_master(struct master + } + + /* First one gets it */ ++ result = NSS_STATUS_UNKNOWN; + head = &nsslist; + list_for_each(p, head) { + struct nss_source *this; +@@ -248,6 +249,13 @@ int lookup_nss_read_master(struct master + + this = list_entry(p, struct nss_source, list); + ++ if (strncmp(this->source, "files", 5) && ++ strncmp(this->source, "nis", 3) && ++ strncmp(this->source, "nisplus", 7) && ++ strncmp(this->source, "ldap", 4) && ++ strncmp(this->source, "sss", 3)) ++ continue; ++ + debug(logopt, + "reading master %s %s", this->source, master->name); + +--- autofs-5.0.7.orig/lib/master.c ++++ autofs-5.0.7/lib/master.c +@@ -922,7 +922,10 @@ int master_read_master(struct master *ma + master_mount_mounts(master, age, readall); + else { + master->read_fail = 0; ++ /* HUP signal sets readall == 1 only */ + if (!readall) ++ return 0; ++ else + master_mount_mounts(master, age, readall); + } + +--- autofs-5.0.7.orig/modules/lookup_file.c ++++ autofs-5.0.7/modules/lookup_file.c +@@ -506,6 +506,12 @@ int lookup_read_master(struct master *ma + MODPREFIX + "failed to read included master map %s", + master->name); ++ /* ++ * If we're starting up wee need the whole ++ * master map initially, so tell the upper ++ * layer to retry. ++ */ ++ master->read_fail = 1; + } + master->depth--; + master->recurse = 0; +--- autofs-5.0.7.orig/modules/lookup_nisplus.c ++++ autofs-5.0.7/modules/lookup_nisplus.c +@@ -149,19 +149,25 @@ int lookup_read_master(struct master *ma + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + logerr(MODPREFIX "malloc: %s", estr); + pthread_setcancelstate(cur_state, NULL); +- return NSS_STATUS_UNAVAIL; ++ return NSS_STATUS_UNKNOWN; + } + sprintf(tablename, "%s.org_dir.%s", ctxt->mapname, ctxt->domainname); + + /* check that the table exists */ + result = nis_lookup(tablename, FOLLOW_PATH | FOLLOW_LINKS); + if (result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) { ++ int status = result->status; + nis_freeresult(result); +- crit(logopt, +- MODPREFIX "couldn't locate nis+ table %s", ctxt->mapname); + free(tablename); + pthread_setcancelstate(cur_state, NULL); +- return NSS_STATUS_NOTFOUND; ++ if (status == NIS_UNAVAIL || status == NIS_FAIL) ++ return NSS_STATUS_UNAVAIL; ++ else { ++ crit(logopt, ++ MODPREFIX "couldn't locate nis+ table %s", ++ ctxt->mapname); ++ return NSS_STATUS_NOTFOUND; ++ } + } + + sprintf(tablename, "[],%s.org_dir.%s", ctxt->mapname, ctxt->domainname); +--- autofs-5.0.7.orig/modules/lookup_yp.c ++++ autofs-5.0.7/modules/lookup_yp.c +@@ -282,9 +282,9 @@ int lookup_read_master(struct master *ma + char *mapname; + int err; + +- mapname = alloca(strlen(ctxt->mapname) + 1); ++ mapname = malloc(strlen(ctxt->mapname) + 1); + if (!mapname) +- return 0; ++ return NSS_STATUS_UNKNOWN; + + strcpy(mapname, ctxt->mapname); + +@@ -308,19 +308,24 @@ int lookup_read_master(struct master *ma + err = yp_all((char *) ctxt->domainname, mapname, &ypcb); + } + +- if (err == YPERR_SUCCESS) ++ if (err == YPERR_SUCCESS) { ++ free(mapname); + return NSS_STATUS_SUCCESS; ++ } + + info(logopt, + MODPREFIX "read of master map %s failed: %s", + mapname, yperr_string(err)); + +- if (err == YPERR_PMAP || err == YPERR_YPSERV) ++ free(mapname); ++ ++ if (err == YPERR_YPSERV || err == YPERR_DOMAIN) + return NSS_STATUS_UNAVAIL; + + return NSS_STATUS_NOTFOUND; + } + ++ free(mapname); + return NSS_STATUS_SUCCESS; + } + diff --git a/SOURCES/autofs-5.1.2-work-around-sss-startup-delay.patch b/SOURCES/autofs-5.1.2-work-around-sss-startup-delay.patch new file mode 100644 index 0000000..cae6a0b --- /dev/null +++ b/SOURCES/autofs-5.1.2-work-around-sss-startup-delay.patch @@ -0,0 +1,113 @@ +autofs-5.1.2 - work around sss startup delay + +From: Ian Kent + +When sssd is starting up there can be a delay before the map +information is read. During that time an ENOENT can be returned +when there actually is a map and autofs must respect the ENOENT +return and continue because no map present is a valid response. + +To work around that make the master map read wait and retry for +for a time to give sssd a chance to read the map before returning +either an ENOENT or, if the retry limit is exceeded, ETIMEDOUT. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + modules/lookup_sss.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 62 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -240,6 +240,7 @@ + - log functions to prefix messages with attempt_id if available. + - factor out set_thread_mount_request_log_id(). + - add config option to use mount request log id. ++- work around sss startup delay. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/lookup_sss.c ++++ autofs-5.0.7/modules/lookup_sss.c +@@ -30,6 +30,11 @@ + + #define MAPFMT_DEFAULT "sun" + ++/* Half a second between retries */ ++#define SETAUTOMOUNTENT_MASTER_INTERVAL 500000000 ++/* Try for 10 seconds */ ++#define SETAUTOMOUNTENT_MASTER_RETRIES 10 * 2 ++ + #define MODPREFIX "lookup(sss): " + + #define SSS_SO_NAME "libsss_autofs" +@@ -219,6 +224,53 @@ static int setautomntent(unsigned int lo + return ret; + } + ++static int setautomntent_wait(unsigned int logopt, ++ struct lookup_context *ctxt, ++ const char *mapname, ++ void **sss_ctxt, unsigned int retries) ++{ ++ unsigned int retry = 0; ++ int ret = 0; ++ ++ *sss_ctxt = NULL; ++ ++ while (++retry < retries) { ++ struct timespec t = { 0, SETAUTOMOUNTENT_MASTER_INTERVAL }; ++ struct timespec r; ++ ++ ret = ctxt->setautomntent(mapname, sss_ctxt); ++ if (ret != ENOENT) ++ break; ++ ++ if (*sss_ctxt) { ++ free(*sss_ctxt); ++ *sss_ctxt = NULL; ++ } ++ ++ while (nanosleep(&t, &r) == -1 && errno == EINTR) ++ memcpy(&t, &r, sizeof(struct timespec)); ++ } ++ ++ ++ if (ret) { ++ char buf[MAX_ERR_BUF]; ++ char *estr; ++ ++ if (*sss_ctxt) { ++ free(*sss_ctxt); ++ *sss_ctxt = NULL; ++ } ++ ++ if (retry == retries) ++ ret = ETIMEDOUT; ++ ++ estr = strerror_r(ret, buf, MAX_ERR_BUF); ++ error(logopt, MODPREFIX "setautomntent: %s", estr); ++ } ++ ++ return ret; ++} ++ + static int endautomntent(unsigned int logopt, + struct lookup_context *ctxt, void **sss_ctxt) + { +@@ -247,6 +299,15 @@ int lookup_read_master(struct master *ma + + ret = setautomntent(logopt, ctxt, ctxt->mapname, &sss_ctxt); + if (ret) { ++ unsigned int retries; ++ ++ if (ret != ENOENT) ++ return NSS_STATUS_UNAVAIL; ++ ++ retries = SETAUTOMOUNTENT_MASTER_RETRIES; ++ ret = setautomntent_wait(logopt, ++ ctxt, ctxt->mapname, &sss_ctxt, ++ retries); + if (ret == ENOENT) + return NSS_STATUS_NOTFOUND; + return NSS_STATUS_UNAVAIL; diff --git a/SOURCES/autofs-5.1.3-fix-unset-tsd-group-name-handling.patch b/SOURCES/autofs-5.1.3-fix-unset-tsd-group-name-handling.patch new file mode 100644 index 0000000..d1656e4 --- /dev/null +++ b/SOURCES/autofs-5.1.3-fix-unset-tsd-group-name-handling.patch @@ -0,0 +1,75 @@ +autofs-5.1.3 - fix unset tsd group name handling + +From: Ian Kent + +Commit 1a64a6bbc5 changed set_tsd_user_vars() to the thread specific +values even if the group name could not be obtained. + +But the structure holding the values was not initialized on allocation +so the group field might not be NULL when no group name is available. + +Also the macro addition and removal functions didn't properly handle a +macro value of NULL. + +Signed-off-by: Ian Kent +Reported-by: Donald Buczek +--- + CHANGELOG | 1 + + lib/macros.c | 8 +++++--- + lib/mounts.c | 1 + + 3 files changed, 7 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -250,6 +250,7 @@ + - increase worker thread per-thread stack size. + - limit getgrgid_r() buffer size. + - add congigure option for limiting getgrgid_r() stack usage. ++- fix unset tsd group name handling. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/macros.c ++++ autofs-5.0.7/lib/macros.c +@@ -281,18 +281,20 @@ macro_addvar(struct substvar *table, con + } + + if (lv) { +- char *this = malloc(strlen(value) + 1); ++ const char *val = value ? value : ""; ++ char *this = malloc(strlen(val) + 1); + if (!this) { + lv = table; + goto done; + } +- strcpy(this, value); ++ strcpy(this, val); + free(lv->val); + lv->val = this; + if (lv != table) + lv = table; + } else { + struct substvar *new; ++ const char *this = value ? value : ""; + char *def, *val; + + def = strdup(str); +@@ -302,7 +304,7 @@ macro_addvar(struct substvar *table, con + } + def[len] = '\0'; + +- val = strdup(value); ++ val = strdup(this); + if (!val) { + lv = table; + free(def); +--- autofs-5.0.7.orig/lib/mounts.c ++++ autofs-5.0.7/lib/mounts.c +@@ -1456,6 +1456,7 @@ void set_tsd_user_vars(unsigned int logo + error(logopt, "failed alloc tsv storage"); + return; + } ++ memset(tsv, 0, sizeof(struct thread_stdenv_vars)); + + tsv->uid = uid; + tsv->gid = gid; diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index 9b903b1..47c02bb 100644 --- a/SPECS/autofs.spec +++ b/SPECS/autofs.spec @@ -8,7 +8,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.0.7 -Release: 56%{?dist} +Release: 69%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -353,6 +353,59 @@ Patch741: autofs-5.1.1-add-configuration-option-to-use-hostname-in-mounts.patch Patch742: autofs-5.1.1-fix-use-after-free-st_queue_handler.patch Patch743: autofs-5.1.1-add-config-option-to-suppress-not-found-log-message.patch +Patch744: autofs-5.1.2-wait-for-master-map-available-at-start.patch +Patch745: autofs-5.1.2-add-master-read-wait-option.patch +Patch746: autofs-5.1.2-fix-included-master-map-not-found-return.patch +Patch747: autofs-5.1.2-dont-fail-on-master-map-read-fail-timeout.patch +Patch748: autofs-5.1.2-set-sane-default-master-read-wait-timeout.patch +Patch749: autofs-5.1.2-dont-return-until-after-master-map-retry-read.patch +Patch750: autofs-5.1.2-make-lookup_nss_read_master-return-nss-status.patch + +Patch751: autofs-5.1.2-make-set_direct_mount_catatonic-more-general.patch +Patch752: autofs-5.1.2-set-autofs-mounts-catatonic-at-exit.patch +Patch753: autofs-5.1.2-check-NFS-server-availability-on-local-mount-fallback.patch +Patch754: autofs-5.1.2-honor-last-rw-in-mount-options-when-doing-a-bind-mount.patch +Patch755: autofs-5.1.2-update-and-add-README-for-old-autofs-schema.patch + +# Bug 1367576 - amd mounts browse mode +Patch760: autofs-5.1.2-fix-short-memory-allocation-in-lookup_amd_instance.patch +Patch761: autofs-5.1.2-fix-count_mounts-function.patch +Patch762: autofs-5.1.2-fix-argc-off-by-one-in-mount_autofs_c.patch +Patch763: autofs-5.1.2-fix-_strncmp-usage.patch +Patch764: autofs-5.1.2-fix-typos-in-README.amd-maps.patch +Patch765: autofs-5.1.2-add-ref-counting-to-struct-map_source.patch +Patch766: autofs-5.1.2-add-support-for-amd-browsable-option.patch +Patch767: autofs-5.1.2-add-function-conf_amd_get_map_name.patch +Patch768: autofs-5.1.2-add-function-conf_amd_get_mount_paths.patch +Patch769: autofs-5.1.2-include-amd-mount-section-mounts-in-master-mounts-list.patch +Patch770: autofs-5.1.2-check-for-conflicting-amd-section-mounts.patch +Patch771: autofs-5.1.2-add-function-conf_amd_get_map_options.patch +Patch772: autofs-5.1.2-capture-cache-option-and-its-settings-during-parsing.patch +Patch773: autofs-5.1.2-handle-map_option-cache-for-top-level-mounts.patch +Patch774: autofs-5.1.2-handle-amd-cache-option-all-in-amd-type-auto-mounts.patch +Patch775: autofs-5.1.2-fix-bogus-check-in-expire_cleanup.patch +Patch776: autofs-5.1.2-delay-submount-exit-for-amd-submounts.patch + +Patch777: autofs-5.1.2-add-the-mount-requestor-s-pid-to-pending_args.patch +Patch778: autofs-5.1.2-create-thread-local-ID-for-mount-attempts.patch +Patch779: autofs-5.1.2-log-functions-to-prefix-messages-with-attempt_id-if-available.patch +Patch780: autofs-5.1.2-factor-out-set-thread-mount-request-log-id.patch +Patch781: autofs-5.1.2-add-config-option-to-use-mount-request-log-id.patch + +Patch782: autofs-5.1.2-work-around-sss-startup-delay.patch +Patch783: autofs-5.1.2-add-sss-master-map-wait-config-option.patch + +Patch784: autofs-5.1.2-use-autofs_point-to-store-expire-timeout-where-possibe.patch +Patch785: autofs-5.1.2-fix-possible-NULL-derefernce.patch +Patch786: autofs-5.1.2-fix-work-around-sss-startup-delay.patch + +Patch787: autofs-5.1.1-improve-scalability-of-direct-mount-path-component-creation.patch +Patch788: autofs-5.1.2-fix-invalid-reference-in-remount_active_mount.patch +Patch789: autofs-5.1.2-increase-worker-thread-per-thread-stack-size.patch +Patch790: autofs-5.1.2-limit-getgrgid_r-buffer-size.patch +Patch791: autofs-5.1.2-add-congigure-option-for-limiting-getgrgid_r-stack-usage.patch +Patch792: autofs-5.1.3-fix-unset-tsd-group-name-handling.patch + Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if %{with_systemd} BuildRequires: systemd-units @@ -743,9 +796,66 @@ echo %{version}-%{release} > .version %patch742 -p1 %patch743 -p1 +%patch744 -p1 +%patch745 -p1 +%patch746 -p1 +%patch747 -p1 +%patch748 -p1 +%patch749 -p1 +%patch750 -p1 + +%patch751 -p1 +%patch752 -p1 +%patch753 -p1 +%patch754 -p1 +%patch755 -p1 + +# Bug 1367576 +%patch760 -p1 +%patch761 -p1 +%patch762 -p1 +%patch763 -p1 +%patch764 -p1 +%patch765 -p1 +%patch766 -p1 +%patch767 -p1 +%patch768 -p1 +%patch769 -p1 +%patch770 -p1 +%patch771 -p1 +%patch772 -p1 +%patch773 -p1 +%patch774 -p1 +%patch775 -p1 +%patch776 -p1 + +%patch777 -p1 +%patch778 -p1 +%patch779 -p1 +%patch780 -p1 +%patch781 -p1 + +%patch782 -p1 +%patch783 -p1 + +%patch784 -p1 +%patch785 -p1 +%patch786 -p1 + +%patch787 -p1 +%patch788 -p1 +%patch789 -p1 +%patch790 -p1 +%patch791 -p1 +%patch792 -p1 + %build LDFLAGS=-Wl,-z,now -%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:} +%configure --disable-mount-locking \ + --enable-ignore-busy \ + --with-libtirpc \ + --enable-limit-getgrgid-size \ + %{?systemd_configure_arg:} make initdir=%{_initrddir} DONTSTRIP=1 %install @@ -820,7 +930,7 @@ fi %files %defattr(-,root,root,-) -%doc CREDITS INSTALL COPY* README* patches/* samples/ldap* samples/autofs.schema +%doc CREDITS INSTALL COPY* README* patches/* samples/ldap* samples/autofs.schema samples/autofs.schema.new %config %{init_file_name} %config(noreplace,missingok) /etc/auto.master %config(noreplace,missingok) /etc/auto.misc @@ -835,6 +945,115 @@ fi %dir /etc/auto.master.d %changelog +* Fri Jun 2 2017 Ian Kent - 5.0.7-69 +- bz1435736 - autofs fails with kernel: automount[3386]: + segfault at 7f3fb7595ca8 ip 00007f3fb61e353a sp 00007f3fb7595cb0 + error 6 in libc-2.17.so[7f3fb60b7000+1b6000] + - fix a couple of covarity warning resulting in group name handling change. +- Related: rhbz#1435736 + +* Fri Jun 2 2017 Ian Kent - 5.0.7-68 +- bz1435736 - autofs fails with kernel: automount[3386]: + segfault at 7f3fb7595ca8 ip 00007f3fb61e353a sp 00007f3fb7595cb0 + error 6 in libc-2.17.so[7f3fb60b7000+1b6000] + - fix unset tsd group name handling. +- Related: rhbz#1435736 + +* Fri May 05 2017 Ian Kent - 5.0.7-66 +- bz1435736 - autofs fails with kernel: automount[3386]: + segfault at 7f3fb7595ca8 ip 00007f3fb61e353a sp 00007f3fb7595cb0 + error 6 in libc-2.17.so[7f3fb60b7000+1b6000] + - increase worker thread per-thread stack size. + - limit getgrgid_r() buffer size. + - add congigure option for limiting getgrgid_r() stack usage. + - use above option to limit getgrgid_r() stack usage with configure. +- Resolves: rhbz#1435736 + +* Mon Apr 24 2017 Ian Kent - 5.0.7-65 +- bz1367576 - [RFE] Add browsing support into autofs for AMD format maps + - fix invalid reference in remount_active_mount(). +- Related: rhbz#1367576 + +* Mon Apr 17 2017 Ian Kent - 5.0.7-64 +- bz1440769 - autofs is facing scalability issues + - improve scalability of direct mount path component creation. +- Resolves: rhbz#1440769 + +* Thu Mar 30 2017 Ian Kent - 5.0.7-63 +- bz1101782 - autofs configured with sssd is not finding any maps + - fix work around sss startup delay. +- bz1367576 - [RFE] Add browsing support into autofs for AMD format maps + - fix possible NULL derefernce. +- Related: rhbz#1101782 rhbz#1367576 + +* Mon Mar 27 2017 Ian Kent - 5.0.7-62 +- bz1367576 - [RFE] Add browsing support into autofs for AMD format maps + - use autofs_point to store expire timeout where possibe. +- Related: rhbz#1367576 + +* Mon Mar 20 2017 Ian Kent - 5.0.7-61 +- bz1101782 - autofs configured with sssd is not finding any maps + - work around sss startup delay. + - add sss master map wait config option (wait initially 0, disabled). +- Resolves: rhbz#1101782 + +* Mon Mar 20 2017 Ian Kent - 5.0.7-60 + - bz1382093 - Improve logging in autofs + - add the mount requestor's pid to pending_args. + - create thread-local ID for mount attempts. + - log functions to prefix messages with attempt_id if available. + - factor out set_thread_mount_request_log_id(). + - add config option to use mount request log id. +- Resolves: rhbz#1382093 + +* Wed Mar 15 2017 Ian Kent - 5.0.7-59 +- bz1383910 - Incorrect autofs.schema + - update and add README for old autofs schema +- bz1367576 - [RFE] Add browsing support into autofs for AMD format maps + - fix short memory allocation in lookup_amd_instance(). + - fix count_mounts() function. + - fix argc off by one in mount_autofs.c. + - fix _strncmp() usage. + - fix typos in README.amd-maps. + - add ref counting to struct map_source. + - add support for amd browsable option. + - add function conf_amd_get_map_name(). + - add function conf_amd_get_mount_paths(). + - include amd mount section mounts in master mounts list. + - check for conflicting amd section mounts. + - add function conf_amd_get_map_options(). + - capture cache option and its settings during parsing. + - handle map_option cache for top level mounts. + - handle amd cache option all in amd type auto mounts. + - fix bogus check in expire_cleanup(). + - delay submount exit for amd submounts. +- Resolves: rhbz#1383910 rhbz#1367576 + +* Wed Mar 01 2017 Ian Kent - 5.0.7-58 +- bz1420584 - RHEL7.3: shutdown / reboot hangs with findmnt in a readlink + system call, doing path_walk and stuck in autofs4_wait + - make set_direct_mount_catatonic() more general. + - set autofs mounts catatonic at exit. +- bz1396403 - Trying to access a non-existent directory using automount + results in 4 minute hang as not checking the local mount availability + - check NFS server availability on local mount fallback. +- bz1399796 - local nfs share being bind-mounted by autofs is mounted + read-only even when marked rw in its map + - honor last rw in mount options when doing a bind mount. +- Resolves: rhbz#1420584 rhbz#1396403 rhbz#1399796 + +* Sat Feb 04 2017 Ian Kent - 5.0.7-57 +- bz1383194 - On every system boot automount needs a restart to access + NIS map + - wait for master map available at start. + - add master read wait option. + - fix included master map not found return. + - dont exit on master map read fail timeout. + - set sane default master read wait timeout. + - don't return until after master map retry read. + - make lookup_nss_read_master() return nss status. +- Resolves: rhbz#1383194 + * Wed May 25 2016 Ian Kent - 1:5.0.7-56 - bz1327388 - Fix use-after-free in st_queue_handler - fix use-after-free in st_queue_handler().