diff options
| author | Neil Brown <neilb@suse.de> | 2007-10-12 09:03:06 +1000 |
|---|---|---|
| committer | Neil Brown <neilb@suse.de> | 2007-10-12 09:03:06 +1000 |
| commit | ea4a03e77794eb2d46756c2d44f334f6ca4d13d7 (patch) | |
| tree | 977f8574fe1d9974ee789cba7416d2a23184b04e /utils/mount/network.c | |
| parent | df0a06a985a15f088d0a7fb39c61a98e6aac9830 (diff) | |
| download | nfs-utils-ea4a03e77794eb2d46756c2d44f334f6ca4d13d7.tar.gz nfs-utils-ea4a03e77794eb2d46756c2d44f334f6ca4d13d7.tar.xz nfs-utils-ea4a03e77794eb2d46756c2d44f334f6ca4d13d7.zip | |
Fix version fallback for unmount.
Previously, if the mtab record didn't mention a version, unmount
would assume a v3 umount and send an UNMOUNT request accordingly.
This is wrong.
So remove the 'v3' assumption, and allow probe_port to continue when
it gets a version number mis-match.
Also there was some overloading of the meaning of pm_vers==0 relating
to v4 mounts. As do_nfs_umount is never called for v4, rename it to
do_nfs_umount23, and remove v4 handling from there and from
nfs_call_umount.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/network.c')
| -rw-r--r-- | utils/mount/network.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c index 49d3c6b..63d5f5a 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -408,7 +408,8 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, goto out_bad; } } - if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) + if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED && + rpc_createerr.cf_stat != RPC_PROGVERSMISMATCH) goto out_bad; if (!prot) { @@ -585,27 +586,16 @@ int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp) enum clnt_stat res = 0; int msock; - switch (mnt_server->pmap.pm_vers) { - case 3: - case 2: - case 1: - if (!probe_mntport(mnt_server)) - return 0; - clnt = mnt_openclnt(mnt_server, &msock); - if (!clnt) - return 0; - res = clnt_call(clnt, MOUNTPROC_UMNT, - (xdrproc_t)xdr_dirpath, (caddr_t)argp, - (xdrproc_t)xdr_void, NULL, - TIMEOUT); - mnt_closeclnt(clnt, msock); - if (res == RPC_SUCCESS) - return 1; - break; - default: - res = RPC_SUCCESS; - break; - } + if (!probe_mntport(mnt_server)) + return 0; + clnt = mnt_openclnt(mnt_server, &msock); + if (!clnt) + return 0; + res = clnt_call(clnt, MOUNTPROC_UMNT, + (xdrproc_t)xdr_dirpath, (caddr_t)argp, + (xdrproc_t)xdr_void, NULL, + TIMEOUT); + mnt_closeclnt(clnt, msock); if (res == RPC_SUCCESS) return 1; |
