diff mbox series

[SMB2] Add tracepoint for oplock break file not found

Message ID CAH2r5ms+KeC7U4E0DnggAL587EHb45F-34-u4bVeqRR7o_GC4g@mail.gmail.com
State New
Headers show
Series [SMB2] Add tracepoint for oplock break file not found | expand

Commit Message

Steve French May 22, 2022, 5:46 a.m. UTC
Similar to the earlier patch I sent out for lease not found, this patch handles
the oplock case

In order to debug problems with server potentially sending us an oplock
that we don't recognize (or a race with close and oplock break) it would
be helpful to have a dynamic trace point for this case.  New tracepoint
called trace_smb3_oplock_not_found
diff mbox series

Patch

From b231c5f68b9fda44602cd8e266db6f4eb8f6d8a7 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 22 May 2022 00:41:41 -0500
Subject: [PATCH] smb3: add trace point for oplock not found

In order to debug problems with server potentially
sending us an oplock that we don't recognize (or a race
with close and oplock break) it would be helpful to have
a dynamic trace point for this case.  New tracepoint
is called trace_smb3_oplock_not_found

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2misc.c | 4 ++++
 fs/cifs/trace.h    | 1 +
 2 files changed, 5 insertions(+)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index f236beaff96d..17813c3d0c6e 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -732,6 +732,10 @@  smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
 	}
 	spin_unlock(&cifs_tcp_ses_lock);
 	cifs_dbg(FYI, "No file id matched, oplock break ignored\n");
+	trace_smb3_oplock_not_found(0 /* no xid */, rsp->PersistentFid,
+				  le32_to_cpu(rsp->hdr.Id.SyncId.TreeId),
+				  le64_to_cpu(rsp->hdr.SessionId));
+
 	return true;
 }
 
diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h
index 09d3dfed86d9..2be5e0c8564d 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -158,6 +158,7 @@  DEFINE_SMB3_FD_EVENT(flush_enter);
 DEFINE_SMB3_FD_EVENT(flush_done);
 DEFINE_SMB3_FD_EVENT(close_enter);
 DEFINE_SMB3_FD_EVENT(close_done);
+DEFINE_SMB3_FD_EVENT(oplock_not_found);
 
 DECLARE_EVENT_CLASS(smb3_fd_err_class,
 	TP_PROTO(unsigned int xid,
-- 
2.34.1