linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths
@ 2025-08-08 11:40 Jeff Layton
  2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

This is a pile of tracepoint additions and cleanups. Most of these I
plumbed in while tracking down the recent client-side corruption I've
been hunting. Please consider for v6.18.

Thanks,

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Jeff Layton (5):
      nfs: remove trailing space from tracepoint
      nfs: add tracepoints to nfs_file_read() and nfs_file_write()
      nfs: new tracepoints around write handling
      nfs: more in-depth tracing of writepage events
      nfs: add tracepoints to nfs_writepages()

 fs/nfs/file.c     |  20 ++++++--
 fs/nfs/nfstrace.h | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 fs/nfs/write.c    |  22 +++++++--
 3 files changed, 168 insertions(+), 9 deletions(-)
---
base-commit: 0919a5b3b11c699d23bc528df5709f2e3213f6a9
change-id: 20250807-nfs-tracepoints-f1d84186564d

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


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

* [PATCH 1/5] nfs: remove trailing space from tracepoint
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
@ 2025-08-08 11:40 ` Jeff Layton
  2025-08-11 12:32   ` Jeff Layton
  2025-08-08 11:40 ` [PATCH 2/5] nfs: add tracepoints to nfs_file_read() and nfs_file_write() Jeff Layton
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

Cleanup for a minor annoyance.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfs/nfstrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 7a058bd8c566e2976e24136e2901fbaa7070daac..9ebfb220e94a5389e633210519a9a1f21a052d76 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event,
 		),
 
 		TP_printk(
-			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
+			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu",
 			MAJOR(__entry->dev), MINOR(__entry->dev),
 			(unsigned long long)__entry->fileid,
 			__entry->fhandle,

-- 
2.50.1


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

* [PATCH 2/5] nfs: add tracepoints to nfs_file_read() and nfs_file_write()
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
  2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
@ 2025-08-08 11:40 ` Jeff Layton
  2025-08-08 11:40 ` [PATCH 3/5] nfs: new tracepoints around write handling Jeff Layton
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

Add some tracepoints to the I/O submission codepaths.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfs/file.c     |  4 ++++
 fs/nfs/nfstrace.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 86e36c630f09eac84f42bbee18dcace415d680ca..1e89801abed626ea64cd79722fad8720b2485d32 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -160,6 +160,8 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to)
 	struct inode *inode = file_inode(iocb->ki_filp);
 	ssize_t result;
 
+	trace_nfs_file_read(iocb, to);
+
 	if (iocb->ki_flags & IOCB_DIRECT)
 		return nfs_file_direct_read(iocb, to, false);
 
@@ -656,6 +658,8 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
 	errseq_t since;
 	int error;
 
+	trace_nfs_file_write(iocb, from);
+
 	result = nfs_key_timeout_notify(file, inode);
 	if (result)
 		return result;
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 9ebfb220e94a5389e633210519a9a1f21a052d76..d7d25cdf0060b3fa7c5889752a1bd193d0e8ca92 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1045,6 +1045,58 @@ DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
 DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
 
+DECLARE_EVENT_CLASS(nfs_kiocb_event,
+		TP_PROTO(
+			const struct kiocb *iocb,
+			const struct iov_iter *iter
+		),
+
+		TP_ARGS(iocb, iter),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(u64, version)
+			__field(loff_t, offset)
+			__field(size_t, count)
+			__field(int, flags)
+		),
+
+		TP_fast_assign(
+			const struct inode *inode = file_inode(iocb->ki_filp);
+			const struct nfs_inode *nfsi = NFS_I(inode);
+
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = nfsi->fileid;
+			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
+			__entry->version = inode_peek_iversion_raw(inode);
+			__entry->offset = iocb->ki_pos;
+			__entry->count = iov_iter_count(iter);
+			__entry->flags = iocb->ki_flags;
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld count=%zu ki_flags=%s",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle, __entry->version,
+			__entry->offset, __entry->count,
+			__print_flags(__entry->flags, "|", TRACE_IOCB_STRINGS)
+		)
+);
+
+#define DEFINE_NFS_KIOCB_EVENT(name) \
+	DEFINE_EVENT(nfs_kiocb_event, name, \
+			TP_PROTO( \
+				const struct kiocb *iocb, \
+				const struct iov_iter *iter \
+			), \
+			TP_ARGS(iocb, iter))
+
+DEFINE_NFS_KIOCB_EVENT(nfs_file_read);
+DEFINE_NFS_KIOCB_EVENT(nfs_file_write);
+
 TRACE_EVENT(nfs_aop_readahead,
 		TP_PROTO(
 			const struct inode *inode,

-- 
2.50.1


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

* [PATCH 3/5] nfs: new tracepoints around write handling
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
  2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
  2025-08-08 11:40 ` [PATCH 2/5] nfs: add tracepoints to nfs_file_read() and nfs_file_write() Jeff Layton
@ 2025-08-08 11:40 ` Jeff Layton
  2025-08-08 11:40 ` [PATCH 4/5] nfs: more in-depth tracing of writepage events Jeff Layton
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

New start and done tracepoints for:

nfs_update_folio()
nfs_write_begin()
nfs_write_end()
nfs_try_to_update_request()

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfs/file.c     | 16 +++++++++++++---
 fs/nfs/nfstrace.h | 13 +++++++++++++
 fs/nfs/write.c    | 10 +++++++++-
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1e89801abed626ea64cd79722fad8720b2485d32..058cb545ab8a2974e08810c0309e5a2040f82cc2 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -356,6 +356,8 @@ static int nfs_write_begin(const struct kiocb *iocb,
 	int once_thru = 0;
 	int ret;
 
+	trace_nfs_write_begin(file_inode(file), pos, len);
+
 	dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n",
 		file, mapping->host->i_ino, len, (long long) pos);
 
@@ -363,8 +365,10 @@ static int nfs_write_begin(const struct kiocb *iocb,
 start:
 	folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp,
 				    mapping_gfp_mask(mapping));
-	if (IS_ERR(folio))
-		return PTR_ERR(folio);
+	if (IS_ERR(folio)) {
+		ret = PTR_ERR(folio);
+		goto out;
+	}
 	*foliop = folio;
 
 	ret = nfs_flush_incompatible(file, folio);
@@ -379,6 +383,8 @@ static int nfs_write_begin(const struct kiocb *iocb,
 		if (!ret)
 			goto start;
 	}
+out:
+	trace_nfs_write_begin_done(file_inode(file), pos, len, ret);
 	return ret;
 }
 
@@ -392,6 +398,7 @@ static int nfs_write_end(const struct kiocb *iocb,
 	unsigned offset = offset_in_folio(folio, pos);
 	int status;
 
+	trace_nfs_write_end(file_inode(file), pos, len);
 	dfprintk(PAGECACHE, "NFS: write_end(%pD2(%lu), %u@%lld)\n",
 		file, mapping->host->i_ino, len, (long long) pos);
 
@@ -420,13 +427,16 @@ static int nfs_write_end(const struct kiocb *iocb,
 	folio_unlock(folio);
 	folio_put(folio);
 
-	if (status < 0)
+	if (status < 0) {
+		trace_nfs_write_end_done(file_inode(file), pos, len, status);
 		return status;
+	}
 	NFS_I(mapping->host)->write_io += copied;
 
 	if (nfs_ctx_key_to_expire(ctx, mapping->host))
 		nfs_wb_all(mapping->host);
 
+	trace_nfs_write_end_done(file_inode(file), pos, len, copied);
 	return copied;
 }
 
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index d7d25cdf0060b3fa7c5889752a1bd193d0e8ca92..b90eed094e639a532463cb5a3f6ba32c64431a6a 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1045,6 +1045,19 @@ DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
 DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
 
+DEFINE_NFS_FOLIO_EVENT(nfs_try_to_update_request);
+DEFINE_NFS_FOLIO_EVENT_DONE(nfs_try_to_update_request_done);
+
+DEFINE_NFS_FOLIO_EVENT(nfs_update_folio);
+DEFINE_NFS_FOLIO_EVENT_DONE(nfs_update_folio_done);
+
+DEFINE_NFS_FOLIO_EVENT(nfs_write_begin);
+DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_begin_done);
+
+DEFINE_NFS_FOLIO_EVENT(nfs_write_end);
+DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_end_done);
+
+
 DECLARE_EVENT_CLASS(nfs_kiocb_event,
 		TP_PROTO(
 			const struct kiocb *iocb,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 374fc6b34c7954ef781026e5114cf5411f366ecd..60138026053b992434c6fadc7bc53ebb5d8e8545 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1068,11 +1068,12 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
 	unsigned int end;
 	int error;
 
+	trace_nfs_try_to_update_request(folio_inode(folio), offset, bytes);
 	end = offset + bytes;
 
 	req = nfs_lock_and_join_requests(folio);
 	if (IS_ERR_OR_NULL(req))
-		return req;
+		goto out;
 
 	rqend = req->wb_offset + req->wb_bytes;
 	/*
@@ -1094,6 +1095,9 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
 	else
 		req->wb_bytes = rqend - req->wb_offset;
 	req->wb_nio = 0;
+out:
+	trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes,
+					     PTR_ERR_OR_ZERO(req));
 	return req;
 out_flushme:
 	/*
@@ -1104,6 +1108,7 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
 	nfs_mark_request_dirty(req);
 	nfs_unlock_and_release_request(req);
 	error = nfs_wb_folio(folio->mapping->host, folio);
+	trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes, error);
 	return (error < 0) ? ERR_PTR(error) : NULL;
 }
 
@@ -1341,6 +1346,8 @@ int nfs_update_folio(struct file *file, struct folio *folio,
 
 	nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
 
+	trace_nfs_update_folio(inode, offset, count);
+
 	dprintk("NFS:       nfs_update_folio(%pD2 %d@%lld)\n", file, count,
 		(long long)(folio_pos(folio) + offset));
 
@@ -1360,6 +1367,7 @@ int nfs_update_folio(struct file *file, struct folio *folio,
 	if (status < 0)
 		nfs_set_pageerror(mapping);
 out:
+	trace_nfs_update_folio_done(inode, offset, count, status);
 	dprintk("NFS:       nfs_update_folio returns %d (isize %lld)\n",
 			status, (long long)i_size_read(inode));
 	return status;

-- 
2.50.1


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

* [PATCH 4/5] nfs: more in-depth tracing of writepage events
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
                   ` (2 preceding siblings ...)
  2025-08-08 11:40 ` [PATCH 3/5] nfs: new tracepoints around write handling Jeff Layton
@ 2025-08-08 11:40 ` Jeff Layton
  2025-08-08 11:40 ` [PATCH 5/5] nfs: add tracepoints to nfs_writepages() Jeff Layton
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

Add tracepoints to nfs_writepage_setup() and nfs_do_writepage().

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfs/nfstrace.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/write.c    |  2 ++
 2 files changed, 68 insertions(+)

diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index b90eed094e639a532463cb5a3f6ba32c64431a6a..63dec30226153a78dd9017fdb1104ba3301f7372 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -44,6 +44,23 @@
 			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
 			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
 
+#define nfs_show_wb_flags(v) \
+	__print_flags(v, "|", \
+			{ BIT(PG_BUSY), "BUSY" }, \
+			{ BIT(PG_MAPPED), "MAPPED" }, \
+			{ BIT(PG_FOLIO), "FOLIO" }, \
+			{ BIT(PG_CLEAN), "CLEAN" }, \
+			{ BIT(PG_COMMIT_TO_DS), "COMMIT_TO_DS" }, \
+			{ BIT(PG_INODE_REF), "INODE_REF" }, \
+			{ BIT(PG_HEADLOCK), "HEADLOCK" }, \
+			{ BIT(PG_TEARDOWN), "TEARDOWN" }, \
+			{ BIT(PG_UNLOCKPAGE), "UNLOCKPAGE" }, \
+			{ BIT(PG_UPTODATE), "UPTODATE" }, \
+			{ BIT(PG_WB_END), "WB_END" }, \
+			{ BIT(PG_REMOVE), "REMOVE" }, \
+			{ BIT(PG_CONTENDED1), "CONTENDED1" }, \
+			{ BIT(PG_CONTENDED2), "CONTENDED2" })
+
 DECLARE_EVENT_CLASS(nfs_inode_event,
 		TP_PROTO(
 			const struct inode *inode
@@ -1457,6 +1474,55 @@ TRACE_EVENT(nfs_writeback_done,
 		)
 );
 
+DECLARE_EVENT_CLASS(nfs_page_class,
+		TP_PROTO(
+			const struct nfs_page *req
+		),
+
+		TP_ARGS(req),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(const struct nfs_page *__private, req)
+			__field(loff_t, offset)
+			__field(unsigned int, count)
+			__field(unsigned long, flags)
+		),
+
+		TP_fast_assign(
+			const struct inode *inode = folio_inode(req->wb_folio);
+			const struct nfs_inode *nfsi = NFS_I(inode);
+
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = nfsi->fileid;
+			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
+			__entry->req = req;
+			__entry->offset = req_offset(req);
+			__entry->count = req->wb_bytes;
+			__entry->flags = req->wb_flags;
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu fhandle=0x%08x req=%p offset=%lld count=%u flags=%s",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid, __entry->fhandle,
+			__entry->req, __entry->offset, __entry->count,
+			nfs_show_wb_flags(__entry->flags)
+		)
+);
+
+#define DEFINE_NFS_PAGE_EVENT(name) \
+	DEFINE_EVENT(nfs_page_class, name, \
+			TP_PROTO( \
+				const struct nfs_page *req \
+			), \
+			TP_ARGS(req))
+
+DEFINE_NFS_PAGE_EVENT(nfs_writepage_setup);
+DEFINE_NFS_PAGE_EVENT(nfs_do_writepage);
+
 DECLARE_EVENT_CLASS(nfs_page_error_class,
 		TP_PROTO(
 			const struct inode *inode,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 60138026053b992434c6fadc7bc53ebb5d8e8545..b5632f18813bee4e6a45cae3651399c753631958 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -646,6 +646,7 @@ static int nfs_do_writepage(struct folio *folio, struct writeback_control *wbc,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
+	trace_nfs_do_writepage(req);
 	nfs_folio_set_writeback(folio);
 	WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
 
@@ -1146,6 +1147,7 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx,
 	req = nfs_setup_write_request(ctx, folio, offset, count);
 	if (IS_ERR(req))
 		return PTR_ERR(req);
+	trace_nfs_writepage_setup(req);
 	/* Update file length */
 	nfs_grow_file(folio, offset, count);
 	nfs_mark_uptodate(req);

-- 
2.50.1


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

* [PATCH 5/5] nfs: add tracepoints to nfs_writepages()
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
                   ` (3 preceding siblings ...)
  2025-08-08 11:40 ` [PATCH 4/5] nfs: more in-depth tracing of writepage events Jeff Layton
@ 2025-08-08 11:40 ` Jeff Layton
  2025-08-08 12:38 ` [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Benjamin Coddington
  2025-08-29 14:45 ` Jeff Layton
  6 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-08 11:40 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel, Jeff Layton

Show the inode info and requested range.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfs/nfstrace.h |  2 ++
 fs/nfs/write.c    | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 63dec30226153a78dd9017fdb1104ba3301f7372..dcf339adcf5cb40a71eea4c9b5d4a500eb0223bb 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1074,6 +1074,8 @@ DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_begin_done);
 DEFINE_NFS_FOLIO_EVENT(nfs_write_end);
 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_end_done);
 
+DEFINE_NFS_FOLIO_EVENT(nfs_writepages);
+DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writepages_done);
 
 DECLARE_EVENT_CLASS(nfs_kiocb_event,
 		TP_PROTO(
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b5632f18813bee4e6a45cae3651399c753631958..638c8334082086df2fe5ef143219ab2fe186ae1b 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -710,12 +710,14 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 	int priority = 0;
 	int err;
 
+	trace_nfs_writepages(inode, wbc->range_start, wbc->range_end - wbc->range_start);
+
 	/* Wait with writeback until write congestion eases */
 	if (wbc->sync_mode == WB_SYNC_NONE && nfss->write_congested) {
 		err = wait_event_killable(nfss->write_congestion_wait,
 					  nfss->write_congested == 0);
 		if (err)
-			return err;
+			goto out_err;
 	}
 
 	nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES);
@@ -746,10 +748,10 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 	} while (err < 0 && !nfs_error_is_fatal(err));
 	nfs_io_completion_put(ioc);
 
-	if (err < 0)
-		goto out_err;
-	return 0;
+	if (err > 0)
+		err = 0;
 out_err:
+	trace_nfs_writepages_done(inode, wbc->range_start, wbc->range_end - wbc->range_start, err);
 	return err;
 }
 

-- 
2.50.1


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

* Re: [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
                   ` (4 preceding siblings ...)
  2025-08-08 11:40 ` [PATCH 5/5] nfs: add tracepoints to nfs_writepages() Jeff Layton
@ 2025-08-08 12:38 ` Benjamin Coddington
  2025-08-29 14:45 ` Jeff Layton
  6 siblings, 0 replies; 10+ messages in thread
From: Benjamin Coddington @ 2025-08-08 12:38 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, linux-kernel

On 8 Aug 2025, at 7:40, Jeff Layton wrote:

> This is a pile of tracepoint additions and cleanups. Most of these I
> plumbed in while tracking down the recent client-side corruption I've
> been hunting. Please consider for v6.18.
>
> Thanks,
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Jeff Layton (5):
>       nfs: remove trailing space from tracepoint
>       nfs: add tracepoints to nfs_file_read() and nfs_file_write()
>       nfs: new tracepoints around write handling
>       nfs: more in-depth tracing of writepage events
>       nfs: add tracepoints to nfs_writepages()
>
>  fs/nfs/file.c     |  20 ++++++--
>  fs/nfs/nfstrace.h | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  fs/nfs/write.c    |  22 +++++++--
>  3 files changed, 168 insertions(+), 9 deletions(-)
> ---
> base-commit: 0919a5b3b11c699d23bc528df5709f2e3213f6a9
> change-id: 20250807-nfs-tracepoints-f1d84186564d
>
> Best regards,
> -- 
> Jeff Layton <jlayton@kernel.org>


These look great.

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Ben


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

* Re: [PATCH 1/5] nfs: remove trailing space from tracepoint
  2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
@ 2025-08-11 12:32   ` Jeff Layton
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Layton @ 2025-08-11 12:32 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, linux-kernel

On Fri, 2025-08-08 at 07:40 -0400, Jeff Layton wrote:
> Cleanup for a minor annoyance.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nfs/nfstrace.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
> index 7a058bd8c566e2976e24136e2901fbaa7070daac..9ebfb220e94a5389e633210519a9a1f21a052d76 100644
> --- a/fs/nfs/nfstrace.h
> +++ b/fs/nfs/nfstrace.h
> @@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event,
>  		),
>  
>  		TP_printk(
> -			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
> +			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu",
>  			MAJOR(__entry->dev), MINOR(__entry->dev),
>  			(unsigned long long)__entry->fileid,
>  			__entry->fhandle,

This patch conflicts with current Linus' master, and can be dropped.
The tracepoint was changed to add the cache_validity field which also
got rid of the trailing space.

Cheers,
-- 
Jeff Layton <jlayton@kernel.org>

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

* Re: [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths
  2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
                   ` (5 preceding siblings ...)
  2025-08-08 12:38 ` [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Benjamin Coddington
@ 2025-08-29 14:45 ` Jeff Layton
  2025-09-02 17:56   ` Anna Schumaker
  6 siblings, 1 reply; 10+ messages in thread
From: Jeff Layton @ 2025-08-29 14:45 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker
  Cc: linux-nfs, linux-kernel, Benjamin Coddington

On Fri, 2025-08-08 at 07:40 -0400, Jeff Layton wrote:
> This is a pile of tracepoint additions and cleanups. Most of these I
> plumbed in while tracking down the recent client-side corruption I've
> been hunting. Please consider for v6.18.
> 
> Thanks,
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Jeff Layton (5):
>       nfs: remove trailing space from tracepoint
>       nfs: add tracepoints to nfs_file_read() and nfs_file_write()
>       nfs: new tracepoints around write handling
>       nfs: more in-depth tracing of writepage events
>       nfs: add tracepoints to nfs_writepages()
> 
>  fs/nfs/file.c     |  20 ++++++--
>  fs/nfs/nfstrace.h | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  fs/nfs/write.c    |  22 +++++++--
>  3 files changed, 168 insertions(+), 9 deletions(-)
> ---
> base-commit: 0919a5b3b11c699d23bc528df5709f2e3213f6a9
> change-id: 20250807-nfs-tracepoints-f1d84186564d
> 
> Best regards,

Ping? I haven't seen a response, or these in linux-next yet. Can we get
them in soon so they can make v6.18?

They were pretty helpful for tracking down that pgio fix recently.

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>

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

* Re: [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths
  2025-08-29 14:45 ` Jeff Layton
@ 2025-09-02 17:56   ` Anna Schumaker
  0 siblings, 0 replies; 10+ messages in thread
From: Anna Schumaker @ 2025-09-02 17:56 UTC (permalink / raw)
  To: Jeff Layton, Trond Myklebust, Anna Schumaker
  Cc: linux-nfs, linux-kernel, Benjamin Coddington



On 8/29/25 10:45 AM, Jeff Layton wrote:
> On Fri, 2025-08-08 at 07:40 -0400, Jeff Layton wrote:
>> This is a pile of tracepoint additions and cleanups. Most of these I
>> plumbed in while tracking down the recent client-side corruption I've
>> been hunting. Please consider for v6.18.
>>
>> Thanks,
>>
>> Signed-off-by: Jeff Layton <jlayton@kernel.org>
>> ---
>> Jeff Layton (5):
>>       nfs: remove trailing space from tracepoint
>>       nfs: add tracepoints to nfs_file_read() and nfs_file_write()
>>       nfs: new tracepoints around write handling
>>       nfs: more in-depth tracing of writepage events
>>       nfs: add tracepoints to nfs_writepages()
>>
>>  fs/nfs/file.c     |  20 ++++++--
>>  fs/nfs/nfstrace.h | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>  fs/nfs/write.c    |  22 +++++++--
>>  3 files changed, 168 insertions(+), 9 deletions(-)
>> ---
>> base-commit: 0919a5b3b11c699d23bc528df5709f2e3213f6a9
>> change-id: 20250807-nfs-tracepoints-f1d84186564d
>>
>> Best regards,
> 
> Ping? I haven't seen a response, or these in linux-next yet. Can we get
> them in soon so they can make v6.18?

Hi Jeff,

They look good to me, and I'm planning on taking them for 6.18.

Anna

> 
> They were pretty helpful for tracking down that pgio fix recently.
> 
> Thanks,


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

end of thread, other threads:[~2025-09-02 17:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
2025-08-11 12:32   ` Jeff Layton
2025-08-08 11:40 ` [PATCH 2/5] nfs: add tracepoints to nfs_file_read() and nfs_file_write() Jeff Layton
2025-08-08 11:40 ` [PATCH 3/5] nfs: new tracepoints around write handling Jeff Layton
2025-08-08 11:40 ` [PATCH 4/5] nfs: more in-depth tracing of writepage events Jeff Layton
2025-08-08 11:40 ` [PATCH 5/5] nfs: add tracepoints to nfs_writepages() Jeff Layton
2025-08-08 12:38 ` [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Benjamin Coddington
2025-08-29 14:45 ` Jeff Layton
2025-09-02 17:56   ` Anna Schumaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).