Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/nfs Update to FreeBSD revision 308975 ( approx 2016-1...



details:   https://anonhg.NetBSD.org/src/rev/06c49b15b6bd
branches:  trunk
changeset: 819106:06c49b15b6bd
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Nov 18 07:49:10 2016 +0000

description:
Update to FreeBSD revision 308975 ( approx 2016-11-18 07:30 UTC)

If I'm going to try to get this working, I should at least start with
the most recent code available.

diffstat:

 sys/fs/nfs/client/nfs.h            |   24 +-
 sys/fs/nfs/client/nfs_clcomsubs.c  |   34 +-
 sys/fs/nfs/client/nfs_clkdtrace.c  |  587 +++++++++++++++++++++
 sys/fs/nfs/client/nfs_clnode.c     |   75 +-
 sys/fs/nfs/client/nfs_clport.c     |  235 +++++--
 sys/fs/nfs/client/nfs_clrpcops.c   |  151 +++-
 sys/fs/nfs/client/nfs_clsubs.c     |   47 +-
 sys/fs/nfs/client/nfs_clvfsops.c   |  264 ++++++++-
 sys/fs/nfs/client/nfs_kdtrace.h    |   28 +-
 sys/fs/nfs/client/nfsnode.h        |    8 +-
 sys/fs/nfs/common/bootp_subr.c     |  119 ++-
 sys/fs/nfs/common/nfs.h            |  174 ++++-
 sys/fs/nfs/common/nfs_commonacl.c  |   12 +-
 sys/fs/nfs/common/nfs_commonkrpc.c |   79 +-
 sys/fs/nfs/common/nfs_commonport.c |  262 +++++++--
 sys/fs/nfs/common/nfs_commonsubs.c |  990 +++++++++++++++++++++++++++---------
 sys/fs/nfs/common/nfs_diskless.c   |   34 +-
 sys/fs/nfs/common/nfs_fha.c        |  208 +++----
 sys/fs/nfs/common/nfs_lock.c       |    8 +-
 sys/fs/nfs/common/nfs_nfssvc.c     |   10 +-
 sys/fs/nfs/common/nfs_var.h        |   73 +-
 sys/fs/nfs/common/nfsclstate.h     |    7 +-
 sys/fs/nfs/common/nfsdport.h       |   14 +-
 sys/fs/nfs/common/nfsport.h        |  151 +++-
 sys/fs/nfs/common/nfsproto.h       |  152 +++++-
 sys/fs/nfs/common/nfsrvcache.h     |   17 +-
 sys/fs/nfs/common/nfsrvstate.h     |   82 ++-
 sys/fs/nfs/common/nfssvc.h         |    7 +-
 sys/fs/nfs/nlm/nlm_advlock.c       |   60 +-
 sys/fs/nfs/server/nfs_fha_new.c    |   24 +-
 sys/fs/nfs/server/nfs_nfsdport.c   |  248 +++++---
 sys/fs/nfs/server/nfs_nfsdsocket.c |  275 ++++++++-
 32 files changed, 3320 insertions(+), 1139 deletions(-)

diffs (truncated from 7906 to 300 lines):

diff -r 6483a9b3ee2d -r 06c49b15b6bd sys/fs/nfs/client/nfs.h
--- a/sys/fs/nfs/client/nfs.h   Fri Nov 18 06:55:00 2016 +0000
+++ b/sys/fs/nfs/client/nfs.h   Fri Nov 18 07:49:10 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs.h,v 1.1.1.1 2013/09/30 07:19:30 dholland Exp $     */
+/*     $NetBSD: nfs.h,v 1.1.1.2 2016/11/18 07:49:11 pgoyette Exp $     */
 /*-
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -30,8 +30,8 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * FreeBSD: head/sys/fs/nfsclient/nfs.h 221040 2011-04-25 23:12:18Z rmacklem 
- * $NetBSD: nfs.h,v 1.1.1.1 2013/09/30 07:19:30 dholland Exp $
+ * FreeBSD: head/sys/fs/nfsclient/nfs.h 276140 2014-12-23 14:24:36Z rmacklem 
+ * $NetBSD: nfs.h,v 1.1.1.2 2016/11/18 07:49:11 pgoyette Exp $
  */
 
 #ifndef _NFSCLIENT_NFS_H_
@@ -57,6 +57,24 @@
 #define        NFS_ISV34(v) \
        (VFSTONFS((v)->v_mount)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))
 
+#ifdef NFS_DEBUG
+
+extern int nfs_debug;
+#define        NFS_DEBUG_ASYNCIO       1 /* asynchronous i/o */
+#define        NFS_DEBUG_WG            2 /* server write gathering */
+#define        NFS_DEBUG_RC            4 /* server request caching */
+
+#define        NFS_DPF(cat, args)                                      \
+       do {                                                    \
+               if (nfs_debug & NFS_DEBUG_##cat) printf args;   \
+       } while (0)
+
+#else
+
+#define        NFS_DPF(cat, args)
+
+#endif
+
 /*
  * NFS iod threads can be in one of these three states once spawned.
  * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time.
diff -r 6483a9b3ee2d -r 06c49b15b6bd sys/fs/nfs/client/nfs_clcomsubs.c
--- a/sys/fs/nfs/client/nfs_clcomsubs.c Fri Nov 18 06:55:00 2016 +0000
+++ b/sys/fs/nfs/client/nfs_clcomsubs.c Fri Nov 18 07:49:10 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_clcomsubs.c,v 1.1.1.1 2013/09/30 07:18:58 dholland Exp $   */
+/*     $NetBSD: nfs_clcomsubs.c,v 1.1.1.2 2016/11/18 07:49:10 pgoyette Exp $   */
 /*-
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -33,8 +33,8 @@
  */
 
 #include <sys/cdefs.h>
-/* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clcomsubs.c 244042 2012-12-08 22:52:39Z rmacklem "); */
-__RCSID("$NetBSD: nfs_clcomsubs.c,v 1.1.1.1 2013/09/30 07:18:58 dholland Exp $");
+/* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clcomsubs.c 304026 2016-08-12 22:44:59Z rmacklem "); */
+__RCSID("$NetBSD: nfs_clcomsubs.c,v 1.1.1.2 2016/11/18 07:49:10 pgoyette Exp $");
 
 /*
  * These functions support the macros and help fiddle mbuf chains for
@@ -44,7 +44,7 @@
 #ifndef APPLEKEXT
 #include <fs/nfs/nfsport.h>
 
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
 extern struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS];
 extern int ncl_mbuf_mlen;
 extern enum vtype newnv2tov_type[8];
@@ -68,8 +68,8 @@
        { NFSV4OP_READLINK, 2, "Readlink", 8, },
        { NFSV4OP_READ, 1, "Read", 4, },
        { NFSV4OP_WRITE, 2, "Write", 5, },
-       { NFSV4OP_OPEN, 3, "Open", 4, },
-       { NFSV4OP_CREATE, 3, "Create", 6, },
+       { NFSV4OP_OPEN, 5, "Open", 4, },
+       { NFSV4OP_CREATE, 5, "Create", 6, },
        { NFSV4OP_CREATE, 1, "Create", 6, },
        { NFSV4OP_CREATE, 3, "Create", 6, },
        { NFSV4OP_REMOVE, 1, "Remove", 6, },
@@ -205,10 +205,11 @@
                        NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
                        *tl = txdr_unsigned(NFSV4OP_SEQUENCE);
                        if (sep == NULL)
-                               nfsv4_setsequence(nd, NFSMNT_MDSSESSION(nmp),
+                               nfsv4_setsequence(nmp, nd,
+                                   NFSMNT_MDSSESSION(nmp),
                                    nfs_bigreply[procnum]);
                        else
-                               nfsv4_setsequence(nd, sep,
+                               nfsv4_setsequence(nmp, nd, sep,
                                    nfs_bigreply[procnum]);
                }
                if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh > 0) {
@@ -220,9 +221,18 @@
                            procnum != NFSPROC_COMMITDS) {
                                NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
                                *tl = txdr_unsigned(NFSV4OP_GETATTR);
-                               NFSWCCATTR_ATTRBIT(&attrbits);
+                               /*
+                                * For Lookup Ops, we want all the directory
+                                * attributes, so we can load the name cache.
+                                */
+                               if (procnum == NFSPROC_LOOKUP ||
+                                   procnum == NFSPROC_LOOKUPP)
+                                       NFSGETATTR_ATTRBIT(&attrbits);
+                               else {
+                                       NFSWCCATTR_ATTRBIT(&attrbits);
+                                       nd->nd_flag |= ND_V4WCCATTR;
+                               }
                                (void) nfsrv_putattrbit(nd, &attrbits);
-                               nd->nd_flag |= ND_V4WCCATTR;
                        }
                }
                if (procnum != NFSPROC_RENEW ||
@@ -233,8 +243,8 @@
        } else {
                (void) nfsm_fhtom(nd, nfhp, fhlen, 0);
        }
-       if (procnum < NFSV4_NPROCS)
-               NFSINCRGLOBAL(newnfsstats.rpccnt[procnum]);
+       if (procnum < NFSV41_NPROCS)
+               NFSINCRGLOBAL(nfsstatsv1.rpccnt[procnum]);
 }
 
 #ifndef APPLE
diff -r 6483a9b3ee2d -r 06c49b15b6bd sys/fs/nfs/client/nfs_clkdtrace.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/fs/nfs/client/nfs_clkdtrace.c Fri Nov 18 07:49:10 2016 +0000
@@ -0,0 +1,587 @@
+/*     $NetBSD: nfs_clkdtrace.c,v 1.1.1.1 2016/11/18 07:49:10 pgoyette Exp $   */
+/*-
+ * Copyright (c) 2009 Robert N. M. Watson
+ * All rights reserved.
+ *
+ * This software was developed at the University of Cambridge Computer
+ * Laboratory with support from a grant from Google, Inc.
+ *
+ * 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 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 AUTHOR 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 <sys/cdefs.h>
+/* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clkdtrace.c 298788 2016-04-29 16:07:25Z pfg "); */
+__RCSID("$NetBSD: nfs_clkdtrace.c,v 1.1.1.1 2016/11/18 07:49:10 pgoyette Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+
+#include <sys/dtrace.h>
+#include <sys/dtrace_bsd.h>
+
+#include <fs/nfs/nfsproto.h>
+
+#include <fs/nfsclient/nfs_kdtrace.h>
+
+/*
+ * dtnfscl is a DTrace provider that tracks the intent to perform RPCs
+ * in the NFS client, as well as access to and maintenance of the access and
+ * attribute caches.  This is not quite the same as RPCs, because NFS may
+ * issue multiple RPC transactions in the event that authentication fails,
+ * there's a jukebox error, or none at all if the access or attribute cache
+ * hits.  However, it cleanly represents the logical layer between RPC
+ * transmission and vnode/vfs operations, providing access to state linking
+ * the two.
+ */
+
+static int     dtnfsclient_unload(void);
+static void    dtnfsclient_getargdesc(void *, dtrace_id_t, void *,
+                   dtrace_argdesc_t *);
+static void    dtnfsclient_provide(void *, dtrace_probedesc_t *);
+static void    dtnfsclient_destroy(void *, dtrace_id_t, void *);
+static void    dtnfsclient_enable(void *, dtrace_id_t, void *);
+static void    dtnfsclient_disable(void *, dtrace_id_t, void *);
+static void    dtnfsclient_load(void *);
+
+static dtrace_pattr_t dtnfsclient_attr = {
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+};
+
+/*
+ * Description of NFSv4, NFSv3 and (optional) NFSv2 probes for a procedure.
+ */
+struct dtnfsclient_rpc {
+       char            *nr_v4_name;
+       char            *nr_v3_name;    /* Or NULL if none. */
+       char            *nr_v2_name;    /* Or NULL if none. */
+
+       /*
+        * IDs for the start and done cases, for NFSv2, NFSv3 and NFSv4.
+        */
+       uint32_t         nr_v2_id_start, nr_v2_id_done;
+       uint32_t         nr_v3_id_start, nr_v3_id_done;
+       uint32_t         nr_v4_id_start, nr_v4_id_done;
+};
+
+/*
+ * This table is indexed by NFSv3 procedure number, but also used for NFSv2
+ * procedure names and NFSv4 operations.
+ */
+static struct dtnfsclient_rpc  dtnfsclient_rpcs[NFSV41_NPROCS + 1] = {
+       { "null", "null", "null" },
+       { "getattr", "getattr", "getattr" },
+       { "setattr", "setattr", "setattr" },
+       { "lookup", "lookup", "lookup" },
+       { "access", "access", "noop" },
+       { "readlink", "readlink", "readlink" },
+       { "read", "read", "read" },
+       { "write", "write", "write" },
+       { "create", "create", "create" },
+       { "mkdir", "mkdir", "mkdir" },
+       { "symlink", "symlink", "symlink" },
+       { "mknod", "mknod" },
+       { "remove", "remove", "remove" },
+       { "rmdir", "rmdir", "rmdir" },
+       { "rename", "rename", "rename" },
+       { "link", "link", "link" },
+       { "readdir", "readdir", "readdir" },
+       { "readdirplus", "readdirplus" },
+       { "fsstat", "fsstat", "statfs" },
+       { "fsinfo", "fsinfo" },
+       { "pathconf", "pathconf" },
+       { "commit", "commit" },
+       { "lookupp" },
+       { "setclientid" },
+       { "setclientidcfrm" },
+       { "lock" },
+       { "locku" },
+       { "open" },
+       { "close" },
+       { "openconfirm" },
+       { "lockt" },
+       { "opendowngrade" },
+       { "renew" },
+       { "putrootfh" },
+       { "releaselckown" },
+       { "delegreturn" },
+       { "retdelegremove" },
+       { "retdelegrename1" },
+       { "retdelegrename2" },
+       { "getacl" },
+       { "setacl" },
+       { "noop", "noop", "noop" }
+};
+
+/*
+ * Module name strings.
+ */
+static char    *dtnfsclient_accesscache_str = "accesscache";
+static char    *dtnfsclient_attrcache_str = "attrcache";
+static char    *dtnfsclient_nfs2_str = "nfs2";
+static char    *dtnfsclient_nfs3_str = "nfs3";
+static char    *dtnfsclient_nfs4_str = "nfs4";
+
+/*
+ * Function name strings.
+ */
+static char    *dtnfsclient_flush_str = "flush";
+static char    *dtnfsclient_load_str = "load";
+static char    *dtnfsclient_get_str = "get";
+
+/*
+ * Name strings.
+ */
+static char    *dtnfsclient_done_str = "done";
+static char    *dtnfsclient_hit_str = "hit";
+static char    *dtnfsclient_miss_str = "miss";
+static char    *dtnfsclient_start_str = "start";
+



Home | Main Index | Thread Index | Old Index