Merge 3.15 bugfix for 3.16
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 8 May 2014 18:58:42 +0000 (14:58 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 8 May 2014 18:59:06 +0000 (14:59 -0400)
21 files changed:
fs/lockd/clnt4xdr.c
fs/lockd/clntxdr.c
fs/lockd/svc.c
fs/lockd/svcsubs.c
fs/lockd/xdr.c
fs/nfsd/export.h [new file with mode: 0644]
fs/nfsd/nfs4acl.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/nfsd/nfsd.h
fs/nfsd/nfsfh.c
fs/nfsd/nfsfh.h
fs/nfsd/state.h
fs/nfsd/stats.c
fs/nfsd/stats.h [new file with mode: 0644]
include/linux/lockd/lockd.h
include/linux/nfsd/debug.h [deleted file]
include/linux/nfsd/export.h [deleted file]
include/linux/nfsd/nfsfh.h [deleted file]
include/linux/nfsd/stats.h [deleted file]
include/uapi/linux/nfsd/nfsfh.h

index 00ec0b9c94d116fd513e356e6616a4142ef10a94..d3e40db289302b6de209f32ee0fd7926372d3e16 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/sunrpc/stats.h>
 #include <linux/lockd/lockd.h>
 
+#include <uapi/linux/nfs3.h>
+
 #define NLMDBG_FACILITY                NLMDBG_XDR
 
 #if (NLMCLNT_OHSIZE > XDR_MAX_NETOBJ)
index 9a55797a1cd420ac6b5fa051ebfc9d5780f2ccca..3e9f7874b9755485952632757c74aad7389e5f56 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/sunrpc/stats.h>
 #include <linux/lockd/lockd.h>
 
+#include <uapi/linux/nfs2.h>
+
 #define NLMDBG_FACILITY                NLMDBG_XDR
 
 #if (NLMCLNT_OHSIZE > XDR_MAX_NETOBJ)
index 6bf06a07f3e00b56e3d738fd0cdd898521ec323f..2b431f7266c39131c1e8f195a2c53c9340c0b055 100644 (file)
@@ -622,8 +622,8 @@ static int __init init_nlm(void)
 err_pernet:
 #ifdef CONFIG_SYSCTL
        unregister_sysctl_table(nlm_sysctl_table);
-#endif
 err_sysctl:
+#endif
        return err;
 }
 
index dc5c75930f0fea94145c9556f2aab6dbc8ea91a3..b6f3b84b6e9975062cb6516291971dcbe86ce120 100644 (file)
 #include <linux/mutex.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/sunrpc/addr.h>
-#include <linux/nfsd/nfsfh.h>
-#include <linux/nfsd/export.h>
 #include <linux/lockd/lockd.h>
 #include <linux/lockd/share.h>
 #include <linux/module.h>
 #include <linux/mount.h>
+#include <uapi/linux/nfs2.h>
 
 #define NLMDBG_FACILITY                NLMDBG_SVCSUBS
 
index 964666c68a868a8319bef30a6b1ca1a0be868e69..9340e7e10ef60b957bab1b710ef3087d235dd32f 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/sunrpc/stats.h>
 #include <linux/lockd/lockd.h>
 
+#include <uapi/linux/nfs2.h>
+
 #define NLMDBG_FACILITY                NLMDBG_XDR
 
 
diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h
new file mode 100644 (file)
index 0000000..d7939a6
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
+ */
+#ifndef NFSD_EXPORT_H
+#define NFSD_EXPORT_H
+
+#include <linux/sunrpc/cache.h>
+#include <uapi/linux/nfsd/export.h>
+
+struct knfsd_fh;
+struct svc_fh;
+struct svc_rqst;
+
+/*
+ * FS Locations
+ */
+
+#define MAX_FS_LOCATIONS       128
+
+struct nfsd4_fs_location {
+       char *hosts; /* colon separated list of hosts */
+       char *path;  /* slash separated list of path components */
+};
+
+struct nfsd4_fs_locations {
+       uint32_t locations_count;
+       struct nfsd4_fs_location *locations;
+/* If we're not actually serving this data ourselves (only providing a
+ * list of replicas that do serve it) then we set "migrated": */
+       int migrated;
+};
+
+/*
+ * We keep an array of pseudoflavors with the export, in order from most
+ * to least preferred.  For the foreseeable future, we don't expect more
+ * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
+ * spkm3i, and spkm3p (and using all 8 at once should be rare).
+ */
+#define MAX_SECINFO_LIST       8
+
+struct exp_flavor_info {
+       u32     pseudoflavor;
+       u32     flags;
+};
+
+struct svc_export {
+       struct cache_head       h;
+       struct auth_domain *    ex_client;
+       int                     ex_flags;
+       struct path             ex_path;
+       kuid_t                  ex_anon_uid;
+       kgid_t                  ex_anon_gid;
+       int                     ex_fsid;
+       unsigned char *         ex_uuid; /* 16 byte fsid */
+       struct nfsd4_fs_locations ex_fslocs;
+       int                     ex_nflavors;
+       struct exp_flavor_info  ex_flavors[MAX_SECINFO_LIST];
+       struct cache_detail     *cd;
+};
+
+/* an "export key" (expkey) maps a filehandlefragement to an
+ * svc_export for a given client.  There can be several per export,
+ * for the different fsid types.
+ */
+struct svc_expkey {
+       struct cache_head       h;
+
+       struct auth_domain *    ek_client;
+       int                     ek_fsidtype;
+       u32                     ek_fsid[6];
+
+       struct path             ek_path;
+};
+
+#define EX_ISSYNC(exp)         (!((exp)->ex_flags & NFSEXP_ASYNC))
+#define EX_NOHIDE(exp)         ((exp)->ex_flags & NFSEXP_NOHIDE)
+#define EX_WGATHER(exp)                ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
+
+int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
+__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
+
+/*
+ * Function declarations
+ */
+int                    nfsd_export_init(struct net *);
+void                   nfsd_export_shutdown(struct net *);
+void                   nfsd_export_flush(struct net *);
+struct svc_export *    rqst_exp_get_by_name(struct svc_rqst *,
+                                            struct path *);
+struct svc_export *    rqst_exp_parent(struct svc_rqst *,
+                                       struct path *);
+struct svc_export *    rqst_find_fsidzero_export(struct svc_rqst *);
+int                    exp_rootfh(struct net *, struct auth_domain *,
+                                       char *path, struct knfsd_fh *, int maxsize);
+__be32                 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
+__be32                 nfserrno(int errno);
+
+static inline void exp_put(struct svc_export *exp)
+{
+       cache_put(&exp->h, exp->cd);
+}
+
+static inline void exp_get(struct svc_export *exp)
+{
+       cache_get(&exp->h);
+}
+struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
+
+#endif /* NFSD_EXPORT_H */
index b6f46013dddf26bc5306349a26160aa5c9450eb7..05c9b2f9427b712d97474219d8d88af9d65a374b 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <linux/slab.h>
 #include <linux/nfs_fs.h>
-#include <linux/export.h>
 #include "nfsfh.h"
 #include "nfsd.h"
 #include "acl.h"
index d543222babf36beb28aba95afd746ddd9298d8ce..ac837783b37dacb64c56769a4b88c0ecf35adcf3 100644 (file)
@@ -786,7 +786,6 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        if (!nfsd4_last_compound_op(rqstp))
                rqstp->rq_splice_ok = false;
 
-       nfs4_lock_state();
        /* check stateid */
        if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
                                                 cstate, &read->rd_stateid,
@@ -794,11 +793,8 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                dprintk("NFSD: nfsd4_read: couldn't process stateid!\n");
                goto out;
        }
-       if (read->rd_filp)
-               get_file(read->rd_filp);
        status = nfs_ok;
 out:
-       nfs4_unlock_state();
        read->rd_rqstp = rqstp;
        read->rd_fhp = &cstate->current_fh;
        return status;
@@ -937,10 +933,8 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        int err;
 
        if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
-               nfs4_lock_state();
                status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), cstate,
                        &setattr->sa_stateid, WR_STATE, NULL);
-               nfs4_unlock_state();
                if (status) {
                        dprintk("NFSD: nfsd4_setattr: couldn't process stateid!\n");
                        return status;
@@ -1006,17 +1000,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        if (write->wr_offset >= OFFSET_MAX)
                return nfserr_inval;
 
-       nfs4_lock_state();
        status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
                                        cstate, stateid, WR_STATE, &filp);
        if (status) {
-               nfs4_unlock_state();
                dprintk("NFSD: nfsd4_write: couldn't process stateid!\n");
                return status;
        }
-       if (filp)
-               get_file(filp);
-       nfs4_unlock_state();
 
        cnt = write->wr_buflen;
        write->wr_how_written = write->wr_stable_how;
index 32b699bebb9c3e7281ba58e1d123dc6c2f0ce361..b5278941f3a1069e4e6985f09b13a08a78772325 100644 (file)
@@ -645,6 +645,12 @@ static void unhash_lockowner(struct nfs4_lockowner *lo)
        }
 }
 
+static void nfs4_free_lockowner(struct nfs4_lockowner *lo)
+{
+       kfree(lo->lo_owner.so_owner.data);
+       kmem_cache_free(lockowner_slab, lo);
+}
+
 static void release_lockowner(struct nfs4_lockowner *lo)
 {
        unhash_lockowner(lo);
@@ -699,6 +705,12 @@ static void release_last_closed_stateid(struct nfs4_openowner *oo)
        }
 }
 
+static void nfs4_free_openowner(struct nfs4_openowner *oo)
+{
+       kfree(oo->oo_owner.so_owner.data);
+       kmem_cache_free(openowner_slab, oo);
+}
+
 static void release_openowner(struct nfs4_openowner *oo)
 {
        unhash_openowner(oo);
@@ -1093,7 +1105,7 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name)
        return clp;
 }
 
-static inline void
+static void
 free_client(struct nfs4_client *clp)
 {
        struct nfsd_net __maybe_unused *nn = net_generic(clp->net, nfsd_net_id);
@@ -2553,18 +2565,6 @@ out_nomem:
        return -ENOMEM;
 }
 
-void nfs4_free_openowner(struct nfs4_openowner *oo)
-{
-       kfree(oo->oo_owner.so_owner.data);
-       kmem_cache_free(openowner_slab, oo);
-}
-
-void nfs4_free_lockowner(struct nfs4_lockowner *lo)
-{
-       kfree(lo->lo_owner.so_owner.data);
-       kmem_cache_free(lockowner_slab, lo);
-}
-
 static void init_nfs4_replay(struct nfs4_replay *rp)
 {
        rp->rp_status = nfserr_serverfault;
@@ -3654,6 +3654,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
        struct svc_fh *current_fh = &cstate->current_fh;
        struct inode *ino = current_fh->fh_dentry->d_inode;
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+       struct file *file = NULL;
        __be32 status;
 
        if (filpp)
@@ -3665,10 +3666,12 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
        if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
                return check_special_stateids(net, current_fh, stateid, flags);
 
+       nfs4_lock_state();
+
        status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID,
                                      &s, cstate->minorversion, nn);
        if (status)
-               return status;
+               goto out;
        status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate));
        if (status)
                goto out;
@@ -3679,8 +3682,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
                if (status)
                        goto out;
                if (filpp) {
-                       *filpp = dp->dl_file->fi_deleg_file;
-                       if (!*filpp) {
+                       file = dp->dl_file->fi_deleg_file;
+                       if (!file) {
                                WARN_ON_ONCE(1);
                                status = nfserr_serverfault;
                                goto out;
@@ -3701,16 +3704,20 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate,
                        goto out;
                if (filpp) {
                        if (flags & RD_STATE)
-                               *filpp = find_readable_file(stp->st_file);
+                               file = find_readable_file(stp->st_file);
                        else
-                               *filpp = find_writeable_file(stp->st_file);
+                               file = find_writeable_file(stp->st_file);
                }
                break;
        default:
-               return nfserr_bad_stateid;
+               status = nfserr_bad_stateid;
+               goto out;
        }
        status = nfs_ok;
+       if (file)
+               *filpp = get_file(file);
 out:
+       nfs4_unlock_state();
        return status;
 }
 
index 479eb681c27c31ab5b55ce99cc79777cacb45721..e9f2fd42d18424eb0b7eb8c5d7f4e6777afe1989 100644 (file)
 #include <linux/nfs2.h>
 #include <linux/nfs3.h>
 #include <linux/nfs4.h>
+#include <linux/sunrpc/svc.h>
 #include <linux/sunrpc/msg_prot.h>
 
-#include <linux/nfsd/debug.h>
-#include <linux/nfsd/export.h>
-#include <linux/nfsd/stats.h>
+#include <uapi/linux/nfsd/debug.h>
+
+#include "stats.h"
+#include "export.h"
+
+#undef ifdebug
+#ifdef NFSD_DEBUG
+# define ifdebug(flag)         if (nfsd_debug & NFSDDBG_##flag)
+#else
+# define ifdebug(flag)         if (0)
+#endif
 
 /*
  * nfsd version
index 3c37b160dcad22c6db5dc469f52ff0b2b2f68f00..a337106d687523e59ce39d21feeb70a1c1ef7e0a 100644 (file)
@@ -169,8 +169,8 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
                data_left -= len;
                if (data_left < 0)
                        return error;
-               exp = rqst_exp_find(rqstp, fh->fh_fsid_type, fh->fh_auth);
-               fid = (struct fid *)(fh->fh_auth + len);
+               exp = rqst_exp_find(rqstp, fh->fh_fsid_type, fh->fh_fsid);
+               fid = (struct fid *)(fh->fh_fsid + len);
        } else {
                __u32 tfh[2];
                dev_t xdev;
@@ -385,7 +385,7 @@ static void _fh_update(struct svc_fh *fhp, struct svc_export *exp,
 {
        if (dentry != exp->ex_path.dentry) {
                struct fid *fid = (struct fid *)
-                       (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1);
+                       (fhp->fh_handle.fh_fsid + fhp->fh_handle.fh_size/4 - 1);
                int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
                int subtreecheck = !(exp->ex_flags & NFSEXP_NOSUBTREECHECK);
 
@@ -513,7 +513,6 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
         */
 
        struct inode * inode = dentry->d_inode;
-       __u32 *datap;
        dev_t ex_dev = exp_sb(exp)->s_dev;
 
        dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n",
@@ -557,17 +556,16 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
                if (inode)
                        _fh_update_old(dentry, exp, &fhp->fh_handle);
        } else {
-               int len;
+               fhp->fh_handle.fh_size =
+                       key_len(fhp->fh_handle.fh_fsid_type) + 4;
                fhp->fh_handle.fh_auth_type = 0;
-               datap = fhp->fh_handle.fh_auth+0;
-               mk_fsid(fhp->fh_handle.fh_fsid_type, datap, ex_dev,
+
+               mk_fsid(fhp->fh_handle.fh_fsid_type,
+                       fhp->fh_handle.fh_fsid,
+                       ex_dev,
                        exp->ex_path.dentry->d_inode->i_ino,
                        exp->ex_fsid, exp->ex_uuid);
 
-               len = key_len(fhp->fh_handle.fh_fsid_type);
-               datap += len/4;
-               fhp->fh_handle.fh_size = 4 + len;
-
                if (inode)
                        _fh_update(fhp, exp, dentry);
                if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) {
index ad67964d0bb198c0a516bb5adf10d31b060478f5..2e89e70ac15c8f2df95fcac9d58b7b96bd93cb42 100644 (file)
@@ -1,9 +1,58 @@
-/* Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> */
+/*
+ * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
+ *
+ * This file describes the layout of the file handles as passed
+ * over the wire.
+ */
+#ifndef _LINUX_NFSD_NFSFH_H
+#define _LINUX_NFSD_NFSFH_H
+
+#include <linux/sunrpc/svc.h>
+#include <uapi/linux/nfsd/nfsfh.h>
+
+static inline __u32 ino_t_to_u32(ino_t ino)
+{
+       return (__u32) ino;
+}
+
+static inline ino_t u32_to_ino_t(__u32 uino)
+{
+       return (ino_t) uino;
+}
 
-#ifndef _LINUX_NFSD_FH_INT_H
-#define _LINUX_NFSD_FH_INT_H
+/*
+ * This is the internal representation of an NFS handle used in knfsd.
+ * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
+ */
+typedef struct svc_fh {
+       struct knfsd_fh         fh_handle;      /* FH data */
+       struct dentry *         fh_dentry;      /* validated dentry */
+       struct svc_export *     fh_export;      /* export pointer */
+       int                     fh_maxsize;     /* max size for fh_handle */
+
+       unsigned char           fh_locked;      /* inode locked by us */
+       unsigned char           fh_want_write;  /* remount protection taken */
+
+#ifdef CONFIG_NFSD_V3
+       unsigned char           fh_post_saved;  /* post-op attrs saved */
+       unsigned char           fh_pre_saved;   /* pre-op attrs saved */
+
+       /* Pre-op attributes saved during fh_lock */
+       __u64                   fh_pre_size;    /* size before operation */
+       struct timespec         fh_pre_mtime;   /* mtime before oper */
+       struct timespec         fh_pre_ctime;   /* ctime before oper */
+       /*
+        * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
+        *  to find out if it is valid.
+        */
+       u64                     fh_pre_change;
+
+       /* Post-op attributes saved in fh_unlock */
+       struct kstat            fh_post_attr;   /* full attrs after operation */
+       u64                     fh_post_change; /* nfsv4 change; see above */
+#endif /* CONFIG_NFSD_V3 */
 
-#include <linux/nfsd/nfsfh.h>
+} svc_fh;
 
 enum nfsd_fsid {
        FSID_DEV = 0,
@@ -215,4 +264,4 @@ fh_unlock(struct svc_fh *fhp)
        }
 }
 
-#endif /* _LINUX_NFSD_FH_INT_H */
+#endif /* _LINUX_NFSD_NFSFH_H */
index 424d8f5f231737780031a903ee575173af8076f0..fda9ce28b1b24d82f8071dfb01aac948fa8c0d67 100644 (file)
@@ -37,7 +37,6 @@
 
 #include <linux/idr.h>
 #include <linux/sunrpc/svc_xprt.h>
-#include <linux/nfsd/nfsfh.h>
 #include "nfsfh.h"
 
 typedef struct {
@@ -464,8 +463,6 @@ extern void nfs4_release_reclaim(struct nfsd_net *);
 extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
                                                        struct nfsd_net *nn);
 extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn);
-extern void nfs4_free_openowner(struct nfs4_openowner *);
-extern void nfs4_free_lockowner(struct nfs4_lockowner *);
 extern int set_callback_cred(void);
 extern void nfsd4_init_callback(struct nfsd4_callback *);
 extern void nfsd4_probe_callback(struct nfs4_client *clp);
index 6d4521feb6e339729d9e9e8583088fcd1e0ec6f9..cd90878a76aaa8498933a087e6959f532d0f5a47 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/seq_file.h>
 #include <linux/module.h>
 #include <linux/sunrpc/stats.h>
-#include <linux/nfsd/stats.h>
 #include <net/net_namespace.h>
 
 #include "nfsd.h"
diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h
new file mode 100644 (file)
index 0000000..a5c944b
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Statistics for NFS server.
+ *
+ * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
+ */
+#ifndef _NFSD_STATS_H
+#define _NFSD_STATS_H
+
+#include <uapi/linux/nfsd/stats.h>
+
+
+struct nfsd_stats {
+       unsigned int    rchits;         /* repcache hits */
+       unsigned int    rcmisses;       /* repcache hits */
+       unsigned int    rcnocache;      /* uncached reqs */
+       unsigned int    fh_stale;       /* FH stale error */
+       unsigned int    fh_lookup;      /* dentry cached */
+       unsigned int    fh_anon;        /* anon file dentry returned */
+       unsigned int    fh_nocache_dir; /* filehandle not found in dcache */
+       unsigned int    fh_nocache_nondir;      /* filehandle not found in dcache */
+       unsigned int    io_read;        /* bytes returned to read requests */
+       unsigned int    io_write;       /* bytes passed in write requests */
+       unsigned int    th_cnt;         /* number of available threads */
+       unsigned int    th_usage[10];   /* number of ticks during which n perdeciles
+                                        * of available threads were in use */
+       unsigned int    th_fullcnt;     /* number of times last free thread was used */
+       unsigned int    ra_size;        /* size of ra cache */
+       unsigned int    ra_depth[11];   /* number of times ra entry was found that deep
+                                        * in the cache (10percentiles). [10] = not found */
+#ifdef CONFIG_NFSD_V4
+       unsigned int    nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
+#endif
+
+};
+
+
+extern struct nfsd_stats       nfsdstats;
+extern struct svc_stat         nfsd_svcstats;
+
+void   nfsd_stat_init(void);
+void   nfsd_stat_shutdown(void);
+
+#endif /* _NFSD_STATS_H */
index dcaad79f54ed5e74985c165585a354c6d04e0bc0..219d79627c05afc2b0766085b73697a4b41bc621 100644 (file)
 #include <linux/fs.h>
 #include <linux/kref.h>
 #include <linux/utsname.h>
-#include <linux/nfsd/nfsfh.h>
 #include <linux/lockd/bind.h>
 #include <linux/lockd/xdr.h>
 #ifdef CONFIG_LOCKD_V4
 #include <linux/lockd/xdr4.h>
 #endif
 #include <linux/lockd/debug.h>
+#include <linux/sunrpc/svc.h>
 
 /*
  * Version string
diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h
deleted file mode 100644 (file)
index 19ef837..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * linux/include/linux/nfsd/debug.h
- *
- * Debugging-related stuff for nfsd
- *
- * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
- */
-#ifndef LINUX_NFSD_DEBUG_H
-#define LINUX_NFSD_DEBUG_H
-
-#include <uapi/linux/nfsd/debug.h>
-
-# undef ifdebug
-# ifdef NFSD_DEBUG
-#  define ifdebug(flag)                if (nfsd_debug & NFSDDBG_##flag)
-# else
-#  define ifdebug(flag)                if (0)
-# endif
-#endif /* LINUX_NFSD_DEBUG_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
deleted file mode 100644 (file)
index 7898c99..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * include/linux/nfsd/export.h
- * 
- * Public declarations for NFS exports. The definitions for the
- * syscall interface are in nfsctl.h
- *
- * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
- */
-#ifndef NFSD_EXPORT_H
-#define NFSD_EXPORT_H
-
-# include <linux/nfsd/nfsfh.h>
-#include <uapi/linux/nfsd/export.h>
-
-/*
- * FS Locations
- */
-
-#define MAX_FS_LOCATIONS       128
-
-struct nfsd4_fs_location {
-       char *hosts; /* colon separated list of hosts */
-       char *path;  /* slash separated list of path components */
-};
-
-struct nfsd4_fs_locations {
-       uint32_t locations_count;
-       struct nfsd4_fs_location *locations;
-/* If we're not actually serving this data ourselves (only providing a
- * list of replicas that do serve it) then we set "migrated": */
-       int migrated;
-};
-
-/*
- * We keep an array of pseudoflavors with the export, in order from most
- * to least preferred.  For the foreseeable future, we don't expect more
- * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
- * spkm3i, and spkm3p (and using all 8 at once should be rare).
- */
-#define MAX_SECINFO_LIST       8
-
-struct exp_flavor_info {
-       u32     pseudoflavor;
-       u32     flags;
-};
-
-struct svc_export {
-       struct cache_head       h;
-       struct auth_domain *    ex_client;
-       int                     ex_flags;
-       struct path             ex_path;
-       kuid_t                  ex_anon_uid;
-       kgid_t                  ex_anon_gid;
-       int                     ex_fsid;
-       unsigned char *         ex_uuid; /* 16 byte fsid */
-       struct nfsd4_fs_locations ex_fslocs;
-       int                     ex_nflavors;
-       struct exp_flavor_info  ex_flavors[MAX_SECINFO_LIST];
-       struct cache_detail     *cd;
-};
-
-/* an "export key" (expkey) maps a filehandlefragement to an
- * svc_export for a given client.  There can be several per export,
- * for the different fsid types.
- */
-struct svc_expkey {
-       struct cache_head       h;
-
-       struct auth_domain *    ek_client;
-       int                     ek_fsidtype;
-       u32                     ek_fsid[6];
-
-       struct path             ek_path;
-};
-
-#define EX_ISSYNC(exp)         (!((exp)->ex_flags & NFSEXP_ASYNC))
-#define EX_NOHIDE(exp)         ((exp)->ex_flags & NFSEXP_NOHIDE)
-#define EX_WGATHER(exp)                ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
-
-int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
-__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
-
-/*
- * Function declarations
- */
-int                    nfsd_export_init(struct net *);
-void                   nfsd_export_shutdown(struct net *);
-void                   nfsd_export_flush(struct net *);
-struct svc_export *    rqst_exp_get_by_name(struct svc_rqst *,
-                                            struct path *);
-struct svc_export *    rqst_exp_parent(struct svc_rqst *,
-                                       struct path *);
-struct svc_export *    rqst_find_fsidzero_export(struct svc_rqst *);
-int                    exp_rootfh(struct net *, struct auth_domain *,
-                                       char *path, struct knfsd_fh *, int maxsize);
-__be32                 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
-__be32                 nfserrno(int errno);
-
-static inline void exp_put(struct svc_export *exp)
-{
-       cache_put(&exp->h, exp->cd);
-}
-
-static inline void exp_get(struct svc_export *exp)
-{
-       cache_get(&exp->h);
-}
-struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
-
-#endif /* NFSD_EXPORT_H */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
deleted file mode 100644 (file)
index a93593f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * include/linux/nfsd/nfsfh.h
- *
- * This file describes the layout of the file handles as passed
- * over the wire.
- *
- * Earlier versions of knfsd used to sign file handles using keyed MD5
- * or SHA. I've removed this code, because it doesn't give you more
- * security than blocking external access to port 2049 on your firewall.
- *
- * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
- */
-#ifndef _LINUX_NFSD_FH_H
-#define _LINUX_NFSD_FH_H
-
-# include <linux/sunrpc/svc.h>
-#include <uapi/linux/nfsd/nfsfh.h>
-
-static inline __u32 ino_t_to_u32(ino_t ino)
-{
-       return (__u32) ino;
-}
-
-static inline ino_t u32_to_ino_t(__u32 uino)
-{
-       return (ino_t) uino;
-}
-
-/*
- * This is the internal representation of an NFS handle used in knfsd.
- * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
- */
-typedef struct svc_fh {
-       struct knfsd_fh         fh_handle;      /* FH data */
-       struct dentry *         fh_dentry;      /* validated dentry */
-       struct svc_export *     fh_export;      /* export pointer */
-       int                     fh_maxsize;     /* max size for fh_handle */
-
-       unsigned char           fh_locked;      /* inode locked by us */
-       unsigned char           fh_want_write;  /* remount protection taken */
-
-#ifdef CONFIG_NFSD_V3
-       unsigned char           fh_post_saved;  /* post-op attrs saved */
-       unsigned char           fh_pre_saved;   /* pre-op attrs saved */
-
-       /* Pre-op attributes saved during fh_lock */
-       __u64                   fh_pre_size;    /* size before operation */
-       struct timespec         fh_pre_mtime;   /* mtime before oper */
-       struct timespec         fh_pre_ctime;   /* ctime before oper */
-       /*
-        * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
-        *  to find out if it is valid.
-        */
-       u64                     fh_pre_change;
-
-       /* Post-op attributes saved in fh_unlock */
-       struct kstat            fh_post_attr;   /* full attrs after operation */
-       u64                     fh_post_change; /* nfsv4 change; see above */
-#endif /* CONFIG_NFSD_V3 */
-
-} svc_fh;
-
-#endif /* _LINUX_NFSD_FH_H */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
deleted file mode 100644 (file)
index e75b254..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * linux/include/linux/nfsd/stats.h
- *
- * Statistics for NFS server.
- *
- * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
- */
-#ifndef LINUX_NFSD_STATS_H
-#define LINUX_NFSD_STATS_H
-
-#include <uapi/linux/nfsd/stats.h>
-
-
-struct nfsd_stats {
-       unsigned int    rchits;         /* repcache hits */
-       unsigned int    rcmisses;       /* repcache hits */
-       unsigned int    rcnocache;      /* uncached reqs */
-       unsigned int    fh_stale;       /* FH stale error */
-       unsigned int    fh_lookup;      /* dentry cached */
-       unsigned int    fh_anon;        /* anon file dentry returned */
-       unsigned int    fh_nocache_dir; /* filehandle not found in dcache */
-       unsigned int    fh_nocache_nondir;      /* filehandle not found in dcache */
-       unsigned int    io_read;        /* bytes returned to read requests */
-       unsigned int    io_write;       /* bytes passed in write requests */
-       unsigned int    th_cnt;         /* number of available threads */
-       unsigned int    th_usage[10];   /* number of ticks during which n perdeciles
-                                        * of available threads were in use */
-       unsigned int    th_fullcnt;     /* number of times last free thread was used */
-       unsigned int    ra_size;        /* size of ra cache */
-       unsigned int    ra_depth[11];   /* number of times ra entry was found that deep
-                                        * in the cache (10percentiles). [10] = not found */
-#ifdef CONFIG_NFSD_V4
-       unsigned int    nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
-#endif
-
-};
-
-
-extern struct nfsd_stats       nfsdstats;
-extern struct svc_stat         nfsd_svcstats;
-
-void   nfsd_stat_init(void);
-void   nfsd_stat_shutdown(void);
-
-#endif /* LINUX_NFSD_STATS_H */
index 616e3b396476838115eadb2b196dd206cec2a3be..20391235d088913e239e974d1c21ce22d73e4fc7 100644 (file)
@@ -1,13 +1,7 @@
 /*
- * include/linux/nfsd/nfsfh.h
- *
  * This file describes the layout of the file handles as passed
  * over the wire.
  *
- * Earlier versions of knfsd used to sign file handles using keyed MD5
- * or SHA. I've removed this code, because it doesn't give you more
- * security than blocking external access to port 2049 on your firewall.
- *
  * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
  */
 
@@ -37,7 +31,7 @@ struct nfs_fhbase_old {
 };
 
 /*
- * This is the new flexible, extensible style NFSv2/v3 file handle.
+ * This is the new flexible, extensible style NFSv2/v3/v4 file handle.
  * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
  *
  * The file handle starts with a sequence of four-byte words.
@@ -47,14 +41,7 @@ struct nfs_fhbase_old {
  *
  * All four-byte values are in host-byte-order.
  *
- * The auth_type field specifies how the filehandle can be authenticated
- * This might allow a file to be confirmed to be in a writable part of a
- * filetree without checking the path from it up to the root.
- * Current values:
- *     0  - No authentication.  fb_auth is 0 bytes long
- * Possible future values:
- *     1  - 4 bytes taken from MD5 hash of the remainer of the file handle
- *          prefixed by a secret and with the important export flags.
+ * The auth_type field is deprecated and must be set to 0.
  *
  * The fsid_type identifies how the filesystem (or export point) is
  *    encoded.
@@ -71,14 +58,9 @@ struct nfs_fhbase_old {
  *     7  - 8 byte inode number and 16 byte uuid
  *
  * The fileid_type identified how the file within the filesystem is encoded.
- * This is (will be) passed to, and set by, the underlying filesystem if it supports
- * filehandle operations.  The filesystem must not use the value '0' or '0xff' and may
- * only use the values 1 and 2 as defined below:
- *  Current values:
- *    0   - The root, or export point, of the filesystem.  fb_fileid is 0 bytes.
- *    1   - 32bit inode number, 32 bit generation number.
- *    2   - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
- *
+ *   The values for this field are filesystem specific, exccept that
+ *   filesystems must not use the values '0' or '0xff'. 'See enum fid_type'
+ *   in include/linux/exportfs.h for currently registered values.
  */
 struct nfs_fhbase_new {
        __u8            fb_version;     /* == 1, even => nfs_fhbase_old */
@@ -114,9 +96,9 @@ struct knfsd_fh {
 #define        fh_fsid_type            fh_base.fh_new.fb_fsid_type
 #define        fh_auth_type            fh_base.fh_new.fb_auth_type
 #define        fh_fileid_type          fh_base.fh_new.fb_fileid_type
-#define        fh_auth                 fh_base.fh_new.fb_auth
 #define        fh_fsid                 fh_base.fh_new.fb_auth
 
-
+/* Do not use, provided for userspace compatiblity. */
+#define        fh_auth                 fh_base.fh_new.fb_auth
 
 #endif /* _UAPI_LINUX_NFSD_FH_H */