rpms/nfs-utils/devel nfs-utils-1.2.0-spnfsd-01.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-02.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-03.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-04.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-05.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-06.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-07.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-08.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-09.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-10.patch, NONE, 1.1.2.1 nfs-utils-1.2.0-spnfsd-installrules.patch, NONE, 1.1.2.1 pnfs-exports.patch, NONE, 1.1.2.1 nfs-utils.spec, 1.240, 1.240.2.1

Steve Dickson steved at fedoraproject.org
Thu Aug 27 19:11:42 UTC 2009


Author: steved

Update of /cvs/pkgs/rpms/nfs-utils/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3605

Modified Files:
      Tag: nfs-utils-1_2_0-10_pnfs
	nfs-utils.spec 
Added Files:
      Tag: nfs-utils-1_2_0-10_pnfs
	nfs-utils-1.2.0-spnfsd-01.patch 
	nfs-utils-1.2.0-spnfsd-02.patch 
	nfs-utils-1.2.0-spnfsd-03.patch 
	nfs-utils-1.2.0-spnfsd-04.patch 
	nfs-utils-1.2.0-spnfsd-05.patch 
	nfs-utils-1.2.0-spnfsd-06.patch 
	nfs-utils-1.2.0-spnfsd-07.patch 
	nfs-utils-1.2.0-spnfsd-08.patch 
	nfs-utils-1.2.0-spnfsd-09.patch 
	nfs-utils-1.2.0-spnfsd-10.patch 
	nfs-utils-1.2.0-spnfsd-installrules.patch pnfs-exports.patch 
Log Message:
- Added in the pnfs export bits.
- Added in the spnfsd daemon


nfs-utils-1.2.0-spnfsd-01.patch:
 support/include/nfs/nfs.h    |    8 
 utils/Makefile.am            |    4 
 utils/spnfsd/Makefile.am     |   71 +++
 utils/spnfsd/atomicio.c      |   63 +++
 utils/spnfsd/cfg.c           |  893 +++++++++++++++++++++++++++++++++++++++++++
 utils/spnfsd/cfg.h           |   67 +++
 utils/spnfsd/makestatic      |    1 
 utils/spnfsd/nfsd4_spnfs.h   |  234 +++++++++++
 utils/spnfsd/queue.h         |  499 ++++++++++++++++++++++++
 utils/spnfsd/spnfsd.c        |  552 ++++++++++++++++++++++++++
 utils/spnfsd/spnfsd.conf     |   21 +
 utils/spnfsd/spnfsd.conf.man |    1 
 utils/spnfsd/spnfsd.h        |   47 ++
 utils/spnfsd/spnfsd.man      |    1 
 utils/spnfsd/spnfsd_ops.c    |  266 ++++++++++++
 utils/spnfsd/strlcat.c       |   77 +++
 utils/spnfsd/strlcpy.c       |   73 +++
 17 files changed, 2878 insertions(+)

--- NEW FILE nfs-utils-1.2.0-spnfsd-01.patch ---
diff -up nfs-utils-1.2.0/support/include/nfs/nfs.h.orig nfs-utils-1.2.0/support/include/nfs/nfs.h
--- nfs-utils-1.2.0/support/include/nfs/nfs.h.orig	2009-08-27 14:20:07.284736000 -0400
+++ nfs-utils-1.2.0/support/include/nfs/nfs.h	2009-08-27 14:21:30.937192000 -0400
@@ -41,6 +41,7 @@ struct nfs_fh_old {
 #define NFSCTL_GETFH		6	/* get an fh (used by mountd) */
 #define NFSCTL_GETFD		7	/* get an fh by path (used by mountd) */
 #define NFSCTL_GETFS		8	/* get an fh by path with max size (used by mountd) */
+#define NFSCTL_FD2FH		9	/* get a fh from a fd */
 
 #define NFSCTL_UDPBIT		      (1 << (17 - 1))
 #define NFSCTL_TCPBIT		      (1 << (18 - 1))
@@ -130,6 +131,11 @@ struct nfsctl_fsparm {
 	int			gd_maxlen;
 };
 
+/* FD2FH */
+struct nfsctl_fd2fh {
+	int			fd;
+};
+
 /*
  * This is the argument union.
  */
@@ -143,6 +149,7 @@ struct nfsctl_arg {
 		struct nfsctl_fhparm	u_getfh;
 		struct nfsctl_fdparm	u_getfd;
 		struct nfsctl_fsparm	u_getfs;
+		struct nfsctl_fd2fh	u_fd2fh;
 	} u;
 #define ca_svc		u.u_svc
 #define ca_client	u.u_client
@@ -151,6 +158,7 @@ struct nfsctl_arg {
 #define ca_getfh	u.u_getfh
 #define ca_getfd	u.u_getfd
 #define ca_getfs	u.u_getfs
+#define ca_fd2fh	u.u_fd2fh
 #define ca_authd	u.u_authd
 };
 
diff -up nfs-utils-1.2.0/utils/Makefile.am.orig nfs-utils-1.2.0/utils/Makefile.am
--- nfs-utils-1.2.0/utils/Makefile.am.orig	2009-06-02 10:43:05.000000000 -0400
+++ nfs-utils-1.2.0/utils/Makefile.am	2009-08-27 14:21:30.941191000 -0400
@@ -6,6 +6,10 @@ if CONFIG_NFSV4
 OPTDIRS += idmapd
 endif
 
+if CONFIG_NFSV4
+OPTDIRS += spnfsd
+endif
+
 if CONFIG_GSS
 OPTDIRS += gssd
 endif
diff -up /dev/null nfs-utils-1.2.0/utils/spnfsd/atomicio.c
--- /dev/null	2009-08-25 05:54:53.623006579 -0400
+++ nfs-utils-1.2.0/utils/spnfsd/atomicio.c	2009-08-27 14:21:30.944196000 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2002 Marius Aamodt Eriksen <marius at monkey.org>
+ * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+/*
+ * ensure all of data on socket comes through. f==read || f==write
+ */
+ssize_t
+atomicio(f, fd, _s, n)
+	ssize_t (*f) ();
+	int fd;
+	void *_s;
+	size_t n;
+{
+	char *s = _s;
+	ssize_t res, pos = 0;
+
+	while (n > pos) {
+		res = (f) (fd, s + pos, n - pos);
+		switch (res) {
+		case -1:
+			if (errno == EINTR || errno == EAGAIN)
+				continue;
+		case 0:
+			if (pos != 0)
+				return (pos);
+			return (res);
+		default:
+			pos += res;
+		}
+	}
+	return (pos);
+}
diff -up /dev/null nfs-utils-1.2.0/utils/spnfsd/cfg.c
--- /dev/null	2009-08-25 05:54:53.623006579 -0400
+++ nfs-utils-1.2.0/utils/spnfsd/cfg.c	2009-08-27 14:21:30.950191000 -0400
@@ -0,0 +1,893 @@
+/*	$OpenBSD: conf.c,v 1.55 2003/06/03 14:28:16 ho Exp $	*/
+/*	$EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $	*/
+
+/*
+ * Copyright (c) 1998, 1999, 2000, 2001 Niklas Hallqvist.  All rights reserved.
+ * Copyright (c) 2000, 2001, 2002 Håkan Olsson.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This code was written under funding by Ericsson Radio Systems.
+ */
+
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <err.h>
+
+#include "cfg.h"
+
+static void conf_load_defaults (int);
+#if 0
+static int conf_find_trans_xf (int, char *);
+#endif
+
+size_t  strlcpy(char *, const char *, size_t);
+
+struct conf_trans {
+  TAILQ_ENTRY (conf_trans) link;
+  int trans;
+  enum conf_op { CONF_SET, CONF_REMOVE, CONF_REMOVE_SECTION } op;
+  char *section;
+  char *tag;
+  char *value;
+  int override;
+  int is_default;
+};
+
+TAILQ_HEAD (conf_trans_head, conf_trans) conf_trans_queue;
+
+/*
+ * Radix-64 Encoding.
+ */
+const u_int8_t bin2asc[]
+  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
[...2580 lines suppressed...]
+
+	for (ds = 0 ; ds < num_ds ; ds++) {
+		sprintf(fullpath, "%s/%s/%s", dsmountdir,
+			dataservers[ds].ds_ip, basename);
+		unlink(fullpath);
+	}
+
+	return 0;
+}
+
+int
+spnfsd_commit(struct spnfs_msg *im)
+{
+	return 0;
+}
+
+int
+spnfsd_getfh(char *path, unsigned char *fh_val, unsigned int *fh_len)
+{
+	int fd, err;
+	struct nfsctl_arg arg;
+	unsigned char res[130]; /* XXX align this to proper structure */
+	extern int nfsservctl();
+
+	if ((fd = open(path, O_RDONLY)) < 0) {
+		perror(path);
+		return -1;
+	}
+
+	arg.ca_fd2fh.fd = fd;
+	if ((err = nfsservctl(NFSCTL_FD2FH, &arg, res)) < 0) {
+		close(fd);
+		return -1;
+	}
+
+	/* XXX use proper structure */
+	*fh_len = (short)res[0];
+	memcpy(fh_val, &res[2], *fh_len);
+
+	close(fd);
+	return 0;
+}
diff -up /dev/null nfs-utils-1.2.0/utils/spnfsd/strlcat.c
--- /dev/null	2009-08-25 05:54:53.623006579 -0400
+++ nfs-utils-1.2.0/utils/spnfsd/strlcat.c	2009-08-27 14:21:30.993191000 -0400
@@ -0,0 +1,77 @@
+/*	$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $	*/
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left).  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t
+strlcat(dst, src, siz)
+	char *dst;
+	const char *src;
+	size_t siz;
+{
+	register char *d = dst;
+	register const char *s = src;
+	register size_t n = siz;
+	size_t dlen;
+
+	/* Find the end of dst and adjust bytes left but don't go past end */
+	while (n-- != 0 && *d != '\0')
+		d++;
+	dlen = d - dst;
+	n = siz - dlen;
+
+	if (n == 0)
+		return(dlen + strlen(s));
+	while (*s != '\0') {
+		if (n != 1) {
+			*d++ = *s;
+			n--;
+		}
+		s++;
+	}
+	*d = '\0';
+
+	return(dlen + (s - src));	/* count does not include NUL */
+}
diff -up /dev/null nfs-utils-1.2.0/utils/spnfsd/strlcpy.c
--- /dev/null	2009-08-25 05:54:53.623006579 -0400
+++ nfs-utils-1.2.0/utils/spnfsd/strlcpy.c	2009-08-27 14:21:30.997191000 -0400
@@ -0,0 +1,73 @@
+/*	$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $	*/
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+/*
+ * Copy src to string dst of size siz.  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(dst, src, siz)
+	char *dst;
+	const char *src;
+	size_t siz;
+{
+	register char *d = dst;
+	register const char *s = src;
+	register size_t n = siz;
+
+	/* Copy as many bytes as will fit */
+	if (n != 0 && --n != 0) {
+		do {
+			if ((*d++ = *s++) == 0)
+				break;
+		} while (--n != 0);
+	}
+
+	/* Not enough room in dst, add NUL and traverse rest of src */
+	if (n == 0) {
+		if (siz != 0)
+			*d = '\0';		/* NUL-terminate dst */
+		while (*s++)
+			;
+	}
+
+	return(s - src - 1);	/* count does not include NUL */
+}

nfs-utils-1.2.0-spnfsd-02.patch:
 configure.ac |    2 ++
 1 file changed, 2 insertions(+)

--- NEW FILE nfs-utils-1.2.0-spnfsd-02.patch ---
commit 6c94024a32470ab20a61268a3d81d1212cedafbc
Author: Mike Sager <sager at netapp.com>
Date:   Mon Nov 19 18:36:09 2007 -0800

    Added spnfsd to configure.ac
    
    Signed-off-by: Mike Sager <sager at netapp.com>

diff -up nfs-utils-1.2.0/configure.ac.orig nfs-utils-1.2.0/configure.ac
--- nfs-utils-1.2.0/configure.ac.orig	2009-08-27 12:02:59.335782000 -0400
+++ nfs-utils-1.2.0/configure.ac	2009-08-27 13:42:37.126103000 -0400
@@ -65,6 +65,7 @@ AC_ARG_ENABLE(nfsv4,
 	if test "$enable_nfsv4" = yes; then
 		AC_DEFINE(NFS4_SUPPORTED, 1, [Define this if you want NFSv4 support compiled in])
 		IDMAPD=idmapd
+		SPNFSD=spnfsd
 	else
 		enable_nfsv4=
 		IDMAPD=
@@ -409,6 +410,7 @@ AC_CONFIG_FILES([
 	utils/exportfs/Makefile
 	utils/gssd/Makefile
 	utils/idmapd/Makefile
+	utils/spnfsd/Makefile
 	utils/mount/Makefile
 	utils/mountd/Makefile
 	utils/nfsd/Makefile

nfs-utils-1.2.0-spnfsd-03.patch:
 spnfsd_ops.c |    4 ++++
 1 file changed, 4 insertions(+)

--- NEW FILE nfs-utils-1.2.0-spnfsd-03.patch ---
commit 76d0c6f17a2e1e1c8efa84d67619c34d8884af51
Author: Dan Muntz <dmuntz at netapp.com>
Date:   Mon Nov 26 13:40:19 2007 -0800

    Add explicit chmod 777 of stripe files as workaround for non-root users.
    
    Signed-off-by: Dan Muntz <dmuntz at netapp.com>
    Signed-off-by: Mike Sager <sager at netapp.com>

diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index cec4840..bd5486d 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -189,6 +189,10 @@ spnfsd_open(struct spnfs_msg *im)
 			im->im_res.open_res.status = errno;
 			break;
 		} else {
+			if (fchmod(fd, 0777) != 0) {
+				/* DM: we'll consider this non-fatal for now */
+				perror("chmod stripe");
+			}
 			im->im_res.open_res.status = 0;
 			close(fd);
 		}

nfs-utils-1.2.0-spnfsd-04.patch:
 makestatic    |   22 ++++++++++++++++++++++
 nfsd4_spnfs.h |   22 +++++++++++++++++++++-
 spnfsd.c      |   14 +++++++-------
 spnfsd.h      |   21 +++++++++++++++++++++
 spnfsd_ops.c  |   22 ++++++++++++++++++++++
 5 files changed, 93 insertions(+), 8 deletions(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-04.patch ---
commit d2e73153b64ab7a11442810bf42b8e72f1601ccf
Author: Dan Muntz <dmuntz at netapp.com>
Date:   Wed Dec 12 13:18:07 2007 -0800

    add licensing comments and remove some printfs from spnfsd.c
    
    Signed-off-by: Dan Muntz <dmuntz at netapp.com>
    Signed-off-by: Mike Sager <sager at netapp.com>

diff --git a/utils/spnfsd/makestatic b/utils/spnfsd/makestatic
index 4b7067f..5eec53c 100755
--- a/utils/spnfsd/makestatic
+++ b/utils/spnfsd/makestatic
@@ -1 +1,23 @@
+/******************************************************************************
+
+(c) 2007 Network Appliance, Inc.  All Rights Reserved.
+
+Network Appliance provides this source code under the GPL v2 License.
+The GPL v2 license is available at
+http://opensource.org/licenses/gpl-license.php.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************************/
+
 gcc -static -Wall -pipe -g -O2 -o spnfsd atomicio.o spnfsd_ops.o cfg.o spnfsd.o strlcat.o strlcpy.o  /usr/lib/libevent.a ../../support/nfs/libnfs.a
diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 634544f..99edae3 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -4,7 +4,27 @@
  * spNFS - simple pNFS implementation with userspace daemon
  *
  */
-
+/******************************************************************************
+
+(c) 2007 Network Appliance, Inc.  All Rights Reserved.
+
+Network Appliance provides this source code under the GPL v2 License.
+The GPL v2 license is available at
+http://opensource.org/licenses/gpl-license.php.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************************/
 
 #ifndef NFS_SPNFS_H
 #define NFS_SPNFS_H
diff --git a/utils/spnfsd/spnfsd.c b/utils/spnfsd/spnfsd.c
index 90e66ba..276b0c3 100644
--- a/utils/spnfsd/spnfsd.c
+++ b/utils/spnfsd/spnfsd.c
@@ -1,7 +1,13 @@
 /*
  *  spnfsd.c
- *
  *  Userland daemon for spNFS.
+ *  Based heavily on idmapd.c
+ *
+ */
+/*
+ *  idmapd.c
+ *
+ *  Userland daemon for idmap.
  *
  *  Copyright (c) 2002 The Regents of the University of Michigan.
  *  All rights reserved.
@@ -369,17 +375,11 @@ spnfscb(int fd, short which, void *data)
 	if (im.im_status == SPNFS_STATUS_FAIL)
 		im.im_status = SPNFS_STATUS_SUCCESS;
 
-printf("before atomicio write\n");
-printf("writing %d bytes\n", sizeof(im));
 	if ((rval=atomicio(write, scp->sc_fd, &im, sizeof(im))) != sizeof(im)) {
-printf("spnfscb: incomplete write %d of %d bytes\n", rval, sizeof(im));
-printf("atomicio write error\n");
 		spnfsd_warn("spnfscb: write(%s)", scp->sc_path);
 	}
 
-printf("after atomicio write\n");
 out:
-printf("spnfscb out\n");
 	event_add(&scp->sc_event, NULL);
 }
 
diff --git a/utils/spnfsd/spnfsd.h b/utils/spnfsd/spnfsd.h
index dcea3e6..9df6cd8 100644
--- a/utils/spnfsd/spnfsd.h
+++ b/utils/spnfsd/spnfsd.h
@@ -4,6 +4,27 @@
  * spNFS - simple pNFS implementation with userspace daemon
  *
  */
+/******************************************************************************
+
+(c) 2007 Network Appliance, Inc.  All Rights Reserved.
+
+Network Appliance provides this source code under the GPL v2 License.
+The GPL v2 license is available at
+http://opensource.org/licenses/gpl-license.php.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************************/
 
 #ifndef _PATH_SPNFSDCONF
 #define _PATH_SPNFSDCONF "/etc/spnfsd.conf"
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index bd5486d..56bd185 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -1,3 +1,25 @@
+/******************************************************************************
+
+(c) 2007 Network Appliance, Inc.  All Rights Reserved.
+
+Network Appliance provides this source code under the GPL v2 License.
+The GPL v2 license is available at
+http://opensource.org/licenses/gpl-license.php.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************************/
+
 #include "nfsd4_spnfs.h"
 #include "spnfsd.h"
 #include "nfs/nfs.h"

nfs-utils-1.2.0-spnfsd-05.patch:
 nfsd4_spnfs.h |   88 ++++++++++++++++++++++++++++++++++++++--------------------
 spnfsd.c      |   19 ++++++------
 spnfsd.conf   |    4 +-
 spnfsd.h      |    4 +-
 spnfsd_ops.c  |   73 +++++++++++++++++++++++++-----------------------
 5 files changed, 111 insertions(+), 77 deletions(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-05.patch ---
commit f5beeb9bad08970329dd47371e829e31da79e5f3
Author: Mike Sager <sager at netapp.com>
Date:   Sun Jan 27 17:11:07 2008 -0800

    Update device ops to reflect latest draft and interface changes
    
    1. Change spnfs getdevlist handling into iterative interface to reflect
       export ops changes
    
    2. Update device ops per draft 13
    
    3. Fix code that was written when a data server was thought to be a device
    
    Signed-off-by: Mike Sager <sager at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 99edae3..7619c75 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -4,6 +4,7 @@
  * spNFS - simple pNFS implementation with userspace daemon
  *
  */
+
 /******************************************************************************
 
 (c) 2007 Network Appliance, Inc.  All Rights Reserved.
@@ -31,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 #ifdef __KERNEL__
+#include "exportfs.h"
 #include "sunrpc/svc.h"
 #include "nfsd/nfsfh.h"
 #else
@@ -45,17 +47,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define SPNFS_TYPE_LAYOUTGET		0x01
 #define SPNFS_TYPE_LAYOUTCOMMIT		0x02
 #define SPNFS_TYPE_LAYOUTRETURN		0x03
-#define SPNFS_TYPE_GETDEVICELIST	0x04
+#define SPNFS_TYPE_GETDEVICEITER	0x04
 #define SPNFS_TYPE_GETDEVICEINFO	0x05
 #define SPNFS_TYPE_SETATTR		0x06
 #define SPNFS_TYPE_OPEN			0x07
 #define	SPNFS_TYPE_CLOSE		0x08
 #define SPNFS_TYPE_CREATE		0x09
 #define SPNFS_TYPE_REMOVE		0x0a
-#define	SPNFS_TYPE_COMMIT		0x0b
+#define SPNFS_TYPE_COMMIT		0x0b
 
-#define SPNFS_MAX_DATA_SERVERS		2
-#define SPNFS_MAX_LAYOUT		8
+#define	SPNFS_MAX_DEVICES		1
+#define	SPNFS_MAX_DATA_SERVERS		2
+#define	SPNFS_MAX_LAYOUT		8
 
 /* layout */
 struct spnfs_msg_layoutget_args {
@@ -64,9 +67,9 @@ struct spnfs_msg_layoutget_args {
 
 struct spnfs_filelayout_list {
 	u_int32_t	dev_id;
-	u_int32_t	dev_index;
-	u_int32_t	fh_len;
-	unsigned char	fh_val[128]; /* DMXXX fix this const */
+	u_int32_t       ds_index;
+	u_int32_t       fh_len;
+	unsigned char   fh_val[128]; /* DMXXX fix this const */
 };
 
 struct spnfs_msg_layoutget_res {
@@ -97,31 +100,41 @@ struct spnfs_msg_layoutreturn_res {
 };
 */
 
-/* getdevicelist */
-struct spnfs_msg_getdevicelist_args {
+/* getdeviceiter */
+struct spnfs_msg_getdeviceiter_args {
 	unsigned long inode;
+	u_int64_t cookie;
+	u_int64_t verf;
 };
 
-struct spnfs_getdevicelist_dev {
+struct spnfs_msg_getdeviceiter_res {
+	int status;
 	u_int32_t devid;
+	u_int64_t cookie;
+	u_int64_t verf;
+	u_int32_t eof;
+};
+
+/* getdeviceinfo */
+struct spnfs_data_server {
+	u_int32_t dsid;
 	char netid[5];
 	char addr[29];
 };
 
-struct spnfs_msg_getdevicelist_res {
-	int status;
-	int count;
-	struct spnfs_getdevicelist_dev dlist[SPNFS_MAX_DATA_SERVERS];
+struct spnfs_device {
+	u_int32_t devid;
+	int dscount;
+	struct spnfs_data_server dslist[SPNFS_MAX_DATA_SERVERS];
 };
 
-/* getdeviceinfo */
 struct spnfs_msg_getdeviceinfo_args {
 	u_int32_t devid;
 };
 
 struct spnfs_msg_getdeviceinfo_res {
 	int status;
-	struct spnfs_getdevicelist_dev dinfo;
+	struct spnfs_device devinfo;
 };
 
 /* setattr */
@@ -191,29 +204,41 @@ struct spnfs_msg_commit_res {
 union spnfs_msg_args {
 	struct spnfs_msg_layoutget_args		layoutget_args;
 	struct spnfs_msg_layoutcommit_args	layoutcommit_args;
-//	struct spnfs_msg_layoutreturn_args	layoutreturn_args;
-	struct spnfs_msg_getdevicelist_args	getdevicelist_args;
-	struct spnfs_msg_getdeviceinfo_args	getdeviceinfo_args;
+/*
+	struct spnfs_msg_layoutreturn_args	layoutreturn_args;
+*/
+	struct spnfs_msg_getdeviceiter_args     getdeviceiter_args;
+	struct spnfs_msg_getdeviceinfo_args     getdeviceinfo_args;
 	struct spnfs_msg_setattr_args		setattr_args;
 	struct spnfs_msg_open_args		open_args;
 	struct spnfs_msg_close_args		close_args;
-//	struct spnfs_msg_create_args		create_args;
+/*
+	struct spnfs_msg_create_args		create_args;
+*/
 	struct spnfs_msg_remove_args		remove_args;
-//	struct spnfs_msg_commit_args		commit_args;
+/*
+	struct spnfs_msg_commit_args		commit_args;
+*/
 };
 
 union spnfs_msg_res {
 	struct spnfs_msg_layoutget_res		layoutget_res;
 	struct spnfs_msg_layoutcommit_res	layoutcommit_res;
-//	struct spnfs_msg_layoutreturn_res	layoutreturn_res;
-	struct spnfs_msg_getdevicelist_res	getdevicelist_res;
-	struct spnfs_msg_getdeviceinfo_res	getdeviceinfo_res;
+/*
+	struct spnfs_msg_layoutreturn_res	layoutreturn_res;
+*/
+	struct spnfs_msg_getdeviceiter_res      getdeviceiter_res;
+	struct spnfs_msg_getdeviceinfo_res      getdeviceinfo_res;
 	struct spnfs_msg_setattr_res		setattr_res;
 	struct spnfs_msg_open_res		open_res;
 	struct spnfs_msg_close_res		close_res;
-//	struct spnfs_msg_create_res		create_res;
+/*
+	struct spnfs_msg_create_res		create_res;
+*/
 	struct spnfs_msg_remove_res		remove_res;
-//	struct spnfs_msg_commit_res		commit_res;
+/*
+	struct spnfs_msg_commit_res		commit_res;
+*/
 };
 
 /* a spnfs message, args and response */
@@ -238,16 +263,19 @@ struct spnfs {
 
 int spnfs_layout_type(void);
 int spnfs_layoutget(struct inode *, void *);
-int spnfs_layoutcomit(void);
-int spnfs_layoutreturn(void);
-int spnfs_getdevicelist(struct super_block *, void *);
-int spnfs_getdeviceinfo(void);
+int spnfs_layoutcommit(void);
+int spnfs_layoutreturn(struct inode *, void *);
+int spnfs_getdeviceiter(struct super_block *, struct pnfs_deviter_arg *);
+int spnfs_getdeviceinfo(struct super_block *, struct pnfs_devinfo_arg *);
 int spnfs_setattr(void);
 int spnfs_open(struct inode *, void *);
+int spnfs_get_state(struct inode *, void *, void *);
+int spnfs_remove(unsigned long ino);
 
 int nfsd_spnfs_new(void);
 void nfsd_spnfs_delete(void);
 int spnfs_upcall(struct spnfs *, struct spnfs_msg *, union spnfs_msg_res *);
+int spnfs_enabled(void);
 
 #endif /* __KERNEL__ */
 
diff --git a/utils/spnfsd/spnfsd.c b/utils/spnfsd/spnfsd.c
index 276b0c3..f7bae84 100644
--- a/utils/spnfsd/spnfsd.c
+++ b/utils/spnfsd/spnfsd.c
@@ -114,6 +114,7 @@ static void dump_config();
 int verbose = 0;
 int stripesize = DEFAULT_STRIPE_SIZE;
 int densestriping = 0;
+int num_dev = 1;  /* XXX no multiple device support yet */
 int num_ds;
 struct dserver dataservers[SPNFS_MAX_DATA_SERVERS];
 char dsmountdir[PATH_MAX];
@@ -315,8 +316,8 @@ spnfs_msg_handler(struct spnfs_client *scp, struct spnfs_msg *im)
 	case SPNFS_TYPE_LAYOUTRETURN:
 		err = spnfsd_layoutreturn(im);
 		break;
-	case SPNFS_TYPE_GETDEVICELIST:
-		err = spnfsd_getdevicelist(im);
+	case SPNFS_TYPE_GETDEVICEITER:
+		err = spnfsd_getdeviceiter(im);
 		break;
 	case SPNFS_TYPE_GETDEVICEINFO:
 		err = spnfsd_getdeviceinfo(im);
@@ -459,7 +460,7 @@ read_config()
 	char *xpipefsdir = NULL;
 	char *xdsmountdir = NULL;
 	int ds;
-	char ipstr[20], portstr[20], rootstr[20], devidstr[20];
+	char ipstr[20], portstr[20], rootstr[20], dsidstr[20];
 
 	verbose = conf_get_num("General", "Verbosity", 0);
 	stripesize = conf_get_num("General", "Stripe-size",DEFAULT_STRIPE_SIZE);
@@ -478,7 +479,7 @@ read_config()
 		sprintf(ipstr, "DS%d_IP", ds);
 		sprintf(portstr, "DS%d_PORT", ds);
 		sprintf(rootstr, "DS%d_ROOT", ds);
-		sprintf(devidstr, "DS%d_DEVID", ds);
+		sprintf(dsidstr, "DS%d_ID", ds);
 		CONF_SAVE(dataservers[ds-1].ds_ip,
 			conf_get_str("DataServers", ipstr));
 		if (dataservers[ds-1].ds_ip == NULL)
@@ -489,10 +490,10 @@ read_config()
 			conf_get_str("DataServers", rootstr));
 		if (dataservers[ds-1].ds_ip == NULL)
 			spnfsd_err(1, "Missing IP for DS%d\n", ds);
-		dataservers[ds-1].ds_devid =
-			conf_get_num("DataServers", devidstr, -1);
-		if (dataservers[ds-1].ds_devid < 0)
-			spnfsd_err(1, "Missing or invalid DEVID for DS%d\n", ds);
+		dataservers[ds-1].ds_id =
+			conf_get_num("DataServers", dsidstr, -1);
+		if (dataservers[ds-1].ds_id < 0)
+			spnfsd_err(1, "Missing or invalid ID for DS%d\n", ds);
 	}
 
 	return 0;
@@ -512,7 +513,7 @@ dump_config()
 		printf("DS%d IP: %s\n", ds+1, dataservers[ds].ds_ip);
 		printf("DS%d PORT: %d\n", ds+1, dataservers[ds].ds_port);
 		printf("DS%d ROOT: %s\n", ds+1, dataservers[ds].ds_path);
-		printf("DS%d DEVID: %d\n", ds+1, dataservers[ds].ds_devid);
+		printf("DS%d DSID: %d\n", ds+1, dataservers[ds].ds_id);
 	}
 }
 
diff --git a/utils/spnfsd/spnfsd.conf b/utils/spnfsd/spnfsd.conf
index 0839c11..57621fc 100644
--- a/utils/spnfsd/spnfsd.conf
+++ b/utils/spnfsd/spnfsd.conf
@@ -13,9 +13,9 @@ NumDS = 2
 DS1_IP = 172.16.28.134
 DS1_PORT = 2049
 DS1_ROOT = /pnfs
-DS1_DEVID = 1
+DS1_ID = 1
 
 DS2_IP = 172.16.28.141
 DS2_PORT = 2049
 DS2_ROOT = /pnfs
-DS2_DEVID = 2
+DS2_ID = 2
diff --git a/utils/spnfsd/spnfsd.h b/utils/spnfsd/spnfsd.h
index 9df6cd8..05029e9 100644
--- a/utils/spnfsd/spnfsd.h
+++ b/utils/spnfsd/spnfsd.h
@@ -42,7 +42,7 @@ struct dserver {
         char    *ds_ip;
         int     ds_port;
         char    *ds_path;
-	int	ds_devid;
+	int	ds_id;
 };
 
 /* DMXXX future struct for whole config */
@@ -57,7 +57,7 @@ struct spnfsd_config {
 int spnfsd_layoutget(struct spnfs_msg *);
 int spnfsd_layoutcommit(struct spnfs_msg *);
 int spnfsd_layoutreturn(struct spnfs_msg *);
-int spnfsd_getdevicelist(struct spnfs_msg *);
+int spnfsd_getdeviceiter(struct spnfs_msg *);
 int spnfsd_getdeviceinfo(struct spnfs_msg *);
 int spnfsd_setattr(struct spnfs_msg *);
 int spnfsd_open(struct spnfs_msg *);
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index 56bd185..81ad102 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 extern int stripesize;
 extern int densestriping;
 extern int num_ds;
+extern int num_dev;
 extern char dsmountdir[];
 extern struct dserver dataservers[SPNFS_MAX_DATA_SERVERS];
 size_t  strlcat(char *, const char *, size_t);
@@ -58,9 +59,8 @@ spnfsd_layoutget(struct spnfs_msg *im)
 	im->im_res.layoutget_res.layout_count = num_ds;
 
 	for (ds = 0 ; ds < num_ds ; ds++) {
-		im->im_res.layoutget_res.flist[ds].dev_id =
-			dataservers[ds].ds_devid;
-		im->im_res.layoutget_res.flist[ds].dev_index = ds;
+		im->im_res.layoutget_res.flist[ds].dev_id = 1; /* XXX */
+		im->im_res.layoutget_res.flist[ds].ds_index = ds;
 		memset(im->im_res.layoutget_res.flist[ds].fh_val, 0, 128); /*DMXXX*/
 		sprintf(fullpath, "%s/%s/%ld",
 			dsmountdir, dataservers[ds].ds_ip,
@@ -112,22 +112,20 @@ spnfsd_layoutreturn(struct spnfs_msg *im)
 }
 
 int
-spnfsd_getdevicelist(struct spnfs_msg *im)
+spnfsd_getdeviceiter(struct spnfs_msg *im)
 {
-	int ds;
-
 	im->im_status = SPNFS_STATUS_SUCCESS;
-	im->im_res.getdevicelist_res.status = 0;
-	im->im_res.getdevicelist_res.count = num_ds;
-	for (ds = 0 ; ds < num_ds ; ds++) {
-		im->im_res.getdevicelist_res.dlist[ds].devid =
-			dataservers[ds].ds_devid;
-		memset(im->im_res.getdevicelist_res.dlist[ds].netid, 0, 5);
-		strlcpy(im->im_res.getdevicelist_res.dlist[ds].netid, "tcp", 4);
-		sprintf(im->im_res.getdevicelist_res.dlist[ds].addr, "%s.%d.%d",
-			dataservers[ds].ds_ip,
-			dataservers[ds].ds_port >> 8,
-			dataservers[ds].ds_port & 0xff);
+	im->im_res.getdeviceiter_res.status = 0;
+
+	/* verifier ignored for now */
+	if (im->im_args.getdeviceiter_args.cookie >= num_dev)
+		im->im_res.getdeviceiter_res.eof = 1;
+	else {
+		/* XXX just hardcoded for now...fix this */
+		im->im_res.getdeviceiter_res.devid = 1;
+		im->im_res.getdeviceiter_res.cookie = im->im_args.getdeviceiter_args.cookie + 1;
+		im->im_res.getdeviceiter_res.verf = 0;
+		im->im_res.getdeviceiter_res.eof = 0;
 	}
 
 	return 0;
@@ -136,27 +134,34 @@ spnfsd_getdevicelist(struct spnfs_msg *im)
 int
 spnfsd_getdeviceinfo(struct spnfs_msg *im)
 {
+	struct spnfs_device *devp;
+	struct spnfs_data_server *dsp;
+	u_int32_t devid;
 	int ds;
 
 	im->im_status = SPNFS_STATUS_SUCCESS;
-	im->im_res.getdeviceinfo_res.status = ENODEV;
+	im->im_res.getdeviceinfo_res.status = 0;
+
+	devid = im->im_args.getdeviceinfo_args.devid;
+
+	/* XXX fix this if/when we support multiple devices */
+	if (devid != 1) {
+		im->im_res.getdeviceinfo_res.status = ENODEV;
+		return -1;
+	}
+
+	devp = &im->im_res.getdeviceinfo_res.devinfo;
+	devp->dscount = num_ds;
+
 	for (ds = 0 ; ds < num_ds ; ds++) {
-		if (dataservers[ds].ds_devid ==
-		    im->im_args.getdeviceinfo_args.devid) {
-			im->im_res.getdeviceinfo_res.dinfo.devid =
-				dataservers[ds].ds_devid;
-			memset(im->im_res.getdeviceinfo_res.dinfo.netid,
-				0, 5);
-			strlcpy(im->im_res.getdeviceinfo_res.dinfo.netid,
-				"tcp", 4);
-			sprintf(im->im_res.getdeviceinfo_res.dinfo.addr,
-				"%s.%d.%d",
-				dataservers[ds].ds_ip,
-				dataservers[ds].ds_port >> 8,
-				dataservers[ds].ds_port & 0xff);
-			im->im_res.getdeviceinfo_res.status = 0;
-			break;
-		}
+		dsp = &devp->dslist[ds];
+		dsp->dsid = dataservers[ds].ds_id;
+		memset(dsp->netid, 0, 5);
+		strlcpy(dsp->netid, "tcp", 4);
+		sprintf(dsp->addr, "%s.%d.%d",
+			dataservers[ds].ds_ip,
+			dataservers[ds].ds_port >> 8,
+			dataservers[ds].ds_port & 0xff);
 	}
 
 	return 0;

nfs-utils-1.2.0-spnfsd-06.patch:
 nfsd4_spnfs.h |   10 ++++------
 spnfsd_ops.c  |   13 ++++++-------
 2 files changed, 10 insertions(+), 13 deletions(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-06.patch ---
commit 4c0c700c85cdd097af5d9be2e452d4027e430d0f
Author: Mike Sager <sager at netapp.com>
Date:   Thu Feb 7 20:19:03 2008 -0800

    Update layoutget per draft 13
    
    Also, change spnfs layoutget handling to reflect generic pnfs interface
    changes
    
    Signed-off-by: Mike Sager <sager at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 7619c75..4b3ce7f 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -58,7 +58,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #define	SPNFS_MAX_DEVICES		1
 #define	SPNFS_MAX_DATA_SERVERS		2
-#define	SPNFS_MAX_LAYOUT		8
 
 /* layout */
 struct spnfs_msg_layoutget_args {
@@ -66,18 +65,17 @@ struct spnfs_msg_layoutget_args {
 };
 
 struct spnfs_filelayout_list {
-	u_int32_t	dev_id;
-	u_int32_t       ds_index;
 	u_int32_t       fh_len;
 	unsigned char   fh_val[128]; /* DMXXX fix this const */
 };
 
 struct spnfs_msg_layoutget_res {
 	int status;
+	u_int32_t dev_id;
 	u_int64_t stripe_size;
 	u_int32_t stripe_type;
-	u_int32_t layout_count;
-	struct spnfs_filelayout_list flist[SPNFS_MAX_LAYOUT];
+	u_int32_t stripe_count;
+	struct spnfs_filelayout_list flist[SPNFS_MAX_DATA_SERVERS];
 };
 
 /* layoutcommit */
@@ -262,7 +260,7 @@ struct spnfs {
 };
 
 int spnfs_layout_type(void);
-int spnfs_layoutget(struct inode *, void *);
+int spnfs_layoutget(struct inode *, struct pnfs_layoutget_arg *);
 int spnfs_layoutcommit(void);
 int spnfs_layoutreturn(struct inode *, void *);
 int spnfs_getdeviceiter(struct super_block *, struct pnfs_deviter_arg *);
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index 81ad102..645c9eb 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -51,16 +51,15 @@ spnfsd_layoutget(struct spnfs_msg *im)
 
 	im->im_status = SPNFS_STATUS_SUCCESS;
 	im->im_res.layoutget_res.status = 0;
+	im->im_res.layoutget_res.dev_id = 1; /* XXX */
 	im->im_res.layoutget_res.stripe_size = stripesize;
 	if (densestriping)
-		im->im_res.layoutget_res.stripe_type = 2; /* DMXXX enum */
+		im->im_res.layoutget_res.stripe_type = 1; /* DMXXX enum */
 	else
-		im->im_res.layoutget_res.stripe_type = 1; /* DMXXX ^^^^ */
-	im->im_res.layoutget_res.layout_count = num_ds;
+		im->im_res.layoutget_res.stripe_type = 0; /* DMXXX ^^^^ */
+	im->im_res.layoutget_res.stripe_count = num_ds;
 
 	for (ds = 0 ; ds < num_ds ; ds++) {
-		im->im_res.layoutget_res.flist[ds].dev_id = 1; /* XXX */
-		im->im_res.layoutget_res.flist[ds].ds_index = ds;
 		memset(im->im_res.layoutget_res.flist[ds].fh_val, 0, 128); /*DMXXX*/
 		sprintf(fullpath, "%s/%s/%ld",
 			dsmountdir, dataservers[ds].ds_ip,
@@ -76,10 +75,10 @@ spnfsd_layoutget(struct spnfs_msg *im)
 
 		/*
 		 * MSXXX another hack...fix the hardcoding.
-		 * The fh's fsid_type is incremented by 5 to get
+		 * The fh's fsid_type is incremented by 8 to get
 		 * around stateid checking.
 		 */
-		im->im_res.layoutget_res.flist[ds].fh_val[2] += 5;
+		im->im_res.layoutget_res.flist[ds].fh_val[2] += 8;
 	}
 
 	return 0;

nfs-utils-1.2.0-spnfsd-07.patch:
 nfsd4_spnfs.h |    8 ++++----
 spnfsd.h      |    6 +++---
 spnfsd_ops.c  |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-07.patch ---
commit 6880a92de04cf0d4d606d27d1da60aeff11f8df4
Author: Mike Sager <sager at netapp.com>
Date:   Fri Feb 15 03:02:07 2008 -0800

    Update to draft 19.
    
    Even though a device id is now 128 bits, the userspace portion is only
    concerned with the rightmost 64 bits for now.  The leftmost 64 bits
    appear to be destined to become an fsid.  The generic pnfs layer is
    hardcoding this to 0 for the moment.  Wait and see how this plays out
    before deciding if anything needs to be done in userspace.
    
    Signed-off-by: Mike Sager <sager at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 4b3ce7f..6516ab3 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -71,7 +71,7 @@ struct spnfs_filelayout_list {
 
 struct spnfs_msg_layoutget_res {
 	int status;
-	u_int32_t dev_id;
+	u_int64_t devid;
 	u_int64_t stripe_size;
 	u_int32_t stripe_type;
 	u_int32_t stripe_count;
@@ -107,7 +107,7 @@ struct spnfs_msg_getdeviceiter_args {
 
 struct spnfs_msg_getdeviceiter_res {
 	int status;
-	u_int32_t devid;
+	u_int64_t devid;
 	u_int64_t cookie;
 	u_int64_t verf;
 	u_int32_t eof;
@@ -121,13 +121,13 @@ struct spnfs_data_server {
 };
 
 struct spnfs_device {
-	u_int32_t devid;
+	u_int64_t devid;
 	int dscount;
 	struct spnfs_data_server dslist[SPNFS_MAX_DATA_SERVERS];
 };
 
 struct spnfs_msg_getdeviceinfo_args {
-	u_int32_t devid;
+	u_int64_t devid;
 };
 
 struct spnfs_msg_getdeviceinfo_res {
diff --git a/utils/spnfsd/spnfsd.h b/utils/spnfsd/spnfsd.h
index 05029e9..e8527e7 100644
--- a/utils/spnfsd/spnfsd.h
+++ b/utils/spnfsd/spnfsd.h
@@ -39,9 +39,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 struct dserver {
-        char    *ds_ip;
-        int     ds_port;
-        char    *ds_path;
+        char	*ds_ip;
+        int	ds_port;
+        char	*ds_path;
 	int	ds_id;
 };
 
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index 645c9eb..e3adadd 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -51,7 +51,7 @@ spnfsd_layoutget(struct spnfs_msg *im)
 
 	im->im_status = SPNFS_STATUS_SUCCESS;
 	im->im_res.layoutget_res.status = 0;
-	im->im_res.layoutget_res.dev_id = 1; /* XXX */
+	im->im_res.layoutget_res.devid = 1; /* XXX */
 	im->im_res.layoutget_res.stripe_size = stripesize;
 	if (densestriping)
 		im->im_res.layoutget_res.stripe_type = 1; /* DMXXX enum */
@@ -145,7 +145,7 @@ spnfsd_getdeviceinfo(struct spnfs_msg *im)
 
 	/* XXX fix this if/when we support multiple devices */
 	if (devid != 1) {
-		im->im_res.getdeviceinfo_res.status = ENODEV;
+		im->im_res.getdeviceinfo_res.status = -ENOENT;
 		return -1;
 	}
 

nfs-utils-1.2.0-spnfsd-08.patch:
 nfsd4_spnfs.h |   35 +++++++++++++++-
 spnfsd.c      |    8 +++
 spnfsd.h      |    2 
 spnfsd_ops.c  |  126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 170 insertions(+), 1 deletion(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-08.patch ---
commit dfa1f714caaed32ebe64ae9c4f8678e6c56bce5d
Author: Dan Muntz <dmuntz at netapp.com>
Date:   Tue May 6 16:45:09 2008 -0700

    Add read/write-through-MDS for spNFS
    
    Signed-off-by: Dan Muntz <dmuntz at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index 6516ab3..fc6bd9a 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -55,9 +55,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define SPNFS_TYPE_CREATE		0x09
 #define SPNFS_TYPE_REMOVE		0x0a
 #define SPNFS_TYPE_COMMIT		0x0b
+#define SPNFS_TYPE_READ			0x0c
+#define SPNFS_TYPE_WRITE		0x0d
 
 #define	SPNFS_MAX_DEVICES		1
 #define	SPNFS_MAX_DATA_SERVERS		2
+#define SPNFS_MAX_IO			2048
 
 /* layout */
 struct spnfs_msg_layoutget_args {
@@ -198,6 +201,30 @@ struct spnfs_msg_commit_res {
 };
 */
 
+/* read */
+struct spnfs_msg_read_args {
+	unsigned long inode;
+	loff_t offset;
+	unsigned long len;
+};
+
+struct spnfs_msg_read_res {
+	int status;
+	char data[SPNFS_MAX_IO];
+};
+
+/* write */
+struct spnfs_msg_write_args {
+	unsigned long inode;
+	loff_t offset;
+	unsigned long len;
+	char data[SPNFS_MAX_IO];
+};
+
+struct spnfs_msg_write_res {
+	int status;
+};
+
 /* bundle args and responses */
 union spnfs_msg_args {
 	struct spnfs_msg_layoutget_args		layoutget_args;
@@ -217,6 +244,8 @@ union spnfs_msg_args {
 /*
 	struct spnfs_msg_commit_args		commit_args;
 */
+	struct spnfs_msg_read_args		read_args;
+	struct spnfs_msg_write_args		write_args;
 };
 
 union spnfs_msg_res {
@@ -237,6 +266,8 @@ union spnfs_msg_res {
 /*
 	struct spnfs_msg_commit_res		commit_res;
 */
+	struct spnfs_msg_read_res		read_res;
+	struct spnfs_msg_write_res		write_res;
 };
 
 /* a spnfs message, args and response */
@@ -268,7 +299,9 @@ int spnfs_getdeviceinfo(struct super_block *, struct pnfs_devinfo_arg *);
 int spnfs_setattr(void);
 int spnfs_open(struct inode *, void *);
 int spnfs_get_state(struct inode *, void *, void *);
-int spnfs_remove(unsigned long ino);
+int spnfs_remove(unsigned long);
+int spnfs_read(unsigned long, loff_t, unsigned long *, int, struct svc_rqst *);
+int spnfs_write(unsigned long, loff_t, size_t, int, struct svc_rqst *);
 
 int nfsd_spnfs_new(void);
 void nfsd_spnfs_delete(void);
diff --git a/utils/spnfsd/spnfsd.c b/utils/spnfsd/spnfsd.c
index f7bae84..fc9113d 100644
--- a/utils/spnfsd/spnfsd.c
+++ b/utils/spnfsd/spnfsd.c
@@ -40,6 +40,8 @@
  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/poll.h>
@@ -340,6 +342,12 @@ spnfs_msg_handler(struct spnfs_client *scp, struct spnfs_msg *im)
 	case SPNFS_TYPE_COMMIT:
 		err = spnfsd_commit(im);
 		break;
+	case SPNFS_TYPE_READ:
+		err = spnfsd_read(im);
+		break;
+	case SPNFS_TYPE_WRITE:
+		err = spnfsd_write(im);
+		break;
 	default:
 		spnfsd_warnx("spnfs_msg_handler: Invalid msg type (%d) in message",
 			     im->im_type);
diff --git a/utils/spnfsd/spnfsd.h b/utils/spnfsd/spnfsd.h
index e8527e7..e05c272 100644
--- a/utils/spnfsd/spnfsd.h
+++ b/utils/spnfsd/spnfsd.h
@@ -65,4 +65,6 @@ int spnfsd_close(struct spnfs_msg *);
 int spnfsd_create(struct spnfs_msg *);
 int spnfsd_remove(struct spnfs_msg *);
 int spnfsd_commit(struct spnfs_msg *);
+int spnfsd_read(struct spnfs_msg *);
+int spnfsd_write(struct spnfs_msg *);
 int spnfsd_getfh(char *, unsigned char *, unsigned int *);
diff --git a/utils/spnfsd/spnfsd_ops.c b/utils/spnfsd/spnfsd_ops.c
index e3adadd..5099c00 100644
--- a/utils/spnfsd/spnfsd_ops.c
+++ b/utils/spnfsd/spnfsd_ops.c
@@ -20,6 +20,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
 
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
 #include "nfsd4_spnfs.h"
 #include "spnfsd.h"
 #include "nfs/nfs.h"
@@ -265,6 +267,130 @@ spnfsd_remove(struct spnfs_msg *im)
 int
 spnfsd_commit(struct spnfs_msg *im)
 {
+	im->im_status = SPNFS_STATUS_SUCCESS;
+	return 0;
+}
+
+int
+min (unsigned int x, unsigned int y)
+{
+	if (x<y) return x; else return y;
+}
+
+/* DMXXX: for read and write, there's an issue with partially completed i/o */
+int
+spnfsd_read(struct spnfs_msg *im)
+{
+	unsigned long inode = im->im_args.read_args.inode;
+	loff_t offset = im->im_args.read_args.offset;
+	unsigned long len = im->im_args.read_args.len;
+	int ds, iolen;
+	loff_t soffset;
+	int bufoffset = 0;
+	char fullpath[1024]; /* DMXXX */
+	int fd, err;
+	int completed = 0;
+
+	im->im_status = SPNFS_STATUS_SUCCESS;
+	im->im_res.read_res.status = 0;
+	if (len > SPNFS_MAX_IO) {
+		im->im_res.read_res.status = -1;
+		return 0;
+	}
+	while (len > 0) {
+		ds = (offset / stripesize) % num_ds;
+		if (densestriping == 0)
+			soffset = offset;
+		else
+			soffset = (offset / num_ds) + (offset % stripesize);
+		iolen = min(len, stripesize - (offset % stripesize));
+
+		sprintf(fullpath, "%s/%s/%ld", dsmountdir,
+			dataservers[ds].ds_ip, inode);
+		fd = open(fullpath, O_RDONLY);
+		if (fd < 0) {
+			perror(fullpath);
+			im->im_res.read_res.status = -errno;
+			return 0; /* DMXXX */
+		}
+		/* DM: add some error checking */
+		lseek64(fd, offset, SEEK_SET);
+		err = read(fd,
+			(void *)(im->im_res.read_res.data+bufoffset), iolen);
+		close(fd);
+		if (err < 0) {
+			perror("read");
+			im->im_res.read_res.status = -errno;
+			return 0; /* DMXXX */
+		}
+
+		if (err == 0)
+			break;
+		iolen = err; /* number of bytes read */
+		completed += iolen;
+		len -= iolen;
+		offset += iolen;
+		bufoffset += iolen;
+	}
+	im->im_res.read_res.status = completed;
+
+	return 0;
+}
+
+int
+spnfsd_write(struct spnfs_msg *im)
+{
+	unsigned long inode = im->im_args.write_args.inode;
+	loff_t offset = im->im_args.write_args.offset;
+	size_t len = im->im_args.write_args.len;
+	char *wbuf = im->im_args.write_args.data;
+	int ds, iolen;
+	loff_t soffset;
+	int bufoffset = 0;
+	char fullpath[1024]; /* DMXXX */
+	int fd, err;
+	int completed = 0;
+
+	im->im_status = SPNFS_STATUS_SUCCESS;
+	im->im_res.write_res.status = 0;
+	if (len > SPNFS_MAX_IO) {
+		printf("write length > SPNFS_MAX_IO\n");
+		im->im_res.write_res.status = -1;
+		return 0;
+	}
+	while (len > 0) {
+		ds = (offset / stripesize) % num_ds;
+		if (densestriping == 0)
+			soffset = offset;
+		else
+			soffset = (offset / num_ds) + (offset % stripesize);
+		iolen = min(len, stripesize - (offset % stripesize));
+
+		sprintf(fullpath, "%s/%s/%ld", dsmountdir,
+			dataservers[ds].ds_ip, inode);
+		fd = open(fullpath, O_WRONLY);
+		if (fd < 0) {
+			perror(fullpath);
+			im->im_res.write_res.status = -errno;
+			return 0; /* DMXXX */
+		}
+		/* DM: add some error checking */
+		lseek64(fd, offset, SEEK_SET);
+		err = write(fd, (void *)(wbuf+bufoffset), iolen);
+		close(fd);
+		if (err < 0) {
+			perror("write");
+			im->im_res.write_res.status = -errno;
+			return 0; /* DMXXX */
+		}
+
+		iolen = err; /* number of bytes read */
+		completed += iolen;
+		len -= iolen;
+		offset += iolen;
+		bufoffset += iolen;
+	}
+	im->im_res.write_res.status = completed;
 	return 0;
 }
 

nfs-utils-1.2.0-spnfsd-09.patch:
 nfsd4_spnfs.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-09.patch ---
commit 372650b7f45ca612c7908cbec91d87d7f9c5184a
Author: Dan Muntz <dmuntz at netapp.com>
Date:   Tue Jun 3 15:44:07 2008 -0700

    Update utils for I/O through MDS, and increased number of DSs
    
    Signed-off-by: Dan Muntz <dmuntz at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index fc6bd9a..d2b8356 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -59,7 +59,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define SPNFS_TYPE_WRITE		0x0d
 
 #define	SPNFS_MAX_DEVICES		1
-#define	SPNFS_MAX_DATA_SERVERS		2
+#define	SPNFS_MAX_DATA_SERVERS		16
 #define SPNFS_MAX_IO			2048
 
 /* layout */
@@ -298,6 +298,7 @@ int spnfs_getdeviceiter(struct super_block *, struct pnfs_deviter_arg *);
 int spnfs_getdeviceinfo(struct super_block *, struct pnfs_devinfo_arg *);
 int spnfs_setattr(void);
 int spnfs_open(struct inode *, void *);
+int spnfs_close(struct inode *);
 int spnfs_get_state(struct inode *, void *, void *);
 int spnfs_remove(unsigned long);
 int spnfs_read(unsigned long, loff_t, unsigned long *, int, struct svc_rqst *);
@@ -307,6 +308,7 @@ int nfsd_spnfs_new(void);
 void nfsd_spnfs_delete(void);
 int spnfs_upcall(struct spnfs *, struct spnfs_msg *, union spnfs_msg_res *);
 int spnfs_enabled(void);
+int nfs4_spnfs_propagate_open(struct super_block *, struct svc_fh *, void *);
 
 #endif /* __KERNEL__ */
 

nfs-utils-1.2.0-spnfsd-10.patch:
 nfsd4_spnfs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-10.patch ---
commit 300e5106d9626120fd7c411c4ed723498aaca8b9
Author: Dan Muntz <dmuntz at netapp.com>
Date:   Thu Jun 12 15:44:17 2008 -0700

    Reduce size of I/O buffer as a temporary workaround for stack overflow issue.
    
    Signed-off-by: Dan Muntz <dmuntz at netapp.com>

diff --git a/utils/spnfsd/nfsd4_spnfs.h b/utils/spnfsd/nfsd4_spnfs.h
index d2b8356..b459e30 100644
--- a/utils/spnfsd/nfsd4_spnfs.h
+++ b/utils/spnfsd/nfsd4_spnfs.h
@@ -60,7 +60,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #define	SPNFS_MAX_DEVICES		1
 #define	SPNFS_MAX_DATA_SERVERS		16
-#define SPNFS_MAX_IO			2048
+#define SPNFS_MAX_IO			512
 
 /* layout */
 struct spnfs_msg_layoutget_args {

nfs-utils-1.2.0-spnfsd-installrules.patch:
 Makefile.am |   41 -----------------------------------------
 1 file changed, 41 deletions(-)

--- NEW FILE nfs-utils-1.2.0-spnfsd-installrules.patch ---
diff -up nfs-utils-1.2.0/utils/spnfsd/Makefile.am.orig nfs-utils-1.2.0/utils/spnfsd/Makefile.am
--- nfs-utils-1.2.0/utils/spnfsd/Makefile.am.orig	2009-08-27 14:31:56.046010000 -0400
+++ nfs-utils-1.2.0/utils/spnfsd/Makefile.am	2009-08-27 14:46:41.763597000 -0400
@@ -28,44 +28,3 @@ spnfsd_SOURCES = \
 spnfsd_LDADD = -levent ../../support/nfs/libnfs.a
 
 MAINTAINERCLEANFILES = Makefile.in
-
-#######################################################################
-# The following allows the current practice of having
-# daemons renamed during the install to include RPCPREFIX
-# and the KPREFIX
-# This could all be done much easier with program_transform_name
-# ( program_transform_name = s/^/$(RPCPREFIX)$(KPREFIX)/ )
-# but that also renames the man pages, which the current
-# practice does not do.
-install-exec-hook:
-	(cd $(DESTDIR)$(sbindir) && \
-	  for p in $(sbin_PROGRAMS); do \
-	    mv -f $$p$(EXEEXT) $(RPCPREFIX)$(KPREFIX)$$p$(EXEEXT) ;\
-	  done)
-uninstall-hook:
-	(cd $(DESTDIR)$(sbindir) && \
-	  for p in $(sbin_PROGRAMS); do \
-	    rm -f $(RPCPREFIX)$(KPREFIX)$$p$(EXEEXT) ;\
-	  done)
-
-
-# XXX This makes some assumptions about what automake does.
-# XXX But there is no install-man-hook or install-man-local.
-install-man: install-man5 install-man8 install-man-links
-uninstall-man: uninstall-man5 uninstall-man8 uninstall-man-links
-
-install-man-links:
-	(cd $(DESTDIR)$(man8dir) && \
-	  for m in $(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS); do \
-	    inst=`echo $$m | sed -e 's/man$$/8/'`; \
-	    rm -f $(RPCPREFIX)$$inst ; \
-	    $(LN_S) $$inst $(RPCPREFIX)$$inst ; \
-	  done)
-
-uninstall-man-links:
-	(cd $(DESTDIR)$(man8dir) && \
-	  for m in $(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS); do \
-	    inst=`echo $$m | sed -e 's/man$$/8/'`; \
-	    rm -f $(RPCPREFIX)$$inst ; \
-	  done)
-

pnfs-exports.patch:
 support/include/nfslib.h  |    1 +
 support/nfs/exports.c     |    5 +++++
 utils/exportfs/exportfs.c |    2 ++
 utils/mountd/cache.c      |    2 ++
 4 files changed, 10 insertions(+)

--- NEW FILE pnfs-exports.patch ---
diff -up nfs-utils-1.2.0/support/include/nfslib.h.orig nfs-utils-1.2.0/support/include/nfslib.h
--- nfs-utils-1.2.0/support/include/nfslib.h.orig	2009-08-27 11:56:15.475380000 -0400
+++ nfs-utils-1.2.0/support/include/nfslib.h	2009-08-27 11:56:32.497258000 -0400
@@ -90,6 +90,7 @@ struct exportent {
 	char *		e_uuid;
 	void *		e_v4root;
 	struct sec_entry e_secinfo[SECFLAVOR_COUNT+1];
+	int             e_pnfs;
 };
 
 struct rmtabent {
diff -up nfs-utils-1.2.0/support/nfs/exports.c.orig nfs-utils-1.2.0/support/nfs/exports.c
--- nfs-utils-1.2.0/support/nfs/exports.c.orig	2009-08-27 11:57:57.945647000 -0400
+++ nfs-utils-1.2.0/support/nfs/exports.c	2009-08-27 11:59:22.231103000 -0400
@@ -293,6 +293,8 @@ putexportent(struct exportent *ep)
 	}
 	fprintf(fp, "anonuid=%d,anongid=%d", ep->e_anonuid, ep->e_anongid);
 	secinfo_show(fp, ep);
+	if (ep->e_pnfs)
+		fprintf(fp, ",pnfs");
 	fprintf(fp, ")\n");
 }
 
@@ -343,6 +345,7 @@ mkexportent(char *hname, char *path, cha
 	ee.e_fslocmethod = FSLOC_NONE;
 	ee.e_fslocdata = NULL;
 	ee.e_secinfo[0].flav = NULL;
+	ee.e_pnfs = 0;
 	ee.e_nsquids = 0;
 	ee.e_nsqgids = 0;
 	ee.e_uuid = NULL;
@@ -552,6 +555,8 @@ parseopts(char *cp, struct exportent *ep
 			ep->e_flags &= ~NFSEXP_NOACL;
 		else if (strcmp(opt, "no_acl") == 0)
 			ep->e_flags |= NFSEXP_NOACL;
+		else if (strcmp(opt, "pnfs") == 0)
+			ep->e_pnfs = 1;
 		else if (strncmp(opt, "anonuid=", 8) == 0) {
 			char *oe;
 			ep->e_anonuid = strtol(opt+8, &oe, 10);
diff -up nfs-utils-1.2.0/utils/exportfs/exportfs.c.orig nfs-utils-1.2.0/utils/exportfs/exportfs.c
--- nfs-utils-1.2.0/utils/exportfs/exportfs.c.orig	2009-06-02 10:43:05.000000000 -0400
+++ nfs-utils-1.2.0/utils/exportfs/exportfs.c	2009-08-27 12:00:05.139293000 -0400
@@ -523,6 +523,8 @@ dump(int verbose)
 #endif
 			}
 			secinfo_show(stdout, ep);
+			if (ep->e_pnfs)
+				c = dumpopt(c, ",pnfs");
 			printf("%c\n", (c != '(')? ')' : ' ');
 		}
 	}
diff -up nfs-utils-1.2.0/utils/mountd/cache.c.orig nfs-utils-1.2.0/utils/mountd/cache.c
--- nfs-utils-1.2.0/utils/mountd/cache.c.orig	2009-08-27 11:54:17.895168000 -0400
+++ nfs-utils-1.2.0/utils/mountd/cache.c	2009-08-27 12:01:40.547995000 -0400
@@ -609,6 +609,8 @@ static int dump_to_cache(FILE *f, char *
 		qword_printint(f, exp->e_anonuid);
 		qword_printint(f, exp->e_anongid);
 		qword_printint(f, exp->e_fsid);
+		if (exp->e_pnfs == 1)
+			qword_print(f, "pnfs");
 		write_fsloc(f, exp, path);
 		write_secinfo(f, exp, flag_mask);
  		if (exp->e_uuid == NULL || different_fs) {


Index: nfs-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nfs-utils/devel/nfs-utils.spec,v
retrieving revision 1.240
retrieving revision 1.240.2.1
diff -u -p -r1.240 -r1.240.2.1
--- nfs-utils.spec	17 Aug 2009 13:21:50 -0000	1.240
+++ nfs-utils.spec	27 Aug 2009 19:11:41 -0000	1.240.2.1
@@ -2,7 +2,7 @@ Summary: NFS utilities and supporting cl
 Name: nfs-utils
 URL: http://sourceforge.net/projects/nfs
 Version: 1.2.0
-Release: 10%{?dist}
+Release: 10.pnfs%{?dist}
 Epoch: 1
 
 # group all 32bit related archs
@@ -29,6 +29,20 @@ Patch103: nfs-utils-1.2.1-rc4.patch
 
 Patch200: nfs-utils-1.2.0-proots-rel5.patch
 
+Patch300: pnfs-exports.patch
+
+Patch401: nfs-utils-1.2.0-spnfsd-01.patch
+Patch402: nfs-utils-1.2.0-spnfsd-02.patch
+Patch403: nfs-utils-1.2.0-spnfsd-03.patch
+Patch404: nfs-utils-1.2.0-spnfsd-04.patch
+Patch405: nfs-utils-1.2.0-spnfsd-05.patch
+Patch406: nfs-utils-1.2.0-spnfsd-06.patch
+Patch407: nfs-utils-1.2.0-spnfsd-07.patch
+Patch408: nfs-utils-1.2.0-spnfsd-08.patch
+Patch409: nfs-utils-1.2.0-spnfsd-09.patch
+Patch410: nfs-utils-1.2.0-spnfsd-10.patch
+Patch411: nfs-utils-1.2.0-spnfsd-installrules.patch
+
 Group: System Environment/Daemons
 Provides: exportfs    = %{epoch}:%{version}-%{release}
 Provides: nfsstat     = %{epoch}:%{version}-%{release}
@@ -46,6 +60,7 @@ Provides: umount.nfs  = %{epoch}:%{versi
 Provides: umount.nfs4 = %{epoch}:%{version}-%{release}
 Provides: sm-notify   = %{epoch}:%{version}-%{release}
 Provides: start-statd = %{epoch}:%{version}-%{release}
+Provides: spnfsd = %{epoch}:%{version}-%{release}
 
 License: MIT and GPLv2 and GPLv2+ and BSD
 Buildroot: %{_tmppath}/%{name}-%{version}-root
@@ -83,9 +98,25 @@ This package also contains the mount.nfs
 %patch101 -p1
 %patch102 -p1
 %patch103 -p1
-
+# proot bits
 %patch200 -p1
 
+# pnfs bits
+%patch300 -p1
+
+# spnfsd bits
+%patch401 -p1
+%patch402 -p1
+%patch403 -p1
+%patch404 -p1
+%patch405 -p1
+%patch406 -p1
+%patch407 -p1
+%patch408 -p1
+%patch409 -p1
+%patch410 -p1
+%patch411 -p1
+
 # Remove .orig files
 find . -name "*.orig" | xargs rm -f
 
@@ -239,6 +270,7 @@ fi
 /usr/sbin/rpcdebug
 /usr/sbin/rpc.mountd
 /usr/sbin/rpc.nfsd
+/usr/sbin/spnfsd
 /usr/sbin/showmount
 /usr/sbin/rpc.idmapd
 /usr/sbin/rpc.gssd
@@ -256,6 +288,10 @@ fi
 %attr(4755,root,root)   /sbin/umount.nfs4
 
 %changelog
+* Thu Aug 27 2009 Steve Dickson <steved at redhat.com> 1.2.0-10.pnfs
+- Added in the pnfs export bits.
+- Added in the spnfsd daemon
+
 * Mon Aug 17 2009 Steve Dickson <steved at redhat.com> 1.2.0-10
 - Added upstream 1.2.1-rc4 patch
   - Fix bug when both crossmnt




More information about the fedora-extras-commits mailing list