Support "vers=4" in nfs_nfs_version()
Skip UMNT call for "-t nfs -o vers=4" mounts
For "-t nfs -o vers=4" mounts, we want to skip v2/v3
version/transport negotiation, but be sure to append
the "clientaddr" option.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Tested-by: Steve Dickson <steved@redhat.com>
static const char *nfs_version_opttbl[] = {
"v2",
"v3",
static const char *nfs_version_opttbl[] = {
"v2",
"v3",
* Returns TRUE if @version contains a valid value for this option,
* or FALSE if the option was specified with an invalid value.
*/
* Returns TRUE if @version contains a valid value for this option,
* or FALSE if the option was specified with an invalid value.
*/
nfs_nfs_version(struct mount_options *options, unsigned long *version)
{
long tmp;
nfs_nfs_version(struct mount_options *options, unsigned long *version)
{
long tmp;
case 1: /* v3 */
*version = 3;
return 1;
case 1: /* v3 */
*version = 3;
return 1;
+ case 2: /* v4 */
+ *version = 4;
+ return 1;
+ case 3: /* vers */
switch (po_get_numeric(options, "vers", &tmp)) {
case PO_FOUND:
switch (po_get_numeric(options, "vers", &tmp)) {
case PO_FOUND:
- if (tmp >= 2 && tmp <= 3) {
+ if (tmp >= 2 && tmp <= 4) {
*version = tmp;
return 1;
}
*version = tmp;
return 1;
}
case PO_BAD_VALUE:
return 0;
}
case PO_BAD_VALUE:
return 0;
}
switch (po_get_numeric(options, "nfsvers", &tmp)) {
case PO_FOUND:
switch (po_get_numeric(options, "nfsvers", &tmp)) {
case PO_FOUND:
- if (tmp >= 2 && tmp <= 3) {
+ if (tmp >= 2 && tmp <= 4) {
*version = tmp;
return 1;
}
*version = tmp;
return 1;
}
+int nfs_nfs_version(struct mount_options *options, unsigned long *version);
int nfs_options2pmap(struct mount_options *,
struct pmap *, struct pmap *);
int nfs_options2pmap(struct mount_options *,
struct pmap *, struct pmap *);
+ /* Skip UMNT call for vers=4 mounts */
+ if (nfs_pmap.pm_vers == 4)
+ return EX_SUCCESS;
+
*hostname = nfs_umount_hostname(options, *hostname);
if (!*hostname) {
nfs_error(_("%s: out of memory"), progname);
*hostname = nfs_umount_hostname(options, *hostname);
if (!*hostname) {
nfs_error(_("%s: out of memory"), progname);
struct mount_options *options; /* parsed mount options */
char **extra_opts; /* string for /etc/mtab */
struct mount_options *options; /* parsed mount options */
char **extra_opts; /* string for /etc/mtab */
+ unsigned long version; /* NFS version */
int flags, /* MS_ flags */
fake, /* actually do the mount? */
child; /* forked bg child? */
int flags, /* MS_ flags */
fake, /* actually do the mount? */
child; /* forked bg child? */
if (!nfs_name_to_address(mi->hostname, sap, &salen))
return 0;
if (!nfs_name_to_address(mi->hostname, sap, &salen))
return 0;
- if (strncmp(mi->type, "nfs4", 4) == 0) {
+ if (!nfs_nfs_version(mi->options, &mi->version))
+ return 0;
+ if (strncmp(mi->type, "nfs4", 4) == 0)
+ mi->version = 4;
+
+ if (mi->version == 4) {
if (!nfs_append_clientaddr_option(sap, salen, mi->options))
return 0;
} else {
if (!nfs_append_clientaddr_option(sap, salen, mi->options))
return 0;
} else {
char *options = NULL;
int result;
char *options = NULL;
int result;
- if (strncmp(mi->type, "nfs4", 4) != 0) {
+ if (mi->version != 4) {
if (!nfs_rewrite_pmap_mount_options(mi->options))
return 0;
}
if (!nfs_rewrite_pmap_mount_options(mi->options))
return 0;
}