]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Fix fix of show_nfs_errors
authorTrond Myklebust <trondmy@gmail.com>
Mon, 6 Jan 2020 20:25:06 +0000 (15:25 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 15 Jan 2020 15:54:32 +0000 (10:54 -0500)
Casting a negative value to an unsigned long is not the same as
converting it to its absolute value.

Fixes: 591e92a35e9b ("NFS: Fix show_nfs_errors macros again")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4trace.h

index 497740f89f00373ec7c7991448319e5503d0e0c4..99d3c705c00da6e61b7c0a3e78ca6b2e794b9ffd 100644 (file)
@@ -352,7 +352,7 @@ DECLARE_EVENT_CLASS(nfs4_clientid_event,
                ),
 
                TP_fast_assign(
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __assign_str(dstaddr, clp->cl_hostname);
                ),
 
@@ -432,7 +432,8 @@ TRACE_EVENT(nfs4_sequence_done,
                        __entry->target_highest_slotid =
                                        res->sr_target_highest_slotid;
                        __entry->status_flags = res->sr_status_flags;
-                       __entry->error = res->sr_status;
+                       __entry->error = res->sr_status < 0 ?
+                                       -res->sr_status : 0;
                ),
                TP_printk(
                        "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
@@ -640,7 +641,7 @@ TRACE_EVENT(nfs4_state_mgr_failed,
                ),
 
                TP_fast_assign(
-                       __entry->error = status;
+                       __entry->error = status < 0 ? -status : 0;
                        __entry->state = clp->cl_state;
                        __assign_str(hostname, clp->cl_hostname);
                        __assign_str(section, section);
@@ -659,7 +660,7 @@ TRACE_EVENT(nfs4_xdr_status,
                TP_PROTO(
                        const struct xdr_stream *xdr,
                        u32 op,
-                       int error
+                       u32 error
                ),
 
                TP_ARGS(xdr, op, error),
@@ -884,7 +885,7 @@ TRACE_EVENT(nfs4_close,
                        __entry->fileid = NFS_FILEID(inode);
                        __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
                        __entry->fmode = (__force unsigned int)state->state;
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->stateid_seq =
                                be32_to_cpu(args->stateid.seqid);
                        __entry->stateid_hash =
@@ -949,7 +950,7 @@ DECLARE_EVENT_CLASS(nfs4_lock_event,
                TP_fast_assign(
                        const struct inode *inode = state->inode;
 
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->cmd = cmd;
                        __entry->type = request->fl_type;
                        __entry->start = request->fl_start;
@@ -1021,7 +1022,7 @@ TRACE_EVENT(nfs4_set_lock,
                TP_fast_assign(
                        const struct inode *inode = state->inode;
 
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->cmd = cmd;
                        __entry->type = request->fl_type;
                        __entry->start = request->fl_start;
@@ -1199,7 +1200,7 @@ TRACE_EVENT(nfs4_delegreturn_exit,
                TP_fast_assign(
                        __entry->dev = res->server->s_dev;
                        __entry->fhandle = nfs_fhandle_hash(args->fhandle);
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->stateid_seq =
                                be32_to_cpu(args->stateid->seqid);
                        __entry->stateid_hash =
@@ -1239,7 +1240,7 @@ DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
                TP_fast_assign(
                        const struct inode *inode = state->inode;
 
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->dev = inode->i_sb->s_dev;
                        __entry->fileid = NFS_FILEID(inode);
                        __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
@@ -1341,7 +1342,7 @@ TRACE_EVENT(nfs4_lookupp,
                TP_fast_assign(
                        __entry->dev = inode->i_sb->s_dev;
                        __entry->ino = NFS_FILEID(inode);
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                ),
 
                TP_printk(
@@ -1377,7 +1378,7 @@ TRACE_EVENT(nfs4_rename,
                        __entry->dev = olddir->i_sb->s_dev;
                        __entry->olddir = NFS_FILEID(olddir);
                        __entry->newdir = NFS_FILEID(newdir);
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __assign_str(oldname, oldname->name);
                        __assign_str(newname, newname->name);
                ),
@@ -1468,7 +1469,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
                        __entry->dev = inode->i_sb->s_dev;
                        __entry->fileid = NFS_FILEID(inode);
                        __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->stateid_seq =
                                be32_to_cpu(stateid->seqid);
                        __entry->stateid_hash =
@@ -1524,7 +1525,7 @@ DECLARE_EVENT_CLASS(nfs4_getattr_event,
                        __entry->valid = fattr->valid;
                        __entry->fhandle = nfs_fhandle_hash(fhandle);
                        __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                ),
 
                TP_printk(
@@ -1571,7 +1572,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
                ),
 
                TP_fast_assign(
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->fhandle = nfs_fhandle_hash(fhandle);
                        if (!IS_ERR_OR_NULL(inode)) {
                                __entry->fileid = NFS_FILEID(inode);
@@ -1628,7 +1629,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
                ),
 
                TP_fast_assign(
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->fhandle = nfs_fhandle_hash(fhandle);
                        if (!IS_ERR_OR_NULL(inode)) {
                                __entry->fileid = NFS_FILEID(inode);
@@ -1947,7 +1948,7 @@ TRACE_EVENT(nfs4_layoutget,
                        __entry->iomode = args->iomode;
                        __entry->offset = args->offset;
                        __entry->count = args->length;
-                       __entry->error = error;
+                       __entry->error = error < 0 ? -error : 0;
                        __entry->stateid_seq =
                                be32_to_cpu(state->stateid.seqid);
                        __entry->stateid_hash =