NFSD: Remove NFSD_TCP kernel build option
[safe/jmp/linux-2.6] / fs / nfsd / nfssvc.c
index 8067118..941041f 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <linux/module.h>
-
+#include <linux/sched.h>
 #include <linux/time.h>
 #include <linux/errno.h>
 #include <linux/nfs.h>
@@ -19,6 +19,7 @@
 #include <linux/slab.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
+#include <linux/freezer.h>
 #include <linux/fs_struct.h>
 
 #include <linux/sunrpc/types.h>
@@ -72,7 +73,7 @@ static struct svc_program     nfsd_acl_program = {
        .pg_prog                = NFS_ACL_PROGRAM,
        .pg_nvers               = NFSD_ACL_NRVERS,
        .pg_vers                = nfsd_acl_versions,
-       .pg_name                = "nfsd",
+       .pg_name                = "nfsacl",
        .pg_class               = "nfsd",
        .pg_stats               = &nfsd_acl_svcstats,
        .pg_authenticate        = &svc_set_client,
@@ -118,16 +119,16 @@ int nfsd_vers(int vers, enum vers_op change)
        switch(change) {
        case NFSD_SET:
                nfsd_versions[vers] = nfsd_version[vers];
-               break;
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
                if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_version[vers] = nfsd_acl_version[vers];
+                       nfsd_acl_versions[vers] = nfsd_acl_version[vers];
 #endif
+               break;
        case NFSD_CLEAR:
                nfsd_versions[vers] = NULL;
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
                if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_version[vers] = NULL;
+                       nfsd_acl_versions[vers] = NULL;
 #endif
                break;
        case NFSD_TEST:
@@ -154,8 +155,8 @@ static int killsig; /* signal that was used to kill last nfsd */
 static void nfsd_last_thread(struct svc_serv *serv)
 {
        /* When last nfsd thread exits we need to do some clean-up */
-       struct svc_sock *svsk;
-       list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
+       struct svc_xprt *xprt;
+       list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list)
                lockd_down();
        nfsd_serv = NULL;
        nfsd_racache_shutdown();
@@ -235,23 +236,23 @@ static int nfsd_init_socks(int port)
 
        error = lockd_up(IPPROTO_UDP);
        if (error >= 0) {
-               error = svc_makesock(nfsd_serv, IPPROTO_UDP, port);
+               error = svc_create_xprt(nfsd_serv, "udp", port,
+                                       SVC_SOCK_DEFAULTS);
                if (error < 0)
                        lockd_down();
        }
        if (error < 0)
                return error;
 
-#ifdef CONFIG_NFSD_TCP
        error = lockd_up(IPPROTO_TCP);
        if (error >= 0) {
-               error = svc_makesock(nfsd_serv, IPPROTO_TCP, port);
+               error = svc_create_xprt(nfsd_serv, "tcp", port,
+                                       SVC_SOCK_DEFAULTS);
                if (error < 0)
                        lockd_down();
        }
        if (error < 0)
                return error;
-#endif
        return 0;
 }
 
@@ -346,9 +347,7 @@ nfsd_svc(unsigned short port, int nrservs)
        error = nfsd_racache_init(2*nrservs);
        if (error<0)
                goto out;
-       error = nfs4_state_start();
-       if (error<0)
-               goto out;
+       nfs4_state_start();
 
        nfsd_reset_versions();
 
@@ -430,6 +429,7 @@ nfsd(struct svc_rqst *rqstp)
         * dirty pages.
         */
        current->flags |= PF_LESS_THROTTLE;
+       set_freezable();
 
        /*
         * The main request loop
@@ -490,8 +490,17 @@ out:
        module_put_and_exit(0);
 }
 
+static __be32 map_new_errors(u32 vers, __be32 nfserr)
+{
+       if (nfserr == nfserr_jukebox && vers == 2)
+               return nfserr_dropit;
+       if (nfserr == nfserr_wrongsec && vers < 4)
+               return nfserr_acces;
+       return nfserr;
+}
+
 int
-nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
+nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 {
        struct svc_procedure    *proc;
        kxdrproc_t              xdr;
@@ -532,10 +541,9 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
 
        /* Now call the procedure handler, and encode NFS status. */
        nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
-       if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2)
-               nfserr = nfserr_dropit;
+       nfserr = map_new_errors(rqstp->rq_vers, nfserr);
        if (nfserr == nfserr_dropit) {
-               dprintk("nfsd: Dropping request due to malloc failure!\n");
+               dprintk("nfsd: Dropping request; may be revisited later\n");
                nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
                return 0;
        }