From: Bharath SM Date: Tue, 14 Apr 2026 16:18:03 +0000 (+0530) Subject: smb: client: add tracepoint for local lock conflicts X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afab3f61aeb19693109e8a71028c7b0c8088f452;p=thirdparty%2Fkernel%2Flinux.git smb: client: add tracepoint for local lock conflicts 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 Signed-off-by: Steve French --- diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 66a678a0e89f4..4662592801b06 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 242c9da0283ea..cb5ce1316eba6 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 */