Skip to content

Commit 7c05eae

Browse files
committed
smb3: add trace point for SMB2_set_eof
In order to debug problems with file size being reported incorrectly temporarily (in this case xfstest generic/584 intermittent failure) we need to add trace point for the non-compounded code path where we set the file size (SMB2_set_eof). The new trace point is: "smb3_set_eof" Here is sample output from the tracepoint: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | xfs_io-75403 [002] ..... 95219.189835: smb3_set_eof: xid=221 sid=0xeef1cbd2 tid=0x27079ee6 fid=0x52edb58c offset=0x100000 aio-dio-append--75418 [010] ..... 95219.242402: smb3_set_eof: xid=226 sid=0xeef1cbd2 tid=0x27079ee6 fid=0xae89852d offset=0x0 Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b13bacc commit 7c05eae

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

fs/cifs/smb2pdu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,6 +5154,8 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
51545154
data = &info;
51555155
size = sizeof(struct smb2_file_eof_info);
51565156

5157+
trace_smb3_set_eof(xid, persistent_fid, tcon->tid, tcon->ses->Suid, le64_to_cpu(*eof));
5158+
51575159
return send_set_info(xid, tcon, persistent_fid, volatile_fid,
51585160
pid, FILE_END_OF_FILE_INFORMATION, SMB2_O_INFO_FILE,
51595161
0, 1, &data, &size);

fs/cifs/trace.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,44 @@ DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
121121
DEFINE_SMB3_RW_DONE_EVENT(zero_done);
122122
DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
123123

124+
/* For logging successful set EOF (truncate) */
125+
DECLARE_EVENT_CLASS(smb3_eof_class,
126+
TP_PROTO(unsigned int xid,
127+
__u64 fid,
128+
__u32 tid,
129+
__u64 sesid,
130+
__u64 offset),
131+
TP_ARGS(xid, fid, tid, sesid, offset),
132+
TP_STRUCT__entry(
133+
__field(unsigned int, xid)
134+
__field(__u64, fid)
135+
__field(__u32, tid)
136+
__field(__u64, sesid)
137+
__field(__u64, offset)
138+
),
139+
TP_fast_assign(
140+
__entry->xid = xid;
141+
__entry->fid = fid;
142+
__entry->tid = tid;
143+
__entry->sesid = sesid;
144+
__entry->offset = offset;
145+
),
146+
TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx",
147+
__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
148+
__entry->offset)
149+
)
150+
151+
#define DEFINE_SMB3_EOF_EVENT(name) \
152+
DEFINE_EVENT(smb3_eof_class, smb3_##name, \
153+
TP_PROTO(unsigned int xid, \
154+
__u64 fid, \
155+
__u32 tid, \
156+
__u64 sesid, \
157+
__u64 offset), \
158+
TP_ARGS(xid, fid, tid, sesid, offset))
159+
160+
DEFINE_SMB3_EOF_EVENT(set_eof);
161+
124162
/*
125163
* For handle based calls other than read and write, and get/set info
126164
*/

0 commit comments

Comments
 (0)