All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] NFS: Report the stateid + status in trace_nfs4_layoutreturn_on_close()
@ 2020-08-05 16:14 trondmy
  2020-08-05 16:14 ` [PATCH 2/3] NFS: Add tracepoints for layouterror and layoutstats trondmy
  0 siblings, 1 reply; 4+ messages in thread
From: trondmy @ 2020-08-05 16:14 UTC (permalink / raw)
  To: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

Ensure we correctly report the stateid and status in the layoutreturn on
close tracepoint.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4trace.h | 2 +-
 fs/nfs/pnfs.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 543541173a3d..07ea8d847710 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -1993,7 +1993,7 @@ TRACE_EVENT(nfs4_layoutget,
 
 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
-DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
+DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
 
 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index dd2e14f5875d..d8cdb94c6668 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1549,12 +1549,12 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
 	default:
 		arg_stateid = &args->stateid;
 	}
+	trace_nfs4_layoutreturn_on_close(args->inode, &args->stateid, ret);
 	pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range,
 			res_stateid);
 	if (ld_private && ld_private->ops && ld_private->ops->free)
 		ld_private->ops->free(ld_private);
 	pnfs_put_layout_hdr(lo);
-	trace_nfs4_layoutreturn_on_close(args->inode, 0);
 }
 
 bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] NFS: Add tracepoints for layouterror and layoutstats.
  2020-08-05 16:14 [PATCH 1/3] NFS: Report the stateid + status in trace_nfs4_layoutreturn_on_close() trondmy
@ 2020-08-05 16:14 ` trondmy
  2020-08-05 16:14   ` [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints trondmy
  0 siblings, 1 reply; 4+ messages in thread
From: trondmy @ 2020-08-05 16:14 UTC (permalink / raw)
  To: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

Allow tracing of the NFSv4.2 layouterror and layoutstats operations.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs42proc.c | 10 ++++++++--
 fs/nfs/nfs4trace.h |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index e200522469af..142225f0af59 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -17,6 +17,7 @@
 #include "nfs4session.h"
 #include "internal.h"
 #include "delegation.h"
+#include "nfs4trace.h"
 
 #define NFSDBG_FACILITY NFSDBG_PROC
 static int nfs42_do_offload_cancel_async(struct file *dst, nfs4_stateid *std);
@@ -714,7 +715,7 @@ nfs42_layoutstat_done(struct rpc_task *task, void *calldata)
 
 	switch (task->tk_status) {
 	case 0:
-		break;
+		return;
 	case -NFS4ERR_BADHANDLE:
 	case -ESTALE:
 		pnfs_destroy_layout(NFS_I(inode));
@@ -760,6 +761,8 @@ nfs42_layoutstat_done(struct rpc_task *task, void *calldata)
 	case -EOPNOTSUPP:
 		NFS_SERVER(inode)->caps &= ~NFS_CAP_LAYOUTSTATS;
 	}
+
+	trace_nfs4_layoutstats(inode, &data->args.stateid, task->tk_status);
 }
 
 static void
@@ -882,7 +885,7 @@ nfs42_layouterror_done(struct rpc_task *task, void *calldata)
 
 	switch (task->tk_status) {
 	case 0:
-		break;
+		return;
 	case -NFS4ERR_BADHANDLE:
 	case -ESTALE:
 		pnfs_destroy_layout(NFS_I(inode));
@@ -926,6 +929,9 @@ nfs42_layouterror_done(struct rpc_task *task, void *calldata)
 	case -EOPNOTSUPP:
 		NFS_SERVER(inode)->caps &= ~NFS_CAP_LAYOUTERROR;
 	}
+
+	trace_nfs4_layouterror(inode, &data->args.errors[0].stateid,
+			       task->tk_status);
 }
 
 static void
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 07ea8d847710..61c33536dcf3 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -1994,6 +1994,8 @@ TRACE_EVENT(nfs4_layoutget,
 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
+DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
+DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
 
 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints
  2020-08-05 16:14 ` [PATCH 2/3] NFS: Add tracepoints for layouterror and layoutstats trondmy
@ 2020-08-05 16:14   ` trondmy
  2020-08-06 20:09     ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: trondmy @ 2020-08-05 16:14 UTC (permalink / raw)
  To: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

Allow the pnfs I/O tracepoints to trace which layout segment is being
used.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4trace.h | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 61c33536dcf3..072a35adb0e3 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -1745,6 +1745,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 			__field(unsigned long, error)
 			__field(int, stateid_seq)
 			__field(u32, stateid_hash)
+			__field(int, layoutstateid_seq)
+			__field(u32, layoutstateid_hash)
 		),
 
 		TP_fast_assign(
@@ -1754,6 +1756,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 						  hdr->args.fh : &nfsi->fh;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
+			const struct pnfs_layout_segment *lseg = hdr->lseg;
+			const struct pnfs_layout_hdr *lo = lseg->pls_layout;
 
 			__entry->dev = inode->i_sb->s_dev;
 			__entry->fileid = nfsi->fileid;
@@ -1766,11 +1770,15 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 				be32_to_cpu(state->stateid.seqid);
 			__entry->stateid_hash =
 				nfs_stateid_hash(&state->stateid);
+			__entry->layoutstateid_seq = lseg->pls_seq;
+			__entry->layoutstateid_hash =
+				nfs_stateid_hash(&lo->plh_stateid);
 		),
 
 		TP_printk(
 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
-			"offset=%lld count=%u res=%u stateid=%d:0x%08x",
+			"offset=%lld count=%u res=%u stateid=%d:0x%08x "
+			"layoutstateid=%d:0x%08x",
 			-__entry->error,
 			show_nfsv4_errors(__entry->error),
 			MAJOR(__entry->dev), MINOR(__entry->dev),
@@ -1778,7 +1786,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 			__entry->fhandle,
 			(long long)__entry->offset,
 			__entry->arg_count, __entry->res_count,
-			__entry->stateid_seq, __entry->stateid_hash
+			__entry->stateid_seq, __entry->stateid_hash,
+			__entry->layoutstateid_seq, __entry->layoutstateid_hash
 		)
 );
 #define DEFINE_NFS4_READ_EVENT(name) \
@@ -1811,6 +1820,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 			__field(unsigned long, error)
 			__field(int, stateid_seq)
 			__field(u32, stateid_hash)
+			__field(int, layoutstateid_seq)
+			__field(u32, layoutstateid_hash)
 		),
 
 		TP_fast_assign(
@@ -1820,6 +1831,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 						  hdr->args.fh : &nfsi->fh;
 			const struct nfs4_state *state =
 				hdr->args.context->state;
+			const struct pnfs_layout_segment *lseg = hdr->lseg;
+			const struct pnfs_layout_hdr *lo = lseg->pls_layout;
 
 			__entry->dev = inode->i_sb->s_dev;
 			__entry->fileid = nfsi->fileid;
@@ -1832,11 +1845,15 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 				be32_to_cpu(state->stateid.seqid);
 			__entry->stateid_hash =
 				nfs_stateid_hash(&state->stateid);
+			__entry->layoutstateid_seq = lseg->pls_seq;
+			__entry->layoutstateid_hash =
+				nfs_stateid_hash(&lo->plh_stateid);
 		),
 
 		TP_printk(
 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
-			"offset=%lld count=%u res=%u stateid=%d:0x%08x",
+			"offset=%lld count=%u res=%u stateid=%d:0x%08x "
+			"layoutstateid=%d:0x%08x",
 			-__entry->error,
 			show_nfsv4_errors(__entry->error),
 			MAJOR(__entry->dev), MINOR(__entry->dev),
@@ -1844,7 +1861,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 			__entry->fhandle,
 			(long long)__entry->offset,
 			__entry->arg_count, __entry->res_count,
-			__entry->stateid_seq, __entry->stateid_hash
+			__entry->stateid_seq, __entry->stateid_hash,
+			__entry->layoutstateid_seq, __entry->layoutstateid_hash
 		)
 );
 
@@ -1875,6 +1893,8 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 			__field(unsigned long, error)
 			__field(loff_t, offset)
 			__field(u32, count)
+			__field(int, layoutstateid_seq)
+			__field(u32, layoutstateid_hash)
 		),
 
 		TP_fast_assign(
@@ -1882,6 +1902,9 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 			const struct nfs_inode *nfsi = NFS_I(inode);
 			const struct nfs_fh *fh = data->args.fh ?
 						  data->args.fh : &nfsi->fh;
+			const struct pnfs_layout_segment *lseg = data->lseg;
+			const struct pnfs_layout_hdr *lo = lseg ?
+						  lseg->pls_layout : NULL;
 
 			__entry->dev = inode->i_sb->s_dev;
 			__entry->fileid = nfsi->fileid;
@@ -1889,18 +1912,22 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 			__entry->offset = data->args.offset;
 			__entry->count = data->args.count;
 			__entry->error = error < 0 ? -error : 0;
+			__entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
+			__entry->layoutstateid_hash = lo ?
+					nfs_stateid_hash(&lo->plh_stateid) : 0;
 		),
 
 		TP_printk(
 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
-			"offset=%lld count=%u",
+			"offset=%lld count=%u layoutstateid=%d:0x%08x",
 			-__entry->error,
 			show_nfsv4_errors(__entry->error),
 			MAJOR(__entry->dev), MINOR(__entry->dev),
 			(unsigned long long)__entry->fileid,
 			__entry->fhandle,
 			(long long)__entry->offset,
-			__entry->count
+			__entry->count,
+			__entry->layoutstateid_seq, __entry->layoutstateid_hash
 		)
 );
 #define DEFINE_NFS4_COMMIT_EVENT(name) \
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints
  2020-08-05 16:14   ` [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints trondmy
@ 2020-08-06 20:09     ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-08-06 20:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4832 bytes --]

Hi,

I love your patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on v5.8 next-20200806]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/trondmy-kernel-org/NFS-Report-the-stateid-status-in-trace_nfs4_layoutreturn_on_close/20200806-040955
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: microblaze-randconfig-r033-20200805 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:102,
                    from fs/nfs/nfs4trace.h:2305,
                    from fs/nfs/nfs4trace.c:13:
   fs/nfs/./nfs4trace.h: In function 'trace_event_raw_event_nfs4_read_event':
>> fs/nfs/./nfs4trace.h:1775:25: error: dereferencing pointer to incomplete type 'const struct pnfs_layout_hdr'
    1775 |     nfs_stateid_hash(&lo->plh_stateid);
         |                         ^~
   include/trace/trace_events.h:707:4: note: in definition of macro 'DECLARE_EVENT_CLASS'
     707 |  { assign; }       \
         |    ^~~~~~
   fs/nfs/./nfs4trace.h:1752:3: note: in expansion of macro 'TP_fast_assign'
    1752 |   TP_fast_assign(
         |   ^~~~~~~~~~~~~~

vim +1775 fs/nfs/./nfs4trace.h

  1729	
  1730	DECLARE_EVENT_CLASS(nfs4_read_event,
  1731			TP_PROTO(
  1732				const struct nfs_pgio_header *hdr,
  1733				int error
  1734			),
  1735	
  1736			TP_ARGS(hdr, error),
  1737	
  1738			TP_STRUCT__entry(
  1739				__field(dev_t, dev)
  1740				__field(u32, fhandle)
  1741				__field(u64, fileid)
  1742				__field(loff_t, offset)
  1743				__field(u32, arg_count)
  1744				__field(u32, res_count)
  1745				__field(unsigned long, error)
  1746				__field(int, stateid_seq)
  1747				__field(u32, stateid_hash)
  1748				__field(int, layoutstateid_seq)
  1749				__field(u32, layoutstateid_hash)
  1750			),
  1751	
  1752			TP_fast_assign(
  1753				const struct inode *inode = hdr->inode;
  1754				const struct nfs_inode *nfsi = NFS_I(inode);
  1755				const struct nfs_fh *fh = hdr->args.fh ?
  1756							  hdr->args.fh : &nfsi->fh;
  1757				const struct nfs4_state *state =
  1758					hdr->args.context->state;
  1759				const struct pnfs_layout_segment *lseg = hdr->lseg;
  1760				const struct pnfs_layout_hdr *lo = lseg->pls_layout;
  1761	
  1762				__entry->dev = inode->i_sb->s_dev;
  1763				__entry->fileid = nfsi->fileid;
  1764				__entry->fhandle = nfs_fhandle_hash(fh);
  1765				__entry->offset = hdr->args.offset;
  1766				__entry->arg_count = hdr->args.count;
  1767				__entry->res_count = hdr->res.count;
  1768				__entry->error = error < 0 ? -error : 0;
  1769				__entry->stateid_seq =
  1770					be32_to_cpu(state->stateid.seqid);
  1771				__entry->stateid_hash =
  1772					nfs_stateid_hash(&state->stateid);
  1773				__entry->layoutstateid_seq = lseg->pls_seq;
  1774				__entry->layoutstateid_hash =
> 1775					nfs_stateid_hash(&lo->plh_stateid);
  1776			),
  1777	
  1778			TP_printk(
  1779				"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  1780				"offset=%lld count=%u res=%u stateid=%d:0x%08x "
  1781				"layoutstateid=%d:0x%08x",
  1782				-__entry->error,
  1783				show_nfsv4_errors(__entry->error),
  1784				MAJOR(__entry->dev), MINOR(__entry->dev),
  1785				(unsigned long long)__entry->fileid,
  1786				__entry->fhandle,
  1787				(long long)__entry->offset,
  1788				__entry->arg_count, __entry->res_count,
  1789				__entry->stateid_seq, __entry->stateid_hash,
  1790				__entry->layoutstateid_seq, __entry->layoutstateid_hash
  1791			)
  1792	);
  1793	#define DEFINE_NFS4_READ_EVENT(name) \
  1794		DEFINE_EVENT(nfs4_read_event, name, \
  1795				TP_PROTO( \
  1796					const struct nfs_pgio_header *hdr, \
  1797					int error \
  1798				), \
  1799				TP_ARGS(hdr, error))
  1800	DEFINE_NFS4_READ_EVENT(nfs4_read);
  1801	#ifdef CONFIG_NFS_V4_1
  1802	DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
  1803	#endif /* CONFIG_NFS_V4_1 */
  1804	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25872 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-06 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 16:14 [PATCH 1/3] NFS: Report the stateid + status in trace_nfs4_layoutreturn_on_close() trondmy
2020-08-05 16:14 ` [PATCH 2/3] NFS: Add tracepoints for layouterror and layoutstats trondmy
2020-08-05 16:14   ` [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints trondmy
2020-08-06 20:09     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.