Re: Please test knfsd-980920

H.J. Lu (hjl@lucon.org)
Mon, 21 Sep 1998 16:41:53 -0700 (PDT)


> H.J.,
>
> The problem of advertising NFS v3 services for mountd persists. This
> breaks at least one older client machine here. Again, in my opinion it
> makes no sense to advertise NFS v3 mount and statd services when we have
> no actual v3 nfsd support.
>

Could you please try this patch and let me know if it works for you?

Thanks.

H.J.
----
Index: etc/rc.nfsd
===================================================================
RCS file: /home/work/cvs/linux/knfsd/etc/rc.nfsd,v
retrieving revision 1.6
diff -u -p -r1.6 rc.nfsd
--- etc/rc.nfsd 1998/09/20 18:47:36 1.6
+++ etc/rc.nfsd 1998/09/21 23:35:01
@@ -44,6 +44,8 @@ if [ $KNFSD = yes ]; then
NFSD=nfsd
LOCKD=lockd
RPCNFSDCOUNT=2
+ # No NFS V3.
+ RPCMOUNTD_OPTS="--no-nfs-version 3"
RPCMOUNTD=rpc.kmountd
RPCSTATD=rpc.kstatd
KSTOPSIGNAL=-9
@@ -64,7 +66,7 @@ case "$1" in
daemon $RPCSTATD
/usr/sbin/kexportfs -r
fi
- daemon $RPCMOUNTD
+ daemon $RPCMOUNTD $RPCMOUNTD_OPTS
daemon $RPCNFSD $RPCNFSDCOUNT
echo
touch /var/lock/subsys/nfs
@@ -98,8 +100,10 @@ case "$1" in
echo -n "$RPCMOUNTD "
killall -HUP $RPCMOUNTD
if [ $KNFSD = yes ]; then
+ daemon $RPCMOUNTD $RPCMOUNTD_OPTS
echo -n "$RPCSTATD"
killall -HUP $RPCSTATD
+ daemon $RPCSTATD
/usr/sbin/kexportfs -a
else
echo -n "$RPCNFSD "
Index: utils/mountd/mountd.c
===================================================================
RCS file: /home/work/cvs/linux/knfsd/utils/mountd/mountd.c,v
retrieving revision 1.6
diff -u -p -r1.6 mountd.c
--- utils/mountd/mountd.c 1998/09/20 18:50:04 1.6
+++ utils/mountd/mountd.c 1998/09/21 23:18:38
@@ -11,15 +11,15 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
#include <errno.h>
#include "xmalloc.h"
#include "mountd.h"
-#include "getopt.h"
#include "rpcmisc.h"
#include "version.h"

-
-static void usage(int exitcode);
+static void usage(const char *, int exitcode);
static exports get_exportlist(void);
static struct knfs_fh * get_rootfh(struct svc_req *, dirpath *, int *);

@@ -29,19 +29,26 @@ static struct option longopts[] =
{ "debug", 1, 0, 'd' },
{ "help", 0, 0, 'h' },
{ "exports-file", 1, 0, 'f' },
+ { "nfs-version", 1, 0, 'V' },
+ { "no-nfs-version", 1, 0, 'N' },
{ "version", 0, 0, 'v' },
{ NULL, 0, 0, 0 }
};

+static int nfs_version = -1;
+
/*
* Signal handler.
*/
static void
killer (int sig)
{
- pmap_unset (MOUNTPROG, MOUNTVERS);
- pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
- pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
+ if (nfs_version & 0x1)
+ pmap_unset (MOUNTPROG, MOUNTVERS);
+ if (nfs_version & (0x1 << 1))
+ pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
+ if (nfs_version & (0x1 << 2))
+ pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
xlog (L_FATAL, "Caught signal %d, un-registering and exiting.", sig);
}

@@ -317,28 +324,9 @@ main(int argc, char **argv)
int c;
struct sigaction sa;

- /* Initialize logging. */
- xlog_open("mountd");
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGHUP, &sa, NULL);
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGTERM, &sa, NULL);
-
- rpc_init("mountd", MOUNTPROG, MOUNTVERS, mount_dispatch, 0, 0);
- rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX, mount_dispatch, 0, 0);
- rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3, mount_dispatch, 0, 0);
-
- sa.sa_handler = killer;
- sigaction(SIGHUP, &sa, NULL);
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGTERM, &sa, NULL);
-
/* Parse the command line options and arguments. */
opterr = 0;
- while ((c = getopt_long(argc, argv, "Fd:f:hv", longopts, NULL)) != EOF)
+ while ((c = getopt_long(argc, argv, "Fd:f:hN:V:v", longopts, NULL)) != EOF)
switch (c) {
case 'F':
foreground = 1;
@@ -350,8 +338,14 @@ main(int argc, char **argv)
export_file = optarg;
break;
case 'h':
- usage(0);
+ usage(argv [0], 0);
break;
+ case 'N':
+ nfs_version &= ~(1 << (atoi (optarg) - 1));
+ break;
+ case 'V':
+ nfs_version |= 1 << (atoi (optarg) - 1);
+ break;
case 'v':
printf("kmountd %s\n", VERSION);
exit(0);
@@ -359,12 +353,37 @@ main(int argc, char **argv)
break;
case '?':
default:
- usage(1);
+ usage(argv [0], 1);
}

/* No more arguments allowed. */
- if (optind != argc)
- usage(1);
+ if (optind != argc || !(nfs_version & 0x7))
+ usage(argv [0], 1);
+
+ /* Initialize logging. */
+ xlog_open("mountd");
+
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+
+ if (nfs_version & 0x1)
+ rpc_init("mountd", MOUNTPROG, MOUNTVERS,
+ mount_dispatch, 0, 0);
+ if (nfs_version & (0x1 << 1))
+ rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
+ mount_dispatch, 0, 0);
+ if (nfs_version & (0x1 << 2))
+ rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
+ mount_dispatch, 0, 0);
+
+ sa.sa_handler = killer;
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);

auth_init(export_file);

@@ -391,10 +410,12 @@ main(int argc, char **argv)
}

static void
-usage(int n)
+usage(const char *prog, int n)
{
fprintf(stderr,
-"Usage: rpc.mountd [-Fhnpv] [-d kind] [-f exports-file]\n"
-" [--debug kind] [--help] [--version] [--exports-file=file]\n");
+"Usage: %s [-Fhnpv] [-d kind] [-f exports-file] [-V version]\n"
+" [-N version] [--debug kind] [--help] [--version]\n"
+" [--exports-file=file] [--nfs-version version]\n"
+" [--no--nfs-version version]\n", prog);
exit(n);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/