Merge tag 'perf-tools-2020-12-24' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / fs / nfsd / nfssvc.c
index 27b1ad1..00384c3 100644 (file)
@@ -29,6 +29,8 @@
 #include "netns.h"
 #include "filecache.h"
 
+#include "trace.h"
+
 #define NFSDDBG_FACILITY       NFSDDBG_SVC
 
 bool inter_copy_offload_enable;
@@ -527,8 +529,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
                return;
 
        nfsd_shutdown_net(net);
-       printk(KERN_WARNING "nfsd: last server has exited, flushing export "
-                           "cache\n");
+       pr_info("nfsd: last server has exited, flushing export cache\n");
        nfsd_export_flush(net);
 }
 
@@ -1009,17 +1010,16 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
        struct kvec *resv = &rqstp->rq_res.head[0];
        __be32 *p;
 
-       dprintk("nfsd_dispatch: vers %d proc %d\n",
-                               rqstp->rq_vers, rqstp->rq_proc);
-
        if (nfs_request_too_big(rqstp, proc))
-               goto out_too_large;
+               goto out_decode_err;
 
        /*
         * Give the xdr decoder a chance to change this if it wants
         * (necessary in the NFSv4.0 compound case)
         */
        rqstp->rq_cachetype = proc->pc_cachetype;
+
+       svcxdr_init_decode(rqstp);
        if (!proc->pc_decode(rqstp, argv->iov_base))
                goto out_decode_err;
 
@@ -1050,29 +1050,51 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 out_cached_reply:
        return 1;
 
-out_too_large:
-       dprintk("nfsd: NFSv%d argument too large\n", rqstp->rq_vers);
-       *statp = rpc_garbage_args;
-       return 1;
-
 out_decode_err:
-       dprintk("nfsd: failed to decode arguments!\n");
+       trace_nfsd_garbage_args_err(rqstp);
        *statp = rpc_garbage_args;
        return 1;
 
 out_update_drop:
-       dprintk("nfsd: Dropping request; may be revisited later\n");
        nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
 out_dropit:
        return 0;
 
 out_encode_err:
-       dprintk("nfsd: failed to encode result!\n");
+       trace_nfsd_cant_encode_err(rqstp);
        nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
        *statp = rpc_system_err;
        return 1;
 }
 
+/**
+ * nfssvc_decode_voidarg - Decode void arguments
+ * @rqstp: Server RPC transaction context
+ * @p: buffer containing arguments to decode
+ *
+ * Return values:
+ *   %0: Arguments were not valid
+ *   %1: Decoding was successful
+ */
+int nfssvc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p)
+{
+       return 1;
+}
+
+/**
+ * nfssvc_encode_voidres - Encode void results
+ * @rqstp: Server RPC transaction context
+ * @p: buffer in which to encode results
+ *
+ * Return values:
+ *   %0: Local error while encoding
+ *   %1: Encoding was successful
+ */
+int nfssvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
+{
+        return xdr_ressize_check(rqstp, p);
+}
+
 int nfsd_pool_stats_open(struct inode *inode, struct file *file)
 {
        int ret;