3 Changes from redhat srpm.
7 util-linux-2.12-bfields/mount/mount.c | 2
8 util-linux-2.12-bfields/mount/nfs4mount.c | 20 +++++++++
9 util-linux-2.12-bfields/mount/nfsmount.c | 61 +++++++++++++++++++++++++-----
10 3 files changed, 72 insertions(+), 11 deletions(-)
12 diff -puN mount/mount.c~redhat-nfs-mount mount/mount.c
13 --- util-linux-2.12/mount/mount.c~redhat-nfs-mount 2004-12-13 12:34:18.000000000 -0500
14 +++ util-linux-2.12-bfields/mount/mount.c 2004-12-13 12:34:18.000000000 -0500
15 @@ -829,6 +829,7 @@ retry_nfs:
16 mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg);
21 die (EX_SOFTWARE, _("mount: this version was compiled "
22 "without support for the type `nfs4'"));
23 @@ -836,6 +837,7 @@ retry_nfs:
26 block_signals (SIG_BLOCK);
30 mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
31 diff -puN mount/nfs4mount.c~redhat-nfs-mount mount/nfs4mount.c
32 --- util-linux-2.12/mount/nfs4mount.c~redhat-nfs-mount 2004-12-13 12:34:18.000000000 -0500
33 +++ util-linux-2.12-bfields/mount/nfs4mount.c 2004-12-13 12:34:18.000000000 -0500
35 #include <netinet/in.h>
36 #include <arpa/inet.h>
38 +#ifdef HAVE_rpcsvc_nfs_prot_h
39 +#include <rpcsvc/nfs_prot.h>
41 +#include <linux/nfs.h>
42 +#define nfsstat nfs_stat
51 +extern int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
52 +extern void rpc_strerror(void);
57 @@ -225,7 +234,7 @@ int nfs4mount(const char *spec, const ch
62 + intr = NFS4_MOUNT_INTR;
65 retry = 10000; /* 10000 minutes ~ 1 week */
66 @@ -374,10 +383,19 @@ int nfs4mount(const char *spec, const ch
68 data.version = NFS4_MOUNT_VERSION;
70 + clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto);
71 + if (rpc_createerr.cf_stat) {
72 + fprintf(stderr, "mount to NFS server '%s' failed.\n", data.hostname.data);
76 *mount_opts = (char *) &data;
86 diff -puN mount/nfsmount.c~redhat-nfs-mount mount/nfsmount.c
87 --- util-linux-2.12/mount/nfsmount.c~redhat-nfs-mount 2004-12-13 12:34:18.000000000 -0500
88 +++ util-linux-2.12-bfields/mount/nfsmount.c 2004-12-13 12:34:18.000000000 -0500
89 @@ -111,6 +111,25 @@ static const struct timeval RETRY_TIMEOU
91 static int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp);
93 +int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
95 +/* Convert RPC errors into strings */
96 +void rpc_strerror(void)
98 + int cf_stat = rpc_createerr.cf_stat;
99 + int cf_errno = rpc_createerr.cf_error.re_errno;
100 + char *ptr, *estr = clnt_sperrno(cf_stat);
103 + if ((ptr = index(estr, ':')))
106 + fprintf(stderr, "RPC Error: %d (%s )\n", cf_stat, estr);
107 + if (cf_stat == RPC_SYSTEMERROR)
108 + fprintf(stderr, "System Error: %d (%s)\n", cf_errno, strerror(cf_errno));
112 /* Define the order in which to probe for UDP/TCP services */
114 proto_probelist(const int use_tcp)
115 @@ -252,14 +271,15 @@ nfs_gethostbyname(const char *hostname,
116 * we're requesting, we open and RPC client, and fire off a NULL
121 clnt_ping(struct sockaddr_in *saddr, const u_long prog, const u_long vers,
127 static char clnt_res;
129 + rpc_createerr.cf_stat = stat = 0;
133 @@ -285,6 +305,7 @@ clnt_ping(struct sockaddr_in *saddr, con
135 if (stat != RPC_PROGVERSMISMATCH)
141 @@ -308,9 +329,9 @@ probe_port(clnt_addr_t *server,
143 const u_short port = (u_short) pmap->pm_port;
146 p_prot = prot ? &prot : protos;
147 p_vers = vers ? &vers : versions;
148 + rpc_createerr.cf_stat = 0;
150 saddr->sin_port = htons(PMAPPORT);
151 p_port = pmap_getport(saddr, prog, *p_vers, *p_prot);
152 @@ -338,6 +359,7 @@ probe_port(clnt_addr_t *server,
153 pmap->pm_prot = *p_prot;
155 pmap->pm_port = p_port;
156 + rpc_createerr.cf_stat = 0;
160 @@ -394,6 +416,8 @@ probe_bothports(clnt_addr_t *mnt_server,
162 memcpy(mnt_pmap, &save_mnt, sizeof(*mnt_pmap));
164 + if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED)
166 memcpy(nfs_pmap, &save_nfs, sizeof(*nfs_pmap));
169 @@ -477,11 +501,23 @@ nfs_call_mount(clnt_addr_t *mnt_server,
174 if (!probe_bothports(mnt_server, nfs_server)) {
176 - fprintf(stderr,_("mount: failed to probe ports on NFS server %s\n"),
178 + fprintf(stderr, "mount to NFS server '%s' failed",
179 *nfs_server->hostname);
180 + if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) {
181 + fprintf(stderr, ": server is down.\n");
182 + } else if (nfs_server->pmap.pm_prot) {
183 + fprintf(stderr, ": possible invalid protocol.\n");
184 + } else if (nfs_server->pmap.pm_port) {
185 + fprintf(stderr, ": possible invalid port.\n");
187 + fprintf(stderr, ".\n");
196 @@ -743,15 +779,19 @@ parse_options(char *old_opts, struct nfs
198 nfsmnt_check_compat(const struct pmap *nfs_pmap, const struct pmap *mnt_pmap)
200 - if (nfs_pmap->pm_vers > MAX_NFSPROT) {
201 + if (nfs_pmap->pm_vers &&
202 + (nfs_pmap->pm_vers > MAX_NFSPROT || nfs_pmap->pm_vers < 2)) {
203 if (nfs_pmap->pm_vers == 4)
204 - fprintf(stderr, _("'vers=4' is not supported. Use '-t nfs4' instead.\n"));
205 + fprintf(stderr, _("'vers=4' is not supported. "
206 + "Use '-t nfs4' instead.\n"));
208 - fprintf(stderr, _("NFSv%ld not supported!\n"), nfs_pmap->pm_vers);
209 + fprintf(stderr, _("NFS version %ld is not supported.\n"),
210 + nfs_pmap->pm_vers);
213 if (mnt_pmap->pm_vers > MAX_MNTPROT) {
214 - fprintf(stderr, _("NFS mount v%ld not supported!\n"), mnt_pmap->pm_vers);
215 + fprintf(stderr, _("NFS mount version %ld s not supported.\n"),
216 + mnt_pmap->pm_vers);
220 @@ -1144,6 +1184,7 @@ nfs_call_umount(clnt_addr_t *mnt_server,
221 res = nfs2_umount(argp, clnt);
226 mnt_closeclnt(clnt, msock);
227 if (res == RPC_SUCCESS)