summaryrefslogtreecommitdiff
path: root/fs/nfs/nfs2xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2019-02-11 19:24:26 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-02-13 20:03:21 +0300
commitf23f658404229278af49284871518174ebbe3580 (patch)
treeaafee5858f6d88e31ef650bfbce2defb099dd7e2 /fs/nfs/nfs2xdr.c
parenteb72f484a5eb94c53a241e6a7811270fb25200ad (diff)
downloadlinux-f23f658404229278af49284871518174ebbe3580.tar.xz
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/nfs2xdr.c')
-rw-r--r--fs/nfs/nfs2xdr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 76614311f957..bac3a4e2cb5d 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -22,6 +22,7 @@
#include <linux/nfs.h>
#include <linux/nfs2.h>
#include <linux/nfs_fs.h>
+#include "nfstrace.h"
#include "internal.h"
#define NFSDBG_FACILITY NFSDBG_XDR
@@ -145,7 +146,13 @@ static int decode_stat(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(NFS_OK)))
+ goto out_status;
+ *status = 0;
+ return 0;
+out_status:
*status = be32_to_cpup(p);
+ trace_nfs_xdr_status((int)*status);
return 0;
}