aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2019-02-11 11:24:26 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-02-13 12:03:21 -0500
commitf23f658404229278af49284871518174ebbe3580 (patch)
treeaafee5858f6d88e31ef650bfbce2defb099dd7e2 /fs/nfs/nfs3xdr.c
parentNFS: Remove print_overflow_msg() (diff)
downloadlinux-dev-f23f658404229278af49284871518174ebbe3580.tar.xz
linux-dev-f23f658404229278af49284871518174ebbe3580.zip
NFS: Add trace events to report non-zero NFS status codes
These can help field troubleshooting without needing the overhead of a full network capture (ie, tcpdump). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r--fs/nfs/nfs3xdr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index e5619803a4f6..4aa3ffe1800e 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -21,6 +21,7 @@
#include <linux/nfs3.h>
#include <linux/nfs_fs.h>
#include <linux/nfsacl.h>
+#include "nfstrace.h"
#include "internal.h"
#define NFSDBG_FACILITY NFSDBG_XDR
@@ -337,7 +338,13 @@ static int decode_nfsstat3(struct xdr_stream *xdr, enum nfs_stat *status)
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
return -EIO;
+ if (unlikely(*p != cpu_to_be32(NFS3_OK)))
+ goto out_status;
+ *status = 0;
+ return 0;
+out_status:
*status = be32_to_cpup(p);
+ trace_nfs_xdr_status((int)*status);
return 0;
}