nfsd4: remove unnecessary lease-setting function
[safe/jmp/linux-2.6] / fs / nfsd / nfsctl.c
index e4f49fd..6738e9d 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * linux/fs/nfsd/nfsctl.c
- *
  * Syscall interface to knfsd.
  *
  * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
 
 #include <linux/nfsd_idmap.h>
 #include <linux/sunrpc/svcsock.h>
-#include <linux/nfsd/nfsd.h>
-#include <linux/nfsd/cache.h>
 #include <linux/nfsd/syscall.h>
 #include <linux/lockd/lockd.h>
 #include <linux/sunrpc/clnt.h>
 
+#include "nfsd.h"
+#include "cache.h"
+
 /*
  *     We have a single directory with 9 nodes in it.
  */
@@ -30,6 +29,7 @@ enum {
        NFSD_Getfd,
        NFSD_Getfs,
        NFSD_List,
+       NFSD_Export_features,
        NFSD_Fh,
        NFSD_FO_UnlockIP,
        NFSD_FO_UnlockFS,
@@ -148,6 +148,24 @@ static const struct file_operations exports_operations = {
        .owner          = THIS_MODULE,
 };
 
+static int export_features_show(struct seq_file *m, void *v)
+{
+       seq_printf(m, "0x%x 0x%x\n", NFSEXP_ALLFLAGS, NFSEXP_SECINFO_FLAGS);
+       return 0;
+}
+
+static int export_features_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, export_features_show, NULL);
+}
+
+static struct file_operations export_features_operations = {
+       .open           = export_features_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
 extern int nfsd_pool_stats_open(struct inode *inode, struct file *file);
 extern int nfsd_pool_stats_release(struct inode *inode, struct file *file);
 
@@ -970,6 +988,7 @@ static ssize_t __write_ports_delfd(char *buf)
 static ssize_t __write_ports_addxprt(char *buf)
 {
        char transport[16];
+       struct svc_xprt *xprt;
        int port, err;
 
        if (sscanf(buf, "%15s %4u", transport, &port) != 2)
@@ -984,13 +1003,24 @@ static ssize_t __write_ports_addxprt(char *buf)
 
        err = svc_create_xprt(nfsd_serv, transport,
                                PF_INET, port, SVC_SOCK_ANONYMOUS);
-       if (err < 0) {
-               /* Give a reasonable perror msg for bad transport string */
-               if (err == -ENOENT)
-                       err = -EPROTONOSUPPORT;
-               return err;
-       }
+       if (err < 0)
+               goto out_err;
+
+       err = svc_create_xprt(nfsd_serv, transport,
+                               PF_INET6, port, SVC_SOCK_ANONYMOUS);
+       if (err < 0 && err != -EAFNOSUPPORT)
+               goto out_close;
        return 0;
+out_close:
+       xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
+       if (xprt != NULL) {
+               svc_close_xprt(xprt);
+               svc_xprt_put(xprt);
+       }
+out_err:
+       /* Decrease the count, but don't shut down the service */
+       nfsd_serv->sv_nrthreads--;
+       return err;
 }
 
 /*
@@ -1173,8 +1203,6 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
 }
 
 #ifdef CONFIG_NFSD_V4
-extern time_t nfs4_leasetime(void);
-
 static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
 {
        /* if size > 10 seconds, call
@@ -1191,11 +1219,10 @@ static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
                        return rv;
                if (lease < 10 || lease > 3600)
                        return -EINVAL;
-               nfs4_reset_lease(lease);
+               nfsd4_lease = lease;
        }
 
-       return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n",
-                                                       nfs4_lease_time());
+       return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", nfsd4_lease);
 }
 
 /**
@@ -1305,6 +1332,8 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
                [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
                [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
                [NFSD_List] = {"exports", &exports_operations, S_IRUGO},
+               [NFSD_Export_features] = {"export_features",
+                                       &export_features_operations, S_IRUGO},
                [NFSD_FO_UnlockIP] = {"unlock_ip",
                                        &transaction_ops, S_IWUSR|S_IRUSR},
                [NFSD_FO_UnlockFS] = {"unlock_filesystem",