Skip to content

Commit afab3f6

Browse files
bharathsm-mssmfrench
authored andcommitted
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 <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent eb4d369 commit afab3f6

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

fs/smb/client/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,9 @@ cifs_find_fid_lock_conflict(struct cifs_fid_locks *fdlocks, __u64 offset,
16311631
continue;
16321632
if (conf_lock)
16331633
*conf_lock = li;
1634+
trace_smb3_lock_conflict(cfile->fid.persistent_fid,
1635+
offset, length, type,
1636+
li->offset, li->length, li->type, li->pid);
16341637
return true;
16351638
}
16361639
return false;

fs/smb/client/trace.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,41 @@ DEFINE_SMB3_LOCK_EVENT(lock_done);
729729
DEFINE_SMB3_LOCK_EVENT(lock_err);
730730
DEFINE_SMB3_LOCK_EVENT(lock_cached);
731731

732+
TRACE_EVENT(smb3_lock_conflict,
733+
TP_PROTO(__u64 fid,
734+
__u64 req_offset,
735+
__u64 req_len,
736+
__u8 req_type,
737+
__u64 conf_offset,
738+
__u64 conf_len,
739+
__u16 conf_type,
740+
__u32 conf_pid),
741+
TP_ARGS(fid, req_offset, req_len, req_type, conf_offset, conf_len, conf_type, conf_pid),
742+
TP_STRUCT__entry(
743+
__field(__u64, fid)
744+
__field(__u64, req_offset)
745+
__field(__u64, req_len)
746+
__field(__u8, req_type)
747+
__field(__u64, conf_offset)
748+
__field(__u64, conf_len)
749+
__field(__u16, conf_type)
750+
__field(__u32, conf_pid)
751+
),
752+
TP_fast_assign(
753+
__entry->fid = fid;
754+
__entry->req_offset = req_offset;
755+
__entry->req_len = req_len;
756+
__entry->req_type = req_type;
757+
__entry->conf_offset = conf_offset;
758+
__entry->conf_len = conf_len;
759+
__entry->conf_type = conf_type;
760+
__entry->conf_pid = conf_pid;
761+
),
762+
TP_printk("fid=0x%llx req=[0x%llx:0x%llx] type=0x%x conflicts with [0x%llx:0x%llx] type=0x%x pid=%u",
763+
__entry->fid, __entry->req_offset, __entry->req_len, __entry->req_type,
764+
__entry->conf_offset, __entry->conf_len, __entry->conf_type, __entry->conf_pid)
765+
);
766+
732767
/*
733768
* For handle based query/set info calls
734769
*/

0 commit comments

Comments
 (0)