* [CIFS][PATCH] Add dynamic trace points for flush and fsync
@ 2020-02-06 0:29 Steve French
2020-02-06 18:17 ` Pavel Shilovsky
0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2020-02-06 0:29 UTC (permalink / raw)
To: CIFS; +Cc: Oleg Kravtsov
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
Makes it easier to debug errors on writeback that happen later,
and are being returned on flush or fsync
For example:
writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28
--
Thanks,
Steve
[-- Attachment #2: 0001-cifs-Add-tracepoints-for-errors-on-flush-or-fsync.patch --]
[-- Type: text/x-patch, Size: 2250 bytes --]
From f2bf09e97b47c7b13e8a918f560f6082e9bc8f8a Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Wed, 5 Feb 2020 18:22:37 -0600
Subject: [PATCH] cifs: Add tracepoints for errors on flush or fsync
Makes it easier to debug errors on writeback that happen later,
and are being returned on flush or fsync
For example:
writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28
Signed-off-by: Steve French <stfrench@microsoft.com>
---
fs/cifs/file.c | 7 +++++--
fs/cifs/trace.h | 27 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 79e6f4f55b9b..99ea7b2a06a5 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2632,8 +2632,10 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
rc = file_write_and_wait_range(file, start, end);
- if (rc)
+ if (rc) {
+ trace_cifs_fsync_err(file_inode(file)->i_ino, rc);
return rc;
+ }
xid = get_xid();
@@ -2666,7 +2668,8 @@ int cifs_flush(struct file *file, fl_owner_t id)
rc = filemap_write_and_wait(inode->i_mapping);
cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
-
+ if (rc)
+ trace_cifs_flush_err(inode->i_ino, rc);
return rc;
}
diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h
index e7e350b13d6a..4cb0d5f7ce45 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -547,6 +547,33 @@ DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
+
+DECLARE_EVENT_CLASS(smb3_sync_err_class,
+ TP_PROTO(unsigned long ino,
+ int rc),
+ TP_ARGS(ino, rc),
+ TP_STRUCT__entry(
+ __field(unsigned long, ino)
+ __field(int, rc)
+ ),
+ TP_fast_assign(
+ __entry->ino = ino;
+ __entry->rc = rc;
+ ),
+ TP_printk("\tino=%lu rc=%d",
+ __entry->ino, __entry->rc)
+)
+
+#define DEFINE_SMB3_SYNC_ERR_EVENT(name) \
+DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \
+ TP_PROTO(unsigned long ino, \
+ int rc), \
+ TP_ARGS(ino, rc))
+
+DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
+DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
+
+
DECLARE_EVENT_CLASS(smb3_enter_exit_class,
TP_PROTO(unsigned int xid,
const char *func_name),
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [CIFS][PATCH] Add dynamic trace points for flush and fsync
2020-02-06 0:29 [CIFS][PATCH] Add dynamic trace points for flush and fsync Steve French
@ 2020-02-06 18:17 ` Pavel Shilovsky
2020-02-06 22:12 ` Steve French
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Shilovsky @ 2020-02-06 18:17 UTC (permalink / raw)
To: Steve French; +Cc: CIFS, Oleg Kravtsov
ср, 5 февр. 2020 г. в 16:32, Steve French <smfrench@gmail.com>:
>
> Makes it easier to debug errors on writeback that happen later,
> and are being returned on flush or fsync
>
> For example:
> writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28
The patch is missing to add a similar tracepoint to cifs_strict_fsync().
--
Best regards,
Pavel Shilovsky
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CIFS][PATCH] Add dynamic trace points for flush and fsync
2020-02-06 18:17 ` Pavel Shilovsky
@ 2020-02-06 22:12 ` Steve French
0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2020-02-06 22:12 UTC (permalink / raw)
To: Pavel Shilovsky; +Cc: CIFS, Oleg Kravtsov
[-- Attachment #1: Type: text/plain, Size: 759 bytes --]
cifs_strict_fsync already gets traced for most cases for entry and
exit since we have a dynamic trace point in get_xid and free_xid (for
enter and exit) ie trace_smb3_enter and trace_smb3_exit and
trace_smb3_exit_err
On Thu, Feb 6, 2020 at 12:17 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> ср, 5 февр. 2020 г. в 16:32, Steve French <smfrench@gmail.com>:
> >
> > Makes it easier to debug errors on writeback that happen later,
> > and are being returned on flush or fsync
> >
> > For example:
> > writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28
>
> The patch is missing to add a similar tracepoint to cifs_strict_fsync().
>
> --
> Best regards,
> Pavel Shilovsky
--
Thanks,
Steve
[-- Attachment #2: 0001-smb3-add-one-more-dynamic-tracepoint-missing-from-st.patch --]
[-- Type: text/x-patch, Size: 1127 bytes --]
From 242891c4d6e23d0517441cc49ac131a9e5bb3791 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Thu, 6 Feb 2020 16:04:59 -0600
Subject: [PATCH] smb3: add one more dynamic tracepoint missing from strict
fsync path
We didn't have a dynamic trace point for catching errors in
file_write_and_wait_range error cases in cifs_strict_fsync.
Since not all apps check for write behind errors, it can be
important for debugging to be able to trace these error
paths.
Suggested-and-reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
fs/cifs/file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 99ea7b2a06a5..bc9516ab4b34 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2593,8 +2593,10 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
rc = file_write_and_wait_range(file, start, end);
- if (rc)
+ if (rc) {
+ trace_cifs_fsync_err(inode->i_ino, rc);
return rc;
+ }
xid = get_xid();
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-06 22:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 0:29 [CIFS][PATCH] Add dynamic trace points for flush and fsync Steve French
2020-02-06 18:17 ` Pavel Shilovsky
2020-02-06 22:12 ` Steve French
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).