summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@nanjing-fnst.com>2007-03-14 15:51:38 +0800
committerNeil Brown <neilb@suse.de>2007-03-16 12:30:27 +1100
commitd4848a7d7d849c0b8d96096707c4df3fc291b4e3 (patch)
treeeb1adc4b58ab688bf17c867099074b2760e9b9a5
parent116748fccf43b246f200ec1ece0a300e43042f31 (diff)
downloadnfs-utils-d4848a7d7d849c0b8d96096707c4df3fc291b4e3.tar.gz
nfs-utils-d4848a7d7d849c0b8d96096707c4df3fc291b4e3.tar.xz
nfs-utils-d4848a7d7d849c0b8d96096707c4df3fc291b4e3.zip
Use correct UMNT version to do umount
This patch lets umount to use correct UMNT version to do umount. In latest kernel, the version format is "vers=3" etc., and in old kernel the version format is "v3","v4" etc. Signed-off-by: Wei Yongjun <yjwei@nanjing-fnst.com> Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--utils/mount/nfsumount.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c
index 28f4244..fa13725 100644
--- a/utils/mount/nfsumount.c
+++ b/utils/mount/nfsumount.c
@@ -257,6 +257,7 @@ int _nfsumount(const char *spec, const char *opts)
char *hostname;
char *dirname;
clnt_addr_t mnt_server = { &hostname, };
+ struct mntent mnt = { .mnt_opts = opts };
struct pmap *pmap = &mnt_server.pmap;
char *p;
@@ -290,14 +291,20 @@ int _nfsumount(const char *spec, const char *opts)
}
pmap->pm_prog = MOUNTPROG;
- pmap->pm_vers = MOUNTVERS;
+ pmap->pm_vers = MOUNTVERS_NFSV3;
pmap->pm_prot = get_mntproto(spec);
if (opts && (p = strstr(opts, "mountprog=")) && isdigit(*(p+10)))
pmap->pm_prog = atoi(p+10);
if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10)))
pmap->pm_port = atoi(p+10);
- if (opts && (p = strstr(opts, "nfsvers=")) && isdigit(*(p+8)))
- pmap->pm_vers = nfsvers_to_mnt(atoi(p+8));
+ if (opts && hasmntopt(&mnt, "v2"))
+ pmap->pm_vers = nfsvers_to_mnt(2);
+ if (opts && hasmntopt(&mnt, "v3"))
+ pmap->pm_vers = nfsvers_to_mnt(3);
+ if (opts && hasmntopt(&mnt, "v4"))
+ pmap->pm_vers = nfsvers_to_mnt(4);
+ if (opts && (p = strstr(opts, "vers=")) && isdigit(*(p+5)))
+ pmap->pm_vers = nfsvers_to_mnt(atoi(p+5));
if (opts && (p = strstr(opts, "mountvers=")) && isdigit(*(p+10)))
pmap->pm_vers = atoi(p+10);