]> git.pld-linux.org Git - packages/autofs.git/blob - autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch
3a5d46c9c68e2c5769d537a57ca73a5a9711cc8c
[packages/autofs.git] / autofs-5.0.4-add-nfs-mount-proto-default-conf-option.patch
1 autofs-5.0.4 - add nfs mount protocol default configuration option
2
3 From: Ian Kent <raven@themaw.net>
4
5 Add configuration option MOUNT_NFS_DEFAULT_PROTOCOL with default of 3.
6 Since the default mount protocol used by mount.nfs(8) will change to
7 NFS version 4 at some point, and because we can't identify the default
8 automatically, we need to be able to set it in our configuration.
9 This will only make a difference for replicated map entries as
10 availability probing isn't used for single host map entries.
11 ---
12
13  CHANGELOG                      |    1 +
14  include/defaults.h             |    2 ++
15  lib/defaults.c                 |   15 ++++++++++++++-
16  man/auto.master.5.in           |    6 ++++++
17  modules/mount_nfs.c            |    8 +++++---
18  redhat/autofs.sysconfig.in     |   10 ++++++++++
19  samples/autofs.conf.default.in |   10 ++++++++++
20  7 files changed, 48 insertions(+), 4 deletions(-)
21
22
23 diff --git a/CHANGELOG b/CHANGELOG
24 index ad74b7d..0ce2a56 100644
25 --- a/CHANGELOG
26 +++ b/CHANGELOG
27 @@ -25,6 +25,7 @@
28  - add check for alternate libtirpc library for libtirpc tsd workaround.
29  - cleanup configure defines for libtirpc.
30  - add WITH_LIBTIRPC to -V status report.
31 +- add nfs mount protocol default configuration option.
32  
33  4/11/2008 autofs-5.0.4
34  -----------------------
35 diff --git a/include/defaults.h b/include/defaults.h
36 index 9a2430f..9bf16e5 100644
37 --- a/include/defaults.h
38 +++ b/include/defaults.h
39 @@ -37,6 +37,7 @@
40  #define DEFAULT_ENTRY_ATTR             "cn"
41  #define DEFAULT_VALUE_ATTR             "nisMapEntry"
42  
43 +#define DEFAULT_NFS_MOUNT_PROTOCOL     3
44  #define DEFAULT_APPEND_OPTIONS         1
45  #define DEFAULT_AUTH_CONF_FILE         AUTOFS_MAP_DIR "/autofs_ldap_auth.conf"
46  
47 @@ -61,6 +62,7 @@ struct ldap_schema *defaults_get_default_schema(void);
48  struct ldap_schema *defaults_get_schema(void);
49  struct ldap_searchdn *defaults_get_searchdns(void);
50  void defaults_free_searchdns(struct ldap_searchdn *);
51 +unsigned int defaults_get_mount_nfs_default_proto(void);
52  unsigned int defaults_get_append_options(void);
53  unsigned int defaults_get_umount_wait(void);
54  const char *defaults_get_auth_conf_file(void);
55 diff --git a/lib/defaults.c b/lib/defaults.c
56 index e507a59..17164bd 100644
57 --- a/lib/defaults.c
58 +++ b/lib/defaults.c
59 @@ -45,6 +45,7 @@
60  #define ENV_NAME_ENTRY_ATTR            "ENTRY_ATTRIBUTE"
61  #define ENV_NAME_VALUE_ATTR            "VALUE_ATTRIBUTE"
62  
63 +#define ENV_MOUNT_NFS_DEFAULT_PROTOCOL "MOUNT_NFS_DEFAULT_PROTOCOL"
64  #define ENV_APPEND_OPTIONS             "APPEND_OPTIONS"
65  #define ENV_UMOUNT_WAIT                        "UMOUNT_WAIT"
66  #define ENV_AUTH_CONF_FILE             "AUTH_CONF_FILE"
67 @@ -326,7 +327,8 @@ unsigned int defaults_read_config(unsigned int to_syslog)
68                     check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
69                     check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
70                     check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
71 -                   check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog))
72 +                   check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
73 +                   check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
74                         ;
75         }
76  
77 @@ -643,6 +645,17 @@ struct ldap_schema *defaults_get_schema(void)
78         return schema;
79  }
80  
81 +unsigned int defaults_get_mount_nfs_default_proto(void)
82 +{
83 +       long proto;
84 +
85 +       proto = get_env_number(ENV_MOUNT_NFS_DEFAULT_PROTOCOL);
86 +       if (proto < 2 || proto > 4)
87 +               proto = DEFAULT_NFS_MOUNT_PROTOCOL;
88 +
89 +       return (unsigned int) proto;
90 +}
91 +
92  unsigned int defaults_get_append_options(void)
93  {
94         int res;
95 diff --git a/man/auto.master.5.in b/man/auto.master.5.in
96 index 9cc5f02..aaa6324 100644
97 --- a/man/auto.master.5.in
98 +++ b/man/auto.master.5.in
99 @@ -183,6 +183,12 @@ but it is the best we can do.
100  .B BROWSE_MODE
101  Maps are browsable by default (program default "yes").
102  .TP
103 +.B MOUNT_NFS_DEFAULT_PROTOCOL
104 +Specify the default protocol used by mount.nfs(8) (program default 3). Since
105 +we can't identify this default automatically we need to set it in the autofs
106 +configuration. This option will only make a difference for replicated map
107 +entries as availability probing isn't used for single host map entries.
108 +.TP
109  .B APPEND_OPTIONS
110  Determine whether global options, given on the command line or per mount
111  in the master map, are appended to map entry options or if the map entry
112 diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
113 index 4f3f514..14d3850 100644
114 --- a/modules/mount_nfs.c
115 +++ b/modules/mount_nfs.c
116 @@ -61,7 +61,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
117         char fullpath[PATH_MAX];
118         char buf[MAX_ERR_BUF];
119         struct host *this, *hosts = NULL;
120 -       unsigned int vers;
121 +       unsigned int mount_default_proto, vers;
122         char *nfsoptions = NULL;
123         unsigned int random_selection = ap->flags & MOUNT_FLAG_RANDOM_SELECT;
124         int len, status, err, existed = 1;
125 @@ -130,10 +130,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
126                       nfsoptions, nosymlink, ro);
127         }
128  
129 +       mount_default_proto = defaults_get_mount_nfs_default_proto();
130 +       vers = NFS_VERS_MASK | NFS_PROTO_MASK;
131         if (strcmp(fstype, "nfs4") == 0)
132                 vers = NFS4_VERS_MASK | TCP_SUPPORTED;
133 -       else
134 -               vers = NFS_VERS_MASK | NFS_PROTO_MASK;
135 +       else if (mount_default_proto == 4)
136 +               vers = vers | NFS4_VERS_MASK;
137  
138         if (!parse_location(ap->logopt, &hosts, what)) {
139                 info(ap->logopt, MODPREFIX "no hosts available");
140 diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
141 index fe36f45..04e521c 100644
142 --- a/redhat/autofs.sysconfig.in
143 +++ b/redhat/autofs.sysconfig.in
144 @@ -22,6 +22,16 @@ TIMEOUT=300
145  #
146  BROWSE_MODE="no"
147  #
148 +# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
149 +#                             mount.nfs(8). Since we can't identify
150 +#                             the default automatically we need to
151 +#                             set it in our configuration. This will
152 +#                             only make a difference for replicated
153 +#                             map entries as availability probing isn't
154 +#                             used for single host map entries.
155 +#
156 +#MOUNT_NFS_DEFAULT_PROTOCOL=3
157 +#
158  # APPEND_OPTIONS - append to global options instead of replace.
159  #
160  #APPEND_OPTIONS="yes"
161 diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
162 index 4496738..52d18ec 100644
163 --- a/samples/autofs.conf.default.in
164 +++ b/samples/autofs.conf.default.in
165 @@ -22,6 +22,16 @@ TIMEOUT=300
166  #
167  BROWSE_MODE="no"
168  #
169 +# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
170 +#                             mount.nfs(8). Since we can't identify
171 +#                             the default automatically we need to
172 +#                             set it in our configuration. This will
173 +#                             only make a difference for replicated
174 +#                             map entries as availability probing isn't
175 +#                             used for single host map entries.
176 +#
177 +#MOUNT_NFS_DEFAULT_PROTOCOL=3
178 +#
179  # APPEND_OPTIONS - append to global options instead of replace.
180  #
181  #APPEND_OPTIONS="yes"
This page took 0.054981 seconds and 2 git commands to generate.