]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/nfsd/nfssvc.c
Merge branch 'for-5.5/whiskers' into for-linus
[linux.git] / fs / nfsd / nfssvc.c
index 18d94ea984ba4add43d1af0ca90ed155fc67c700..fdf7ed4bd5dd22e6014c8bf6d15e8326808fe87d 100644 (file)
@@ -27,6 +27,7 @@
 #include "cache.h"
 #include "vfs.h"
 #include "netns.h"
+#include "filecache.h"
 
 #define NFSDDBG_FACILITY       NFSDDBG_SVC
 
@@ -313,22 +314,17 @@ static int nfsd_startup_generic(int nrservs)
        if (nfsd_users++)
                return 0;
 
-       /*
-        * Readahead param cache - will no-op if it already exists.
-        * (Note therefore results will be suboptimal if number of
-        * threads is modified after nfsd start.)
-        */
-       ret = nfsd_racache_init(2*nrservs);
+       ret = nfsd_file_cache_init();
        if (ret)
                goto dec_users;
 
        ret = nfs4_state_start();
        if (ret)
-               goto out_racache;
+               goto out_file_cache;
        return 0;
 
-out_racache:
-       nfsd_racache_shutdown();
+out_file_cache:
+       nfsd_file_cache_shutdown();
 dec_users:
        nfsd_users--;
        return ret;
@@ -340,7 +336,7 @@ static void nfsd_shutdown_generic(void)
                return;
 
        nfs4_state_shutdown();
-       nfsd_racache_shutdown();
+       nfsd_file_cache_shutdown();
 }
 
 static bool nfsd_needs_lockd(struct nfsd_net *nn)
@@ -348,6 +344,35 @@ static bool nfsd_needs_lockd(struct nfsd_net *nn)
        return nfsd_vers(nn, 2, NFSD_TEST) || nfsd_vers(nn, 3, NFSD_TEST);
 }
 
+void nfsd_copy_boot_verifier(__be32 verf[2], struct nfsd_net *nn)
+{
+       int seq = 0;
+
+       do {
+               read_seqbegin_or_lock(&nn->boot_lock, &seq);
+               /*
+                * This is opaque to client, so no need to byte-swap. Use
+                * __force to keep sparse happy. y2038 time_t overflow is
+                * irrelevant in this usage
+                */
+               verf[0] = (__force __be32)nn->nfssvc_boot.tv_sec;
+               verf[1] = (__force __be32)nn->nfssvc_boot.tv_nsec;
+       } while (need_seqretry(&nn->boot_lock, seq));
+       done_seqretry(&nn->boot_lock, seq);
+}
+
+static void nfsd_reset_boot_verifier_locked(struct nfsd_net *nn)
+{
+       ktime_get_real_ts64(&nn->nfssvc_boot);
+}
+
+void nfsd_reset_boot_verifier(struct nfsd_net *nn)
+{
+       write_seqlock(&nn->boot_lock);
+       nfsd_reset_boot_verifier_locked(nn);
+       write_sequnlock(&nn->boot_lock);
+}
+
 static int nfsd_startup_net(int nrservs, struct net *net, const struct cred *cred)
 {
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
@@ -391,6 +416,7 @@ static void nfsd_shutdown_net(struct net *net)
 {
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
+       nfsd_file_cache_purge(net);
        nfs4_state_shutdown_net(net);
        if (nn->lockd_up) {
                lockd_down(net);
@@ -599,7 +625,7 @@ int nfsd_create_serv(struct net *net)
 #endif
        }
        atomic_inc(&nn->ntf_refcnt);
-       ktime_get_real_ts64(&nn->nfssvc_boot); /* record boot time */
+       nfsd_reset_boot_verifier(nn);
        return 0;
 }