From: Bharath SM <bharathsm.hsk@gmail.com>
To: linux-cifs@vger.kernel.org, smfrench@gmail.com,
sprasad@microsoft.com, pc@manguebit.com, ematsumiya@suse.de,
henrique.carvalho@suse.com, bharathsm@microsoft.com
Subject: [PATCH 2/4] smb: client: add tracepoint for local lock conflicts
Date: Tue, 14 Apr 2026 21:48:03 +0530 [thread overview]
Message-ID: <20260414161805.233686-2-bharathsm@microsoft.com> (raw)
In-Reply-To: <20260414161805.233686-1-bharathsm@microsoft.com>
Add smb3_lock_conflict tracepoint that fires when a byte-range
lock request conflicts with an existing cached lock. This helps
debug lock contention issues when locks are cached locally due
to oplocks/leases.
The trace includes both the requested and conflicting lock details:
- Requested: offset, length, type
- Conflicting: offset, length, type, pid (lock holder)
Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
fs/smb/client/file.c | 3 +++
fs/smb/client/trace.h | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 66a678a0e89f..4662592801b0 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -1631,6 +1631,9 @@ cifs_find_fid_lock_conflict(struct cifs_fid_locks *fdlocks, __u64 offset,
continue;
if (conf_lock)
*conf_lock = li;
+ trace_smb3_lock_conflict(cfile->fid.persistent_fid,
+ offset, length, type,
+ li->offset, li->length, li->type, li->pid);
return true;
}
return false;
diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h
index 242c9da0283e..cb5ce1316eba 100644
--- a/fs/smb/client/trace.h
+++ b/fs/smb/client/trace.h
@@ -729,6 +729,41 @@ DEFINE_SMB3_LOCK_EVENT(lock_done);
DEFINE_SMB3_LOCK_EVENT(lock_err);
DEFINE_SMB3_LOCK_EVENT(lock_cached);
+TRACE_EVENT(smb3_lock_conflict,
+ TP_PROTO(__u64 fid,
+ __u64 req_offset,
+ __u64 req_len,
+ __u8 req_type,
+ __u64 conf_offset,
+ __u64 conf_len,
+ __u16 conf_type,
+ __u32 conf_pid),
+ TP_ARGS(fid, req_offset, req_len, req_type, conf_offset, conf_len, conf_type, conf_pid),
+ TP_STRUCT__entry(
+ __field(__u64, fid)
+ __field(__u64, req_offset)
+ __field(__u64, req_len)
+ __field(__u8, req_type)
+ __field(__u64, conf_offset)
+ __field(__u64, conf_len)
+ __field(__u16, conf_type)
+ __field(__u32, conf_pid)
+ ),
+ TP_fast_assign(
+ __entry->fid = fid;
+ __entry->req_offset = req_offset;
+ __entry->req_len = req_len;
+ __entry->req_type = req_type;
+ __entry->conf_offset = conf_offset;
+ __entry->conf_len = conf_len;
+ __entry->conf_type = conf_type;
+ __entry->conf_pid = conf_pid;
+ ),
+ TP_printk("fid=0x%llx req=[0x%llx:0x%llx] type=0x%x conflicts with [0x%llx:0x%llx] type=0x%x pid=%u",
+ __entry->fid, __entry->req_offset, __entry->req_len, __entry->req_type,
+ __entry->conf_offset, __entry->conf_len, __entry->conf_type, __entry->conf_pid)
+);
+
/*
* For handle based query/set info calls
*/
--
2.48.1
next prev parent reply other threads:[~2026-04-14 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 16:18 [PATCH 1/4] smb: client: add tracepoints for lock operations Bharath SM
2026-04-14 16:18 ` Bharath SM [this message]
2026-04-14 16:18 ` [PATCH 3/4] smb: client: add oplock level to smb3_open_done tracepoint Bharath SM
2026-04-14 16:18 ` [PATCH 4/4] smb: client: add tracepoints for deferred handle caching Bharath SM
2026-04-14 23:10 ` [PATCH 1/4] smb: client: add tracepoints for lock operations Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260414161805.233686-2-bharathsm@microsoft.com \
--to=bharathsm.hsk@gmail.com \
--cc=bharathsm@microsoft.com \
--cc=ematsumiya@suse.de \
--cc=henrique.carvalho@suse.com \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox