diff --git a/SOURCES/autofs-5.1.1-fix-create_client-RPC-client-handling.patch b/SOURCES/autofs-5.1.1-fix-create_client-RPC-client-handling.patch new file mode 100644 index 0000000..c36a2b0 --- /dev/null +++ b/SOURCES/autofs-5.1.1-fix-create_client-RPC-client-handling.patch @@ -0,0 +1,104 @@ +autofs-5.1.1 - fix create_client() RPC client handling + +From: Ian Kent + +The autofs socket minimization strategy is to reuse the socket +descriptor when creating an RPC client for the same protocol. + +But in create_client() there is a case where the socket descriptor +can be obtained from RPC client, the RPC client destroyed, but +not cleared in the persistent data structure. + +In create_client(), once an attempt is done to get the socket +descriptor, the RPC client should always be destroyed and cleared +in the persistent data structure. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/rpc_subs.c | 21 ++++++++------------- + 2 files changed, 9 insertions(+), 13 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -295,6 +295,7 @@ + - fix prefix option handling in expand_entry(). + - fix sublink option not set from defaults. + - fix error return in do_nfs_mount(). ++- fix create_client() RPC client handling. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -663,14 +663,12 @@ static int create_client(struct conn_inf + *client = NULL; + + if (info->client) { +- if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) { +- fd = RPC_ANYSOCK; +- clnt_destroy(info->client); +- info->client = NULL; +- } else { ++ if (clnt_control(info->client, CLGET_FD, (char *) &fd)) + clnt_control(info->client, CLSET_FD_NCLOSE, NULL); +- clnt_destroy(info->client); +- } ++ else ++ fd = RPC_ANYSOCK; ++ clnt_destroy(info->client); ++ info->client = NULL; + } + + if (info->addr) { +@@ -686,7 +684,7 @@ static int create_client(struct conn_inf + goto out_close; + } + +- if (!info->client && fd != RPC_ANYSOCK) { ++ if (fd != RPC_ANYSOCK) { + close(fd); + fd = RPC_ANYSOCK; + } +@@ -704,7 +702,6 @@ static int create_client(struct conn_inf + if (ret) { + error(LOGOPT_ANY, + "hostname lookup failed: %s", gai_strerror(ret)); +- info->client = NULL; + goto out_close; + } + +@@ -723,7 +720,7 @@ static int create_client(struct conn_inf + goto out_close; + } + +- if (!info->client && fd != RPC_ANYSOCK) { ++ if (fd != RPC_ANYSOCK) { + close(fd); + fd = RPC_ANYSOCK; + } +@@ -735,7 +732,6 @@ static int create_client(struct conn_inf + + done: + if (!*client) { +- info->client = NULL; + ret = -ENOTCONN; + goto out_close; + } +@@ -743,7 +739,6 @@ done: + /* Close socket fd on destroy, as is default for rpcowned fds */ + if (!clnt_control(*client, CLSET_FD_CLOSE, NULL)) { + clnt_destroy(*client); +- info->client = NULL; + ret = -ENOTCONN; + goto out_close; + } +@@ -751,7 +746,7 @@ done: + return 0; + + out_close: +- if (fd != -1) ++ if (fd != RPC_ANYSOCK) + close(fd); + return ret; + } diff --git a/SOURCES/autofs-5.1.3-add-port-parameter-to-rpc_ping.patch b/SOURCES/autofs-5.1.3-add-port-parameter-to-rpc_ping.patch new file mode 100644 index 0000000..b51421a --- /dev/null +++ b/SOURCES/autofs-5.1.3-add-port-parameter-to-rpc_ping.patch @@ -0,0 +1,142 @@ +autofs-5.1.3 - add port parameter to rpc_ping() + +From: Ian Kent + +Commit 4914be96 introduced an NFS ping probe to check availability on +fallback from bind mount failure but failed to take into account the +case where the port option had been given to avoid bind mounting. + +Change rpc_ping() and __rpc_ping() to take a port parameter and don't +contact the portmapper or rpcbind if it is valid. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/rpc_subs.h | 2 +- + lib/rpc_subs.c | 43 +++++++++++++++++++++++++++---------------- + modules/mount_nfs.c | 2 +- + 4 files changed, 30 insertions(+), 18 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -304,6 +304,7 @@ + - fix update_negative_cache() map source usage. + - mark removed cache entry negative. + - remove some redundant rpc library code. ++- add port parameter to rpc_ping(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/rpc_subs.h ++++ autofs-5.0.7/include/rpc_subs.h +@@ -69,7 +69,7 @@ void rpc_destroy_tcp_client(struct conn_ + int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int); + int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *); + int rpc_ping_proto(struct conn_info *); +-int rpc_ping(const char *, long, long, unsigned int); ++int rpc_ping(const char *, int, long, long, unsigned int); + double elapsed(struct timeval, struct timeval); + const char *get_addr_string(struct sockaddr *, char *, socklen_t); + +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -1010,12 +1010,11 @@ int rpc_ping_proto(struct conn_info *inf + } + + static int __rpc_ping(const char *host, +- unsigned long version, int proto, ++ unsigned long version, int proto, int port, + long seconds, long micros, unsigned int option) + { + int status; + struct conn_info info; +- struct pmap parms; + + info.proto = proto; + info.host = host; +@@ -1032,32 +1031,41 @@ static int __rpc_ping(const char *host, + + status = RPC_PING_FAIL; + +- parms.pm_prog = NFS_PROGRAM; +- parms.pm_vers = version; +- parms.pm_prot = info.proto; +- parms.pm_port = 0; +- +- status = rpc_portmap_getport(&info, &parms, &info.port); +- if (status < 0) +- return status; ++ ++ if (port > 0) ++ info.port = port; ++ else { ++ struct pmap parms; ++ ++ parms.pm_prog = NFS_PROGRAM; ++ parms.pm_vers = version; ++ parms.pm_prot = info.proto; ++ parms.pm_port = 0; ++ status = rpc_portmap_getport(&info, &parms, &info.port); ++ if (status < 0) ++ return status; ++ } + + status = rpc_ping_proto(&info); + + return status; + } + +-int rpc_ping(const char *host, long seconds, long micros, unsigned int option) ++int rpc_ping(const char *host, int port, ++ long seconds, long micros, unsigned int option) + { + unsigned long vers4 = NFS4_VERSION; + unsigned long vers3 = NFS3_VERSION; + unsigned long vers2 = NFS2_VERSION; + int status; + +- status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option); ++ status = __rpc_ping(host, vers2, ++ IPPROTO_UDP, port, seconds, micros, option); + if (status > 0) + return RPC_PING_V2 | RPC_PING_UDP; + +- status = __rpc_ping(host, vers3, IPPROTO_UDP, seconds, micros, option); ++ status = __rpc_ping(host, vers3, ++ IPPROTO_UDP, port, seconds, micros, option); + if (status > 0) + return RPC_PING_V3 | RPC_PING_UDP; + +@@ -1067,15 +1075,18 @@ int rpc_ping(const char *host, long seco + return RPC_PING_V4 | RPC_PING_UDP; + */ + +- status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option); ++ status = __rpc_ping(host, vers2, ++ IPPROTO_TCP, port, seconds, micros, option); + if (status > 0) + return RPC_PING_V2 | RPC_PING_TCP; + +- status = __rpc_ping(host, vers3, IPPROTO_TCP, seconds, micros, option); ++ status = __rpc_ping(host, vers3, port, ++ IPPROTO_TCP, seconds, micros, option); + if (status > 0) + return RPC_PING_V3 | RPC_PING_TCP; + +- status = __rpc_ping(host, vers4, IPPROTO_TCP, seconds, micros, option); ++ status = __rpc_ping(host, vers4, ++ IPPROTO_TCP, port, seconds, micros, option); + if (status > 0) + return RPC_PING_V4 | RPC_PING_TCP; + +--- autofs-5.0.7.orig/modules/mount_nfs.c ++++ autofs-5.0.7/modules/mount_nfs.c +@@ -358,7 +358,7 @@ dont_probe: + char *host = this->name ? this->name : "localhost"; + int ret; + +- ret = rpc_ping(host, 2, 0, RPC_CLOSE_DEFAULT); ++ ret = rpc_ping(host, port, 2, 0, RPC_CLOSE_DEFAULT); + if (ret <= 0) + goto next; + } diff --git a/SOURCES/autofs-5.1.3-add-version-parameter-to-rpc_ping.patch b/SOURCES/autofs-5.1.3-add-version-parameter-to-rpc_ping.patch new file mode 100644 index 0000000..4d7bca0 --- /dev/null +++ b/SOURCES/autofs-5.1.3-add-version-parameter-to-rpc_ping.patch @@ -0,0 +1,144 @@ +autofs-5.1.3 - add version parameter to rpc_ping() + +From: Ian Kent + +Add an version parameter to rpc_ping() to try and avoid NFS pings +to protocol or NFS version that isn't to be used. + +When the port option is specified (possibly for NFS tunneling) it's +likely that the protocol is also specified which will reduce uneeded +NFS ping requests. But for this to work best (with the minimum delay) +the NFS version needs to also be specified in the NFS mount options. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + include/rpc_subs.h | 2 - + lib/rpc_subs.c | 74 +++++++++++++++++++++++++++------------------------- + modules/mount_nfs.c | 2 - + 4 files changed, 42 insertions(+), 37 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -306,6 +306,7 @@ + - remove some redundant rpc library code. + - add port parameter to rpc_ping(). + - dont probe NFSv2 by default. ++- add version parameter to rpc_ping(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/rpc_subs.h ++++ autofs-5.0.7/include/rpc_subs.h +@@ -69,7 +69,7 @@ void rpc_destroy_tcp_client(struct conn_ + int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int); + int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *); + int rpc_ping_proto(struct conn_info *); +-int rpc_ping(const char *, int, long, long, unsigned int); ++int rpc_ping(const char *, int, unsigned int, long, long, unsigned int); + double elapsed(struct timeval, struct timeval); + const char *get_addr_string(struct sockaddr *, char *, socklen_t); + +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -53,6 +53,7 @@ const rpcvers_t rpcb_version = PMAPVERS; + + #include "mount.h" + #include "rpc_subs.h" ++#include "replicated.h" + #include "automount.h" + + /* #define STANDALONE */ +@@ -1052,43 +1053,46 @@ static int __rpc_ping(const char *host, + } + + int rpc_ping(const char *host, int port, +- long seconds, long micros, unsigned int option) ++ unsigned int version, long seconds, long micros, ++ unsigned int option) + { +- unsigned long vers4 = NFS4_VERSION; +- unsigned long vers3 = NFS3_VERSION; +- unsigned long vers2 = NFS2_VERSION; +- int status; ++ int status = 0; ++ ++ if ((version & NFS2_REQUESTED) && (version & TCP_REQUESTED)) { ++ status = __rpc_ping(host, NFS2_VERSION, ++ IPPROTO_TCP, port, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V2 | RPC_PING_TCP; ++ } ++ ++ if ((version & NFS2_REQUESTED) && (version & UDP_REQUESTED)) { ++ status = __rpc_ping(host, NFS2_VERSION, ++ IPPROTO_UDP, port, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V2 | RPC_PING_UDP; ++ } + +- status = __rpc_ping(host, vers2, +- IPPROTO_UDP, port, seconds, micros, option); +- if (status > 0) +- return RPC_PING_V2 | RPC_PING_UDP; +- +- status = __rpc_ping(host, vers3, +- IPPROTO_UDP, port, seconds, micros, option); +- 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, port, seconds, micros, option); +- if (status > 0) +- return RPC_PING_V2 | RPC_PING_TCP; +- +- status = __rpc_ping(host, vers3, port, +- IPPROTO_TCP, seconds, micros, option); +- if (status > 0) +- return RPC_PING_V3 | RPC_PING_TCP; +- +- status = __rpc_ping(host, vers4, +- IPPROTO_TCP, port, seconds, micros, option); +- if (status > 0) +- return RPC_PING_V4 | RPC_PING_TCP; ++ if ((version & NFS3_REQUESTED) && (version & TCP_REQUESTED)) { ++ status = __rpc_ping(host, NFS3_VERSION, ++ IPPROTO_TCP, port, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V3 | RPC_PING_TCP; ++ } ++ ++ if ((version & NFS3_REQUESTED) && (version & UDP_REQUESTED)) { ++ status = __rpc_ping(host, NFS3_VERSION, ++ IPPROTO_UDP, port, seconds, micros, option); ++ if (status > 0) ++ return RPC_PING_V3 | RPC_PING_UDP; ++ } ++ ++ if (version & NFS4_REQUESTED) { ++ /* UDP isn't recommended for NFSv4, don't check it. */ ++ status = __rpc_ping(host, NFS4_VERSION, ++ IPPROTO_TCP, port, 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 +@@ -358,7 +358,7 @@ dont_probe: + char *host = this->name ? this->name : "localhost"; + int ret; + +- ret = rpc_ping(host, port, 2, 0, RPC_CLOSE_DEFAULT); ++ ret = rpc_ping(host, port, vers, 2, 0, RPC_CLOSE_DEFAULT); + if (ret <= 0) + goto next; + } diff --git a/SOURCES/autofs-5.1.3-dont-probe-NFSv2-by-default.patch b/SOURCES/autofs-5.1.3-dont-probe-NFSv2-by-default.patch new file mode 100644 index 0000000..1d02246 --- /dev/null +++ b/SOURCES/autofs-5.1.3-dont-probe-NFSv2-by-default.patch @@ -0,0 +1,35 @@ +autofs-5.1.3 - dont probe NFSv2 by default + +From: Ian Kent + +NFS v2 hasn't been recommended for use for a long time now so don't +include it in the avialability probe unless it is specified as an +NFS mount option. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/replicated.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -305,6 +305,7 @@ + - mark removed cache entry negative. + - remove some redundant rpc library code. + - add port parameter to rpc_ping(). ++- dont probe NFSv2 by default. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/replicated.h ++++ autofs-5.0.7/include/replicated.h +@@ -26,7 +26,7 @@ + #define NFS2_SUPPORTED 0x0010 + #define NFS3_SUPPORTED 0x0020 + #define NFS4_SUPPORTED 0x0040 +-#define NFS_VERS_MASK (NFS2_SUPPORTED|NFS3_SUPPORTED) ++#define NFS_VERS_MASK (NFS3_SUPPORTED) + #define NFS4_VERS_MASK (NFS4_SUPPORTED) + + #define NFS2_REQUESTED NFS2_SUPPORTED diff --git a/SOURCES/autofs-5.1.3-remove-some-redundant-rpc-library-code.patch b/SOURCES/autofs-5.1.3-remove-some-redundant-rpc-library-code.patch new file mode 100644 index 0000000..cd2ba9a --- /dev/null +++ b/SOURCES/autofs-5.1.3-remove-some-redundant-rpc-library-code.patch @@ -0,0 +1,133 @@ +autofs-5.1.3 - remove some redundant rpc library code + +From: Ian Kent + +Remove some redundant code that was used long long ago for testing. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + include/rpc_subs.h | 1 + lib/rpc_subs.c | 87 ----------------------------------------------------- + 3 files changed, 1 insertion(+), 88 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -303,6 +303,7 @@ + - use systemd sd_notify() at startup. + - fix update_negative_cache() map source usage. + - mark removed cache entry negative. ++- remove some redundant rpc library code. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/rpc_subs.h ++++ autofs-5.0.7/include/rpc_subs.h +@@ -71,7 +71,6 @@ int rpc_portmap_getport(struct conn_info + int rpc_ping_proto(struct conn_info *); + int rpc_ping(const char *, long, long, unsigned int); + double elapsed(struct timeval, struct timeval); +-int rpc_time(const char *, unsigned int, unsigned int, long, long, unsigned int, double *); + const char *get_addr_string(struct sockaddr *, char *, socklen_t); + + #endif +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -1090,32 +1090,6 @@ double elapsed(struct timeval start, str + return t2-t1; + } + +-int rpc_time(const char *host, +- unsigned int ping_vers, unsigned int ping_proto, +- long seconds, long micros, unsigned int option, double *result) +-{ +- int status; +- double taken; +- struct timeval start, end; +- struct timezone tz; +- int proto = (ping_proto & RPC_PING_UDP) ? IPPROTO_UDP : IPPROTO_TCP; +- unsigned long vers = ping_vers; +- +- gettimeofday(&start, &tz); +- status = __rpc_ping(host, vers, proto, seconds, micros, option); +- gettimeofday(&end, &tz); +- +- if (status == RPC_PING_FAIL || status < 0) +- return status; +- +- taken = elapsed(start, end); +- +- if (result != NULL) +- *result = taken; +- +- return status; +-} +- + static int rpc_get_exports_proto(struct conn_info *info, exports *exp) + { + CLIENT *client; +@@ -1288,64 +1262,3 @@ const char *get_addr_string(struct socka + + return inet_ntop(sa->sa_family, addr, name, len); + } +- +-#if 0 +-#include +- +-int main(int argc, char **argv) +-{ +- int ret; +- double res = 0.0; +- exports exportlist, tmp; +- groups grouplist; +- int n, maxlen; +- +-/* +- ret = rpc_ping("budgie", 10, 0, RPC_CLOSE_DEFAULT); +- printf("ret = %d\n", ret); +- +- res = 0.0; +- ret = rpc_time("budgie", NFS2_VERSION, RPC_PING_TCP, 10, 0, RPC_CLOSE_DEFAULT, &res); +- printf("v2 tcp ret = %d, res = %f\n", ret, res); +- +- res = 0.0; +- ret = rpc_time("budgie", NFS3_VERSION, RPC_PING_TCP, 10, 0, RPC_CLOSE_DEFAULT, &res); +- printf("v3 tcp ret = %d, res = %f\n", ret, res); +- +- res = 0.0; +- ret = rpc_time("budgie", NFS2_VERSION, RPC_PING_UDP, 10, 0, RPC_CLOSE_DEFAULT, &res); +- printf("v2 udp ret = %d, res = %f\n", ret, res); +- +- res = 0.0; +- ret = rpc_time("budgie", NFS3_VERSION, RPC_PING_UDP, 10, 0, RPC_CLOSE_DEFAULT, &res); +- printf("v3 udp ret = %d, res = %f\n", ret, res); +-*/ +- exportlist = rpc_get_exports("budgie", 10, 0, RPC_CLOSE_NOLINGER); +- exportlist = rpc_exports_prune(exportlist); +- +- maxlen = 0; +- for (tmp = exportlist; tmp; tmp = tmp->ex_next) { +- if ((n = strlen(tmp->ex_dir)) > maxlen) +- maxlen = n; +- } +- +- if (exportlist) { +- while (exportlist) { +- printf("%-*s ", maxlen, exportlist->ex_dir); +- grouplist = exportlist->ex_groups; +- if (grouplist) { +- while (grouplist) { +- printf("%s%s", grouplist->gr_name, +- grouplist->gr_next ? "," : ""); +- grouplist = grouplist->gr_next; +- } +- } +- printf("\n"); +- exportlist = exportlist->ex_next; +- } +- } +- rpc_exports_free(exportlist); +- +- exit(0); +-} +-#endif diff --git a/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch b/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch new file mode 100644 index 0000000..1111d3f --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch @@ -0,0 +1,38 @@ +autofs-5.1.4 - add man page note about extra slashes in paths + +From: Ian Kent + +Make note of the effect unnecessary multiple slashes can have in map +paths in auto.master(5). +--- + CHANGELOG | 1 + + man/auto.master.5.in | 8 ++++++++ + 2 files changed, 9 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -298,6 +298,7 @@ + - fix create_client() RPC client handling. + - dont allow trailing slash in master map mount points. + - fix fd leak in rpc_do_create_client(). ++- add man page note about extra slashes in paths. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/man/auto.master.5.in ++++ autofs-5.0.7/man/auto.master.5.in +@@ -66,6 +66,14 @@ will process the map according to the sp + map entries. Indirect map entries must be unique in the master map so + second and subsequent entries for an indirect mount point are ignored by + .BR automount (8). ++.TP ++.B NOTE: ++autofs currently does not collapse multiple slashes in paths, it's ++necessary to ensure paths used in maps are correct. If unnecessary multiple ++slashes are present in a path it can lead to unexpected failures such as ++an inability to expire automounts. An exception to this is a trailing slash ++at the end of the automount point path in the master map which will be ++removed if present. + .SH "FORMAT" + Master map entries have three fields separated by an arbitrary number + of spaces or tabs. Lines beginning with # are comments. The first field diff --git a/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch b/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch new file mode 100644 index 0000000..f653026 --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch @@ -0,0 +1,179 @@ +autofs-5.1.4 - add master map pseudo options for mount propagation + +From: Ian Kent + +Add master map entry pseudo mount option of "slave" or "private" to +allow mount propagation of bind mounts to be set to either "slave" or +"private". + +This option may be needed when using multi-mounts that have bind mounts +that bind to a file system that is propagation shared. This is becuase +the bind mount will have the same properties as its target which causes +problems for offset mounts. When this happens an unwanted offset mount +is propagated back to the target file system resulting in a deadlock +when attempting to access the offset. + +By default bind mounts will inherit the mount propagation of the target +file system. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + include/automount.h | 4 ++++ + lib/master_parse.y | 13 +++++++++++++ + lib/master_tok.l | 2 ++ + man/auto.master.5.in | 12 ++++++++++++ + modules/mount_bind.c | 30 +++++++++++++++++++----------- + 6 files changed, 51 insertions(+), 11 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -308,6 +308,7 @@ + - dont probe NFSv2 by default. + - add version parameter to rpc_ping(). + - set bind mount as propagation slave. ++- add master map pseudo options for mount propagation. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/include/automount.h ++++ autofs-5.0.7/include/automount.h +@@ -527,6 +527,10 @@ struct kernel_mod_version { + /* Read amd map even if it's not to be ghosted (browsable) */ + #define MOUNT_FLAG_AMD_CACHE_ALL 0x0080 + ++/* Set mount propagation for bind mounts */ ++#define MOUNT_FLAG_SLAVE 0x0100 ++#define MOUNT_FLAG_PRIVATE 0x0200 ++ + struct autofs_point { + pthread_t thid; + char *path; /* Mount point name */ +--- autofs-5.0.7.orig/lib/master_parse.y ++++ autofs-5.0.7/lib/master_parse.y +@@ -58,6 +58,8 @@ static char *format; + static long timeout; + static long negative_timeout; + static unsigned symlnk; ++static unsigned slave; ++static unsigned private; + static unsigned nobind; + static unsigned ghost; + extern unsigned global_selection_options; +@@ -102,6 +104,7 @@ static int master_fprintf(FILE *, char * + %token MAP + %token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE + %token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK ++%token OPT_SLAVE OPT_PRIVATE + %token COLON COMMA NL DDASH + %type map + %type options +@@ -188,6 +191,8 @@ line: + | PATH OPT_DEBUG { master_notify($1); YYABORT; } + | PATH OPT_TIMEOUT { master_notify($1); YYABORT; } + | PATH OPT_SYMLINK { master_notify($1); YYABORT; } ++ | PATH OPT_SLAVE { master_notify($1); YYABORT; } ++ | PATH OPT_PRIVATE { master_notify($1); YYABORT; } + | PATH OPT_NOBIND { master_notify($1); YYABORT; } + | PATH OPT_GHOST { master_notify($1); YYABORT; } + | PATH OPT_NOGHOST { master_notify($1); YYABORT; } +@@ -569,6 +574,8 @@ option: daemon_option + daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; } + | OPT_NTIMEOUT NUMBER { negative_timeout = $2; } + | OPT_SYMLINK { symlnk = 1; } ++ | OPT_SLAVE { slave = 1; } ++ | OPT_PRIVATE { private = 1; } + | OPT_NOBIND { nobind = 1; } + | OPT_NOGHOST { ghost = 0; } + | OPT_GHOST { ghost = 1; } +@@ -640,6 +647,8 @@ static void local_init_vars(void) + timeout = -1; + negative_timeout = 0; + symlnk = 0; ++ slave = 0; ++ private = 0; + nobind = 0; + ghost = defaults_get_browse_mode(); + random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT; +@@ -845,6 +854,10 @@ int master_parse_entry(const char *buffe + entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY; + if (symlnk) + entry->ap->flags |= MOUNT_FLAG_SYMLINK; ++ if (slave) ++ entry->ap->flags |= MOUNT_FLAG_SLAVE; ++ if (private) ++ entry->ap->flags |= MOUNT_FLAG_PRIVATE; + if (negative_timeout) + entry->ap->negative_timeout = negative_timeout; + +--- autofs-5.0.7.orig/lib/master_tok.l ++++ autofs-5.0.7/lib/master_tok.l +@@ -386,6 +386,8 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|-- + -?symlink { return(OPT_SYMLINK); } + -?nobind { return(OPT_NOBIND); } + -?nobrowse { return(OPT_NOGHOST); } ++ -?slave { return(OPT_SLAVE); } ++ -?private { return(OPT_PRIVATE); } + -g|--ghost|-?browse { return(OPT_GHOST); } + -v|--verbose { return(OPT_VERBOSE); } + -d|--debug { return(OPT_DEBUG); } +--- autofs-5.0.7.orig/man/auto.master.5.in ++++ autofs-5.0.7/man/auto.master.5.in +@@ -198,6 +198,18 @@ entries only, either in the master map ( + or with individual map entries. The option is ignored for direct mounts + and non-root offest mount entries. + .TP ++.I slave \fPor\fI private ++This option allows mount propagation of bind mounts to be set to ++either \fIslave\fP or \fIprivate\fP. This option may be needed when using ++multi-mounts that have bind mounts that bind to a file system that is ++propagation shared. This is becuase the bind mount will have the same ++properties as its target which causes problems for offset mounts. When ++this happens an unwanted offset mount is propagated back to the target ++file system resulting in a deadlock when attempting to access the offset. ++This option is a an autofs pseudo mount option that can be used in the ++master map only. By default bind mounts will inherit the mount propagation ++of the target file system. ++.TP + .I "\-r, \-\-random-multimount-selection" + Enables the use of ramdom selection when choosing a host from a + list of replicated servers. This option is applied to this mount +--- autofs-5.0.7.orig/modules/mount_bind.c ++++ autofs-5.0.7/modules/mount_bind.c +@@ -187,17 +187,25 @@ int mount_mount(struct autofs_point *ap, + what, fstype, fullpath); + } + +- /* The bind mount has succeeded but if the target +- * mount is propagation shared propagation of child +- * mounts (autofs offset mounts for example) back to +- * the target of the bind mount must be avoided or +- * autofs trigger mounts will deadlock. +- */ +- err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL); +- if (err) +- warn(ap->logopt, +- "failed to set propagation type for %s", +- fullpath); ++ if (ap->flags & (MOUNT_FLAG_SLAVE | MOUNT_FLAG_PRIVATE)) { ++ int flags = MS_SLAVE; ++ ++ if (ap->flags & MOUNT_FLAG_PRIVATE) ++ flags = MS_PRIVATE; ++ ++ /* The bind mount has succeeded but if the target ++ * mount is propagation shared propagation of child ++ * mounts (autofs offset mounts for example) back to ++ * the target of the bind mount must be avoided or ++ * autofs trigger mounts will deadlock. ++ */ ++ err = mount(NULL, fullpath, NULL, flags, NULL); ++ if (err) { ++ warn(ap->logopt, ++ "failed to set propagation for %s", ++ fullpath, root); ++ } ++ } + + return 0; + } else { diff --git a/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch b/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch new file mode 100644 index 0000000..3b6f5bb --- /dev/null +++ b/SOURCES/autofs-5.1.4-add-units-After-line-to-include-statd-service.patch @@ -0,0 +1,39 @@ +autofs-5.1.4 - add units After line to include statd service + +From: Ian Kent + +autofs needs to ensure statd is started before any NFS mounts +are attempted. This is because if the first NFS mount starts +the service and the mount is an automounted directory that is +included in the PATH used by systemctl (eg. /usr/local/bin) +the mount cannot complete. + +Add rpc-statd.service to the unit "After=" line to try and +ensure it is started before automount. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + samples/autofs.service.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -299,6 +299,7 @@ + - dont allow trailing slash in master map mount points. + - fix fd leak in rpc_do_create_client(). + - add man page note about extra slashes in paths. ++- add units After line to include statd service. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/samples/autofs.service.in ++++ autofs-5.0.7/samples/autofs.service.in +@@ -1,6 +1,6 @@ + [Unit] + Description=Automounts filesystems on demand +-After=network.target ypbind.service sssd.service network-online.target remote-fs.target ++After=network.target ypbind.service sssd.service network-online.target remote-fs.target rpc-statd.service rpcbind.service + Wants=network-online.target rpc-statd.service rpcbind.service + + [Service] diff --git a/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch b/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch new file mode 100644 index 0000000..0ee76ee --- /dev/null +++ b/SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch @@ -0,0 +1,44 @@ +autofs-5.1.4 - dont allow trailing slash in master map mount points + +From: Ian Kent + +If a master map mount point path has a trailing '/' this can cause +problems so remove them at parse time. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/master_parse.y | 5 +++++ + 2 files changed, 6 insertions(+) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -296,6 +296,7 @@ + - fix sublink option not set from defaults. + - fix error return in do_nfs_mount(). + - fix create_client() RPC client handling. ++- dont allow trailing slash in master map mount points. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/master_parse.y ++++ autofs-5.0.7/lib/master_parse.y +@@ -744,6 +744,7 @@ int master_parse_entry(const char *buffe + struct map_source *source; + unsigned int logopt = logging; + unsigned int m_logopt = master->logopt; ++ size_t mp_len; + int ret; + + local_init_vars(); +@@ -758,6 +759,10 @@ int master_parse_entry(const char *buffe + return 0; + } + ++ mp_len = strlen(path); ++ while (mp_len && path[--mp_len] == '/') ++ path[mp_len] = 0; ++ + nc = master->nc; + + /* Add null map entries to the null map cache */ diff --git a/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch b/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch new file mode 100644 index 0000000..8c0529a --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-amd-parser-opts-option-handling.patch @@ -0,0 +1,66 @@ +autofs-5.1.4 - fix amd parser opts option handling + +From: Ian Kent + +The recent implementation of the amd map program mount feature +introduced a regression in the amd parser where only the first +option of a comma separated list of is applied to a mount entry. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/amd_parse.y | 4 ++-- + modules/parse_amd.c | 4 +++- + 3 files changed, 6 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -309,6 +309,7 @@ + - add version parameter to rpc_ping(). + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. ++- fix amd parser opts option handling. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/amd_parse.y ++++ autofs-5.0.7/modules/amd_parse.y +@@ -401,7 +401,7 @@ option_assignment: MAP_OPTION OPTION_ASS + } + | MNT_OPTION OPTION_ASSIGN options + { +- if (!match_mnt_option_options($1, $3)) { ++ if (!match_mnt_option_options($1, opts)) { + amd_notify($1); + YYABORT; + } +@@ -409,7 +409,7 @@ option_assignment: MAP_OPTION OPTION_ASS + } + | MNT_OPTION OPTION_ASSIGN QUOTE options QUOTE + { +- if (!match_mnt_option_options($1, $4)) { ++ if (!match_mnt_option_options($1, opts)) { + amd_notify($1); + YYABORT; + } +--- autofs-5.0.7.orig/modules/parse_amd.c ++++ autofs-5.0.7/modules/parse_amd.c +@@ -2117,6 +2117,7 @@ int parse_mount(struct autofs_point *ap, + list_del_init(&this->list); + cur_defaults = this; + update_with_defaults(defaults_entry, cur_defaults, sv); ++ debug(ap->logopt, "merged /defaults entry with defaults"); + continue; + } else if (this->flags & AMD_DEFAULTS_RESET) { + struct amd_entry *nd, *new; +@@ -2155,8 +2156,9 @@ int parse_mount(struct autofs_point *ap, + + at_least_one = 1; + +- debug(ap->logopt, "expand mount entry"); ++ debug(ap->logopt, "update mount entry with defaults"); + update_with_defaults(cur_defaults, this, sv); ++ debug(ap->logopt, "expand mount entry"); + sv = expand_entry(ap, this, flags, sv); + sv = merge_entry_options(ap, this, sv); + normalize_sublink(ap->logopt, this, sv); diff --git a/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch b/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch new file mode 100644 index 0000000..bdbc962 --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch @@ -0,0 +1,46 @@ +autofs-5.1.4 - fix fd leak in rpc_do_create_client() + +From: Ian Kent + +Commit 94f87e203a (fix create_client() RPC client handling) fixed +possible use of an invalid RPC client handle but the change neglected +to account of a check in rpc_do_create_client() that would open a new +file descriptor without checking if the passed if descriptor was +already opened. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/rpc_subs.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -297,6 +297,7 @@ + - fix error return in do_nfs_mount(). + - fix create_client() RPC client handling. + - dont allow trailing slash in master map mount points. ++- fix fd leak in rpc_do_create_client(). + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/lib/rpc_subs.c ++++ autofs-5.0.7/lib/rpc_subs.c +@@ -192,7 +192,7 @@ static int rpc_do_create_client(struct s + in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY); + slen = sizeof(struct sockaddr_in); + +- if (!info->client) { ++ if (!info->client && *fd == RPC_ANYSOCK) { + struct sockaddr *laddr; + + *fd = open_sock(addr->sa_family, type, proto); +@@ -304,7 +304,7 @@ static int rpc_do_create_client(struct s + * it would bind to a reserved port, which has been shown to + * exhaust the reserved port range in some situations. + */ +- if (!info->client) { ++ if (!info->client && *fd == RPC_ANYSOCK) { + *fd = open_sock(addr->sa_family, type, proto); + if (*fd < 0) { + ret = -errno; diff --git a/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch b/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch new file mode 100644 index 0000000..ca58cfb --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch @@ -0,0 +1,40 @@ +autofs-5.1.4 - fix incorrect locking in sss lookup + +From: Ian Kent + +Commit 766e0f6c4, autofs-5.0.7 - fix fix wildcard multi map regression, +introduced a deadlock during restart when the sss modules is used. + +Looking at the comment above the code which takes the lock it clearly +does this incorrectly. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/lookup_sss.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -310,6 +310,7 @@ + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. + - fix amd parser opts option handling. ++- fix incorrect locking in sss lookup. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/lookup_sss.c ++++ autofs-5.0.7/modules/lookup_sss.c +@@ -786,9 +786,9 @@ int lookup_mount(struct autofs_point *ap + * when we're starting up so just take the readlock in that + */ + if (ap->flags & MOUNT_FLAG_REMOUNT) +- cache_writelock(mc); +- else + cache_readlock(mc); ++ else ++ cache_writelock(mc); + me = cache_lookup(mc, key); + /* Stale mapent => check for entry in alternate source or wildcard */ + if (me && !me->mapent) { diff --git a/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch b/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch new file mode 100644 index 0000000..216ab3d --- /dev/null +++ b/SOURCES/autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch @@ -0,0 +1,98 @@ +autofs-5.1.4 - fix update_negative_cache() map source usage + +From: Ian Kent + +File map sources can be either plain text or executable. + +When the map path is specified without a type (eg. when a +full path is used) an instance map source is used and the +original map is left unchanged. + +But update_negative_cache() fails to take this into account +causing it to update the wrong map cache. + +When a map reload is done the map entry appears to not exist +so the new map entry is added. + +This could go unnoticed except that, after a map read, the +map entry cache cleans stale map entries and the existence +of this negative entry causes the new map entry to be deleted +and map lookups continue to fail. + +In hindsite the use of an instance map source for this is +probably uneccessary but changing it will be risky so, for +now, just make update_negative_cache() use the correct map. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 38 ++++++++++++++++++++++++++++++++++++-- + 2 files changed, 37 insertions(+), 2 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -301,6 +301,7 @@ + - add man page note about extra slashes in paths. + - add units After line to include statd service. + - use systemd sd_notify() at startup. ++- fix update_negative_cache() map source usage. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -1097,6 +1097,37 @@ static enum nsswitch_status lookup_map_n + return result; + } + ++static struct map_source *lookup_get_map_source(struct master_mapent *entry) ++{ ++ struct map_source *map = entry->maps; ++ struct stat st; ++ char *type; ++ ++ if (map->type || *map->argv[0] != '/') ++ return map; ++ ++ if (*(map->argv[0] + 1) == '/') ++ return map; ++ ++ if (stat(map->argv[0], &st) == -1) ++ return NULL; ++ ++ if (!S_ISREG(st.st_mode)) ++ return NULL; ++ ++ if (st.st_mode & __S_IEXEC) ++ type = "program"; ++ else ++ type = "file"; ++ ++ /* This is a file source with a path starting with "/". ++ * But file maps can be either plain text or executable ++ * so they use a map instance and the actual map source ++ * remains untouched. ++ */ ++ return master_find_source_instance(map, type, map->format, 0, NULL); ++} ++ + static void update_negative_cache(struct autofs_point *ap, struct map_source *source, const char *name) + { + struct master_mapent *entry = ap->entry; +@@ -1130,11 +1161,14 @@ static void update_negative_cache(struct + logmsg("key \"%s\" not found in map source(s).", name); + } + +- /* Doesn't exist in any source, just add it somewhere */ ++ /* Doesn't exist in any source, just add it somewhere. ++ * Also take care to use the same map source used by ++ * map reads and key lookups for the update. ++ */ + if (source) + map = source; + else +- map = entry->maps; ++ map = lookup_get_map_source(entry); + if (map) { + time_t now = time(NULL); + int rv = CHE_FAIL; diff --git a/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch b/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch new file mode 100644 index 0000000..c12deb7 --- /dev/null +++ b/SOURCES/autofs-5.1.4-mark-removed-cache-entry-negative.patch @@ -0,0 +1,64 @@ +autofs-5.1.4 - mark removed cache entry negative + +From: Ian Kent + +When re-reading a map entries that have been removed are detected +and deleted from the map entry cache by lookup_prune_cache(). + +If a removed map entry is mounted at the time lookup_prune_cache() +is called the map entry is skippedi. This is done becuase the next +lookup (following the mount expire, which needs the cache entry to +remain) will detect the stale cache entry and a map update done +resulting in the istale entry being removed. + +But if a map re-read is performed while the cache entry is mounted +the cache will appear to up to date so the removed entry will remain +valid even after it has expired. + +To cover this case it's sufficient to mark the mounted cache entry +negative during the cache prune which prevent further lookups from +using the stale entry. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/lookup.c | 12 +++++++++--- + 2 files changed, 10 insertions(+), 3 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -302,6 +302,7 @@ + - add units After line to include statd service. + - use systemd sd_notify() at startup. + - fix update_negative_cache() map source usage. ++- mark removed cache entry negative. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/lookup.c ++++ autofs-5.0.7/daemon/lookup.c +@@ -1411,15 +1411,21 @@ void lookup_prune_one_cache(struct autof + if (valid && valid->mc == mc) { + /* + * We've found a map entry that has been removed from +- * the current cache so it isn't really valid. ++ * the current cache so it isn't really valid. Set the ++ * mapent negative to prevent further mount requests ++ * using the cache entry. + */ ++ debug(ap->logopt, "removed map entry detected, mark negative"); ++ if (valid->mapent) { ++ free(valid->mapent); ++ valid->mapent = NULL; ++ } + cache_unlock(valid->mc); + valid = NULL; + } + if (!valid && + is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) { +- debug(ap->logopt, +- "prune check posponed, %s mounted", path); ++ debug(ap->logopt, "prune posponed, %s mounted", path); + free(key); + free(path); + continue; diff --git a/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch b/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch new file mode 100644 index 0000000..bd4f246 --- /dev/null +++ b/SOURCES/autofs-5.1.4-set-bind-mount-as-propagation-slave.patch @@ -0,0 +1,69 @@ +autofs-5.1.4 - set bind mount as propagation slave + +From: Ian Kent + +When using a multi-mount with mount targets that are on the +local machine and resulting bind mounts are made to a file +system that is mount propagation shared (such as the root +file system on systemd managed systems) the autofs offset +mount triggers made within the bind mount will be propagated +back to the target file system. + +When this happens the target of the offset (the unwanted +propagated mount) is itself an autofs trigger mount and +accessing the path results in a deadlock. + +In order for these multi-mounts to function properly in this +case bind mounts that contain mount triggers must be set to +propagation shared or private so the backward propagation +doesn't occur. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_bind.c | 16 +++++++++++++++- + 2 files changed, 16 insertions(+), 1 deletion(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -307,6 +307,7 @@ + - add port parameter to rpc_ping(). + - dont probe NFSv2 by default. + - add version parameter to rpc_ping(). ++- set bind mount as propagation slave. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/modules/mount_bind.c ++++ autofs-5.0.7/modules/mount_bind.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #define MODULE_MOUNT + #include "automount.h" +@@ -184,8 +185,21 @@ int mount_mount(struct autofs_point *ap, + debug(ap->logopt, + MODPREFIX "mounted %s type %s on %s", + what, fstype, fullpath); +- return 0; + } ++ ++ /* The bind mount has succeeded but if the target ++ * mount is propagation shared propagation of child ++ * mounts (autofs offset mounts for example) back to ++ * the target of the bind mount must be avoided or ++ * autofs trigger mounts will deadlock. ++ */ ++ err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL); ++ if (err) ++ warn(ap->logopt, ++ "failed to set propagation type for %s", ++ fullpath); ++ ++ return 0; + } else { + char *cp; + char basepath[PATH_MAX]; diff --git a/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch b/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch new file mode 100644 index 0000000..c25b2f1 --- /dev/null +++ b/SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch @@ -0,0 +1,969 @@ +autofs-5.1.4 - use systemd sd_notify() at startup + +From: Ian Kent + +autofs needs to ensure statd is started before any NFS mounts +are attempted. + +When starting the statd service with the autofs service the statd +service will trigger a restart of the autofs service during its +start up. Sometimes this can happen during the automount start up +itself. + +When this happens it causes systemd to become confused and remove +the pid file created by automount leaving systemd thinking the +autofs service had failed start up when it was actually running. + +It was recommened that autofs be changed to a "Type=notify" service +to avoid this. Using this a pid file is no longer needed and is now +not used. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + Makefile.conf.in | 3 + aclocal.m4 | 2 + autofs.spec | 1 + configure | 577 +++++++++++++++++++++++++++++++++++----------- + configure.in | 10 + daemon/Makefile | 5 + daemon/automount.c | 83 ++++-- + samples/autofs.service.in | 5 + 9 files changed, 529 insertions(+), 158 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -300,6 +300,7 @@ + - fix fd leak in rpc_do_create_client(). + - add man page note about extra slashes in paths. + - add units After line to include statd service. ++- use systemd sd_notify() at startup. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/Makefile.conf.in ++++ autofs-5.0.7/Makefile.conf.in +@@ -15,6 +15,9 @@ DAEMON_LDFLAGS = @DAEMON_LDFLAGS@ + LIBNSL = @LIBNSL@ + LIBRESOLV = @LIBRESOLV@ + ++SYSTEMD = @WITH_SYSTEMD@ ++LIBSYSTEMD = @systemd_LIBS@ ++ + # Hesiod support: yes (1) no (0) + HESIOD = @HAVE_HESIOD@ + LIBHESIOD = @LIBHESIOD@ +--- autofs-5.0.7.orig/autofs.spec ++++ autofs-5.0.7/autofs.spec +@@ -28,6 +28,7 @@ Source: ftp://ftp.kernel.org/pub/linux/d + Buildroot: %{_tmppath}/%{name}-tmp + %if %{with_systemd} + BuildRequires: systemd-units ++BuildRequires: systemd-devel + %endif + %if %{with_libtirpc} + BuildRequires: libtirpc-devel +--- autofs-5.0.7.orig/configure.in ++++ autofs-5.0.7/configure.in +@@ -11,6 +11,9 @@ define([AC_CACHE_LOAD], )dnl + define([AC_CACHE_SAVE], )dnl + AC_INIT(.autofs-5.0.7) + ++# for pkg-config macros ++m4_include([/usr/share/aclocal/pkg.m4]) ++ + # + # autofs installs by default in /usr + # +@@ -45,6 +48,7 @@ AF_INIT_D() + AC_SUBST(initdir) + AF_PID_D() + AC_SUBST(piddir) ++PKG_PROG_PKG_CONFIG() + + # + # Check for systemd unit files direectory exists if unit file installation +@@ -52,6 +56,12 @@ AC_SUBST(piddir) + # + AF_WITH_SYSTEMD() + AC_SUBST(systemddir) ++AC_SUBST(WITH_SYSTEMD) ++PKG_CHECK_MODULES([systemd],[libsystemd],, ++[ ++ AC_CHECK_LIB(systemd, sm_notify, systemd_LIBS="-lsystemd") ++ AC_SUBST(systemd_LIBS) ++]) + + # + # Location of system config script directory? +--- autofs-5.0.7.orig/daemon/Makefile ++++ autofs-5.0.7/daemon/Makefile +@@ -22,6 +22,11 @@ CFLAGS += -DVERSION_STRING=\"$(version)\ + LDFLAGS += -rdynamic + LIBS = -ldl + ++ifeq ($(SYSTEMD), 1) ++ CFLAGS += -DWITH_SYSTEMD ++ LIBS += $(LIBSYSTEMD) ++endif ++ + ifeq ($(LDAP), 1) + CFLAGS += $(XML_FLAGS) + LIBS += $(XML_LIBS) +--- autofs-5.0.7.orig/daemon/automount.c ++++ autofs-5.0.7/daemon/automount.c +@@ -36,6 +36,9 @@ + #include + #include + #include ++#ifdef WITH_SYSTEMD ++#include ++#endif + + #include "automount.h" + #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND) +@@ -65,7 +68,7 @@ unsigned int global_selection_options; + long global_negative_timeout = -1; + int do_force_unlink = 0; /* Forceably unlink mount tree at startup */ + +-static int start_pipefd[2]; ++static int start_pipefd[2] = {-1, -1}; + static int st_stat = 1; + static int *pst_stat = &st_stat; + static pthread_t state_mach_thid; +@@ -1208,12 +1211,6 @@ static void become_daemon(unsigned foreg + exit(0); + } + +- if (open_pipe(start_pipefd) < 0) { +- fprintf(stderr, "%s: failed to create start_pipefd.\n", +- program); +- exit(0); +- } +- + /* Detach from foreground process */ + if (foreground) { + if (daemon_check && !aquire_flag_file()) { +@@ -1223,6 +1220,12 @@ static void become_daemon(unsigned foreg + } + log_to_stderr(); + } else { ++ if (open_pipe(start_pipefd) < 0) { ++ fprintf(stderr, "%s: failed to create start_pipefd.\n", ++ program); ++ exit(0); ++ } ++ + pid = fork(); + if (pid > 0) { + close(start_pipefd[1]); +@@ -2455,8 +2458,10 @@ int main(int argc, char *argv[]) + if (pthread_attr_init(&th_attr)) { + logerr("%s: failed to init thread attribute struct!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2465,8 +2470,10 @@ int main(int argc, char *argv[]) + if (pthread_attr_init(&th_attr_detached)) { + logerr("%s: failed to init thread attribute struct!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2476,8 +2483,10 @@ int main(int argc, char *argv[]) + &th_attr_detached, PTHREAD_CREATE_DETACHED)) { + logerr("%s: failed to set detached thread attribute!", + program); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2488,8 +2497,10 @@ int main(int argc, char *argv[]) + &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)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2500,8 +2511,10 @@ int main(int argc, char *argv[]) + &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]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2518,8 +2531,10 @@ int main(int argc, char *argv[]) + logerr("%s: failed to create thread data key for std env vars!", + program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2530,8 +2545,10 @@ int main(int argc, char *argv[]) + 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]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2542,8 +2559,10 @@ int main(int argc, char *argv[]) + if (!alarm_start_handler()) { + logerr("%s: failed to create alarm handler thread!", program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2552,8 +2571,10 @@ int main(int argc, char *argv[]) + if (!st_start_handler()) { + logerr("%s: failed to create FSM handler thread!", program); + master_kill(master_list); +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + release_flag_file(); + macro_free_global_table(); + exit(1); +@@ -2599,9 +2620,15 @@ int main(int argc, char *argv[]) + */ + do_force_unlink = 0; + +- st_stat = 0; +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); ++ if (start_pipefd[1] != -1) { ++ st_stat = 0; ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } ++ ++#ifdef WITH_SYSTEMD ++ sd_notify(1, "READY=1"); ++#endif + + state_mach_thid = pthread_self(); + statemachine(NULL); +--- autofs-5.0.7.orig/samples/autofs.service.in ++++ autofs-5.0.7/samples/autofs.service.in +@@ -4,10 +4,9 @@ After=network.target ypbind.service sssd + Wants=network-online.target rpc-statd.service rpcbind.service + + [Service] +-Type=forking +-PIDFile=@@autofspiddir@@/autofs.pid ++Type=notify + EnvironmentFile=-@@autofsconfdir@@/autofs +-ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid ++ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon + ExecReload=/usr/bin/kill -HUP $MAINPID + KillMode=process + TimeoutSec=180 +--- autofs-5.0.7.orig/configure ++++ autofs-5.0.7/configure +@@ -672,6 +672,10 @@ HAVE_MOUNT + MOUNT + DMALLOCLIB + TIRPCLIB ++flagdir ++fifodir ++mapdir ++confdir + OBJEXT + EXEEXT + ac_ct_CC +@@ -679,11 +683,13 @@ CPPFLAGS + LDFLAGS + CFLAGS + CC +-flagdir +-fifodir +-mapdir +-confdir ++systemd_LIBS ++systemd_CFLAGS ++WITH_SYSTEMD + systemddir ++PKG_CONFIG_LIBDIR ++PKG_CONFIG_PATH ++PKG_CONFIG + piddir + initdir + target_alias +@@ -748,6 +754,11 @@ enable_limit_getgrgid_size + ac_precious_vars='build_alias + host_alias + target_alias ++PKG_CONFIG ++PKG_CONFIG_PATH ++PKG_CONFIG_LIBDIR ++systemd_CFLAGS ++systemd_LIBS + CC + CFLAGS + LDFLAGS +@@ -1388,6 +1399,15 @@ Optional Packages: + --with-sasl=DIR enable SASL support for LDAP maps (libs and includes in DIR) + + Some influential environment variables: ++ PKG_CONFIG path to pkg-config utility ++ PKG_CONFIG_PATH ++ directories to add to pkg-config's search path ++ PKG_CONFIG_LIBDIR ++ path overriding pkg-config's built-in search path ++ systemd_CFLAGS ++ C compiler flags for systemd, overriding pkg-config ++ systemd_LIBS ++ linker flags for systemd, overriding pkg-config + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a +@@ -2161,6 +2181,31 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ++# for pkg-config macros ++# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- ++# serial 11 (pkg-config-0.29.1) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + # + # autofs installs by default in /usr + # +@@ -2236,6 +2281,126 @@ if test -z "$piddir"; then + fi + + ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ + # + # Check for systemd unit files direectory exists if unit file installation + # is requested +@@ -2255,9 +2420,11 @@ $as_echo_n "checking location of the sys + fi + done + fi ++ WITH_SYSTEMD=0 + if test -n "$systemddir"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5 + $as_echo "$systemddir" >&6; } ++ WITH_SYSTEMD=1 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 + $as_echo "not found" >&6; } +@@ -2268,129 +2435,6 @@ fi + + + +-# +-# Location of system config script directory? +-# +-if test -z "$confdir"; then +- for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do +- if test -z "$confdir"; then +- if test -d "$conf_d"; then +- confdir="$conf_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-confdir was given. +-if test "${with_confdir+set}" = set; then : +- withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- confdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5 +-$as_echo_n "checking for autofs configuration file directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5 +-$as_echo "$confdir" >&6; } +- +- +-# +-# The user can specify --with-mapsdir=PATH to specify autofs maps go +-# +-if test -z "$mapdir"; then +- for map_d in /etc/autofs /etc; do +- if test -z "$mapdir"; then +- if test -d "$map_d"; then +- mapdir="$map_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-mapdir was given. +-if test "${with_mapdir+set}" = set; then : +- withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- mapdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5 +-$as_echo_n "checking for autofs maps directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5 +-$as_echo "$mapdir" >&6; } +- +- +-# +-# The user can specify --with-fifodir=PATH to specify where autofs fifos go +-# +-if test -z "$fifodir"; then +- for fifo_d in /run /var/run /tmp; do +- if test -z "$fifodir"; then +- if test -d "$fifo_d"; then +- fifodir="$fifo_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-fifodir was given. +-if test "${with_fifodir+set}" = set; then : +- withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- fifodir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5 +-$as_echo_n "checking for autofs fifos directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5 +-$as_echo "$fifodir" >&6; } +- +- +-# +-# The user can specify --with-flagdir=PATH to specify where autofs flag file goes +-# +-if test -z "$flagdir"; then +- for flag_d in /run /var/run /tmp; do +- if test -z "$flagdir"; then +- if test -d "$flag_d"; then +- flagdir="$flag_d" +- fi +- fi +- done +-fi +- +-# Check whether --with-flagdir was given. +-if test "${with_flagdir+set}" = set; then : +- withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" +- then +- : +- else +- filagdir="${withval}" +- fi +- +-fi +- +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5 +-$as_echo_n "checking for autofs flag file directory... " >&6; } +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5 +-$as_echo "$flagdir" >&6; } +- +- +-# +-# Use libtirpc +-# + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +@@ -3181,6 +3225,285 @@ ac_link='$CC -o conftest$ac_exeext $CFLA + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd" >&5 ++$as_echo_n "checking for systemd... " >&6; } ++ ++if test -n "$systemd_CFLAGS"; then ++ pkg_cv_systemd_CFLAGS="$systemd_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_systemd_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$systemd_LIBS"; then ++ pkg_cv_systemd_LIBS="$systemd_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_systemd_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1` ++ else ++ systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$systemd_PKG_ERRORS" >&5 ++ ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5 ++$as_echo_n "checking for sm_notify in -lsystemd... " >&6; } ++if ${ac_cv_lib_systemd_sm_notify+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lsystemd $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char sm_notify (); ++int ++main () ++{ ++return sm_notify (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_systemd_sm_notify=yes ++else ++ ac_cv_lib_systemd_sm_notify=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5 ++$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; } ++if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then : ++ systemd_LIBS="-lsystemd" ++fi ++ ++ ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5 ++$as_echo_n "checking for sm_notify in -lsystemd... " >&6; } ++if ${ac_cv_lib_systemd_sm_notify+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lsystemd $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char sm_notify (); ++int ++main () ++{ ++return sm_notify (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_systemd_sm_notify=yes ++else ++ ac_cv_lib_systemd_sm_notify=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5 ++$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; } ++if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then : ++ systemd_LIBS="-lsystemd" ++fi ++ ++ ++ ++else ++ systemd_CFLAGS=$pkg_cv_systemd_CFLAGS ++ systemd_LIBS=$pkg_cv_systemd_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++fi ++ ++# ++# Location of system config script directory? ++# ++if test -z "$confdir"; then ++ for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do ++ if test -z "$confdir"; then ++ if test -d "$conf_d"; then ++ confdir="$conf_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-confdir was given. ++if test "${with_confdir+set}" = set; then : ++ withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ confdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5 ++$as_echo_n "checking for autofs configuration file directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5 ++$as_echo "$confdir" >&6; } ++ ++ ++# ++# The user can specify --with-mapsdir=PATH to specify autofs maps go ++# ++if test -z "$mapdir"; then ++ for map_d in /etc/autofs /etc; do ++ if test -z "$mapdir"; then ++ if test -d "$map_d"; then ++ mapdir="$map_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-mapdir was given. ++if test "${with_mapdir+set}" = set; then : ++ withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ mapdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5 ++$as_echo_n "checking for autofs maps directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5 ++$as_echo "$mapdir" >&6; } ++ ++ ++# ++# The user can specify --with-fifodir=PATH to specify where autofs fifos go ++# ++if test -z "$fifodir"; then ++ for fifo_d in /run /var/run /tmp; do ++ if test -z "$fifodir"; then ++ if test -d "$fifo_d"; then ++ fifodir="$fifo_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-fifodir was given. ++if test "${with_fifodir+set}" = set; then : ++ withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ fifodir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5 ++$as_echo_n "checking for autofs fifos directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5 ++$as_echo "$fifodir" >&6; } ++ ++ ++# ++# The user can specify --with-flagdir=PATH to specify where autofs flag file goes ++# ++if test -z "$flagdir"; then ++ for flag_d in /run /var/run /tmp; do ++ if test -z "$flagdir"; then ++ if test -d "$flag_d"; then ++ flagdir="$flag_d" ++ fi ++ fi ++ done ++fi ++ ++# Check whether --with-flagdir was given. ++if test "${with_flagdir+set}" = set; then : ++ withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no" ++ then ++ : ++ else ++ filagdir="${withval}" ++ fi ++ ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5 ++$as_echo_n "checking for autofs flag file directory... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5 ++$as_echo "$flagdir" >&6; } ++ ++ ++# ++# Use libtirpc ++# + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtirpc is requested and available" >&5 + $as_echo_n "checking if libtirpc is requested and available... " >&6; } + +--- autofs-5.0.7.orig/aclocal.m4 ++++ autofs-5.0.7/aclocal.m4 +@@ -242,8 +242,10 @@ AC_DEFUN([AF_WITH_SYSTEMD], + fi + done + fi ++ WITH_SYSTEMD=0 + if test -n "$systemddir"; then + AC_MSG_RESULT($systemddir) ++ WITH_SYSTEMD=1 + else + AC_MSG_RESULT(not found) + fi diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index 378d1f8..79550c0 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: 83%{?dist} +Release: 99%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -456,9 +456,27 @@ Patch836: autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch Patch837: autofs-5.1.4-fix-sublink-option-not-set-from-defaults.patch Patch838: autofs-5.1.4-fix-error-return-in-do_nfs_mount.patch +Patch839: autofs-5.1.1-fix-create_client-RPC-client-handling.patch +Patch840: autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch +Patch841: autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch +Patch842: autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch +Patch843: autofs-5.1.4-add-units-After-line-to-include-statd-service.patch +Patch844: autofs-5.1.4-use-systemd-sd_notify-at-startup.patch +Patch845: autofs-5.1.4-fix-update_negative_cache-map-source-usage.patch +Patch846: autofs-5.1.4-mark-removed-cache-entry-negative.patch +Patch847: autofs-5.1.3-remove-some-redundant-rpc-library-code.patch +Patch848: autofs-5.1.3-add-port-parameter-to-rpc_ping.patch +Patch849: autofs-5.1.3-dont-probe-NFSv2-by-default.patch +Patch850: autofs-5.1.3-add-version-parameter-to-rpc_ping.patch +Patch851: autofs-5.1.4-set-bind-mount-as-propagation-slave.patch +Patch852: autofs-5.1.4-add-master-map-pseudo-options-for-mount-propagation.patch +Patch853: autofs-5.1.4-fix-amd-parser-opts-option-handling.patch +Patch854: autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch + Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if %{with_systemd} BuildRequires: systemd-units +BuildRequires: systemd-devel %endif BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel BuildRequires: libsss_autofs @@ -949,6 +967,23 @@ echo %{version}-%{release} > .version %patch837 -p1 %patch838 -p1 +%patch839 -p1 +%patch840 -p1 +%patch841 -p1 +%patch842 -p1 +%patch843 -p1 +%patch844 -p1 +%patch845 -p1 +%patch846 -p1 +%patch847 -p1 +%patch848 -p1 +%patch849 -p1 +%patch850 -p1 +%patch851 -p1 +%patch852 -p1 +%patch853 -p1 +%patch854 -p1 + %build LDFLAGS=-Wl,-z,now %configure --disable-mount-locking \ @@ -1045,6 +1080,94 @@ fi %dir /etc/auto.master.d %changelog +* Wed Sep 19 2018 Ian Kent - 5.0.7-98 +- bz1630189 - yum update hanging while restarting autofs + - fix incorrect locking in sss lookup. +-Resolves: rhbz#1630189 + +* Mon Sep 17 2018 Ian Kent - 5.0.7-98 +- bz1627502 - after upgrading to autofs-5.0.7-83.el7.x86_64 on RHEL 7 clients, + amd maps /defaults key mount options are no longer working + - fix amd parser opts option handling. +- Resolves: rrhbz#1627502 + +* Mon Aug 13 2018 Ian Kent - 5.0.7-97 +- bz1358887 - On Red Hat 7.x systems if you try to access local + filesystems using the automounter through /net then the shell + and mount could lock up *if* the filesystem your accessing is + double exported. + - set bind mount as propagation slave. + - add master map pseudo options for mount propagation. +- Resolves: rhbz#1358887 + +* Fri Aug 10 2018 Ian Kent - 5.0.7-96 +- bz1598640 - Server availability probe broke tunneling nfs via localhost + - remove some redundant rpc library code. + - add port parameter to rpc_ping(). + - dont probe NFSv2 by default. + - add version parameter to rpc_ping(). +- Resolves: rhbz#1598640 + +* Tue Aug 07 2018 Ian Kent - 5.0.7-95 +- bz1612914 - [autofs]Removed entries still can be accessed + - mark removed cache entry negative. +- Resolves: rhbz#1612914 + +* Sat Aug 04 2018 Ian Kent - 5.0.7-94 +- bz1609128 - autofs reload is unable to activate new map entries, + it is autofs restart which shows new map entries. + - fix update_negative_cache() map source usage. +- Resolves: rhbz#1609128 + +* Thu May 24 2018 Ian Kent - 5.0.7-93 +- bz1581502 - PID file never created or disappears + - add missing BuildRequires: systemd-devel. + - fix changelog entry revision. +-Related: rhbz#1581502 + +* Thu May 24 2018 Ian Kent - 5.0.7-92 +- bz1581502 - PID file never created or disappears + - add units After line to include statd service. + - use systemd sd_notify() at startup. +-Resolves: rhbz#1581502 + +* Fri May 18 2018 Ian Kent - 5.0.7-90 +- bz1536526 - Ignore trailing slashes at the end of executable maps + in auto.master config file + - add man page note about extra slashes in paths. +-Related: rhbz#1536526 + +* Mon May 14 2018 Ian Kent - 5.0.7-89 +- bz1548922 - automount crashes due to segfault + - and fix incorrect month in changelog entries. +-Related: rhbz#1548922 + +* Mon May 14 2018 Ian Kent - 5.0.7-88 +- bz1548922 - automount crashes due to segfault + - fix changelog date on previous two entries. +-Related: rhbz#1548922 + +* Mon May 14 2018 Ian Kent - 5.0.7-87 +- bz1548922 - automount crashes due to segfault + - fix package revision and changelog. +-Related: rhbz#1548922 + +* Mon May 14 2018 Ian Kent - 5.0.7-86 +- bz1548922 - automount crashes due to segfault + - fix fd leak in rpc_do_create_client(). +-Related: rhbz#1548922 + +* Fri Apr 06 2018 Ian Kent - 5.0.7-85 +- bz1536526 - Ignore trailing slashes at the end of executable maps + in auto.master config file + - dont allow trailing slash in master map mount points. +-Resolves: rhbz#1536526 + +* Fri Apr 06 2018 Ian Kent - 5.0.7-84 +- bz1548922 - automount crashes due to segfault + - fix create_client() RPC client handling. +-Resolves: rhbz#1548922 + * Fri Feb 02 2018 Ian Kent - 5.0.7-83 - bz1509043 - [RFE] "automount / amd: file system type program is not yet implemented"