hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/cifs/trace.h
....@@ -3,16 +3,6 @@
33 * Copyright (C) 2018, Microsoft Corporation.
44 *
55 * Author(s): Steve French <stfrench@microsoft.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15
- * the GNU General Public License for more details.
166 */
177 #undef TRACE_SYSTEM
188 #define TRACE_SYSTEM cifs
....@@ -68,6 +58,9 @@
6858
6959 DEFINE_SMB3_RW_ERR_EVENT(write_err);
7060 DEFINE_SMB3_RW_ERR_EVENT(read_err);
61
+DEFINE_SMB3_RW_ERR_EVENT(query_dir_err);
62
+DEFINE_SMB3_RW_ERR_EVENT(zero_err);
63
+DEFINE_SMB3_RW_ERR_EVENT(falloc_err);
7164
7265
7366 /* For logging successful read or write */
....@@ -110,12 +103,55 @@
110103 __u32 len), \
111104 TP_ARGS(xid, fid, tid, sesid, offset, len))
112105
106
+DEFINE_SMB3_RW_DONE_EVENT(write_enter);
107
+DEFINE_SMB3_RW_DONE_EVENT(read_enter);
108
+DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter);
109
+DEFINE_SMB3_RW_DONE_EVENT(zero_enter);
110
+DEFINE_SMB3_RW_DONE_EVENT(falloc_enter);
113111 DEFINE_SMB3_RW_DONE_EVENT(write_done);
114112 DEFINE_SMB3_RW_DONE_EVENT(read_done);
113
+DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
114
+DEFINE_SMB3_RW_DONE_EVENT(zero_done);
115
+DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
115116
116117 /*
117118 * For handle based calls other than read and write, and get/set info
118119 */
120
+DECLARE_EVENT_CLASS(smb3_fd_class,
121
+ TP_PROTO(unsigned int xid,
122
+ __u64 fid,
123
+ __u32 tid,
124
+ __u64 sesid),
125
+ TP_ARGS(xid, fid, tid, sesid),
126
+ TP_STRUCT__entry(
127
+ __field(unsigned int, xid)
128
+ __field(__u64, fid)
129
+ __field(__u32, tid)
130
+ __field(__u64, sesid)
131
+ ),
132
+ TP_fast_assign(
133
+ __entry->xid = xid;
134
+ __entry->fid = fid;
135
+ __entry->tid = tid;
136
+ __entry->sesid = sesid;
137
+ ),
138
+ TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx",
139
+ __entry->xid, __entry->sesid, __entry->tid, __entry->fid)
140
+)
141
+
142
+#define DEFINE_SMB3_FD_EVENT(name) \
143
+DEFINE_EVENT(smb3_fd_class, smb3_##name, \
144
+ TP_PROTO(unsigned int xid, \
145
+ __u64 fid, \
146
+ __u32 tid, \
147
+ __u64 sesid), \
148
+ TP_ARGS(xid, fid, tid, sesid))
149
+
150
+DEFINE_SMB3_FD_EVENT(flush_enter);
151
+DEFINE_SMB3_FD_EVENT(flush_done);
152
+DEFINE_SMB3_FD_EVENT(close_enter);
153
+DEFINE_SMB3_FD_EVENT(close_done);
154
+
119155 DECLARE_EVENT_CLASS(smb3_fd_err_class,
120156 TP_PROTO(unsigned int xid,
121157 __u64 fid,
....@@ -158,6 +194,50 @@
158194 /*
159195 * For handle based query/set info calls
160196 */
197
+DECLARE_EVENT_CLASS(smb3_inf_enter_class,
198
+ TP_PROTO(unsigned int xid,
199
+ __u64 fid,
200
+ __u32 tid,
201
+ __u64 sesid,
202
+ __u8 infclass,
203
+ __u32 type),
204
+ TP_ARGS(xid, fid, tid, sesid, infclass, type),
205
+ TP_STRUCT__entry(
206
+ __field(unsigned int, xid)
207
+ __field(__u64, fid)
208
+ __field(__u32, tid)
209
+ __field(__u64, sesid)
210
+ __field(__u8, infclass)
211
+ __field(__u32, type)
212
+ ),
213
+ TP_fast_assign(
214
+ __entry->xid = xid;
215
+ __entry->fid = fid;
216
+ __entry->tid = tid;
217
+ __entry->sesid = sesid;
218
+ __entry->infclass = infclass;
219
+ __entry->type = type;
220
+ ),
221
+ TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
222
+ __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
223
+ __entry->infclass, __entry->type)
224
+)
225
+
226
+#define DEFINE_SMB3_INF_ENTER_EVENT(name) \
227
+DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \
228
+ TP_PROTO(unsigned int xid, \
229
+ __u64 fid, \
230
+ __u32 tid, \
231
+ __u64 sesid, \
232
+ __u8 infclass, \
233
+ __u32 type), \
234
+ TP_ARGS(xid, fid, tid, sesid, infclass, type))
235
+
236
+DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
237
+DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
238
+DEFINE_SMB3_INF_ENTER_EVENT(notify_enter);
239
+DEFINE_SMB3_INF_ENTER_EVENT(notify_done);
240
+
161241 DECLARE_EVENT_CLASS(smb3_inf_err_class,
162242 TP_PROTO(unsigned int xid,
163243 __u64 fid,
....@@ -203,7 +283,128 @@
203283
204284 DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
205285 DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
286
+DEFINE_SMB3_INF_ERR_EVENT(notify_err);
206287 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
288
+
289
+DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
290
+ TP_PROTO(unsigned int xid,
291
+ __u32 tid,
292
+ __u64 sesid,
293
+ const char *full_path),
294
+ TP_ARGS(xid, tid, sesid, full_path),
295
+ TP_STRUCT__entry(
296
+ __field(unsigned int, xid)
297
+ __field(__u32, tid)
298
+ __field(__u64, sesid)
299
+ __string(path, full_path)
300
+ ),
301
+ TP_fast_assign(
302
+ __entry->xid = xid;
303
+ __entry->tid = tid;
304
+ __entry->sesid = sesid;
305
+ __assign_str(path, full_path);
306
+ ),
307
+ TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
308
+ __entry->xid, __entry->sesid, __entry->tid,
309
+ __get_str(path))
310
+)
311
+
312
+#define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name) \
313
+DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name, \
314
+ TP_PROTO(unsigned int xid, \
315
+ __u32 tid, \
316
+ __u64 sesid, \
317
+ const char *full_path), \
318
+ TP_ARGS(xid, tid, sesid, full_path))
319
+
320
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
321
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter);
322
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
323
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
324
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
325
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
326
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
327
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
328
+DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
329
+
330
+
331
+DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
332
+ TP_PROTO(unsigned int xid,
333
+ __u32 tid,
334
+ __u64 sesid),
335
+ TP_ARGS(xid, tid, sesid),
336
+ TP_STRUCT__entry(
337
+ __field(unsigned int, xid)
338
+ __field(__u32, tid)
339
+ __field(__u64, sesid)
340
+ ),
341
+ TP_fast_assign(
342
+ __entry->xid = xid;
343
+ __entry->tid = tid;
344
+ __entry->sesid = sesid;
345
+ ),
346
+ TP_printk("xid=%u sid=0x%llx tid=0x%x",
347
+ __entry->xid, __entry->sesid, __entry->tid)
348
+)
349
+
350
+#define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \
351
+DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \
352
+ TP_PROTO(unsigned int xid, \
353
+ __u32 tid, \
354
+ __u64 sesid), \
355
+ TP_ARGS(xid, tid, sesid))
356
+
357
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
358
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done);
359
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
360
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
361
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
362
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
363
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
364
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
365
+DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
366
+
367
+
368
+DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
369
+ TP_PROTO(unsigned int xid,
370
+ __u32 tid,
371
+ __u64 sesid,
372
+ int rc),
373
+ TP_ARGS(xid, tid, sesid, rc),
374
+ TP_STRUCT__entry(
375
+ __field(unsigned int, xid)
376
+ __field(__u32, tid)
377
+ __field(__u64, sesid)
378
+ __field(int, rc)
379
+ ),
380
+ TP_fast_assign(
381
+ __entry->xid = xid;
382
+ __entry->tid = tid;
383
+ __entry->sesid = sesid;
384
+ __entry->rc = rc;
385
+ ),
386
+ TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
387
+ __entry->xid, __entry->sesid, __entry->tid,
388
+ __entry->rc)
389
+)
390
+
391
+#define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \
392
+DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \
393
+ TP_PROTO(unsigned int xid, \
394
+ __u32 tid, \
395
+ __u64 sesid, \
396
+ int rc), \
397
+ TP_ARGS(xid, tid, sesid, rc))
398
+
399
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
400
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err);
401
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
402
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
403
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
404
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
405
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
406
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
407
+DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
207408
208409 /*
209410 * For logging SMB3 Status code and Command for responses which return errors
....@@ -280,6 +481,7 @@
280481 __u64 mid), \
281482 TP_ARGS(tid, sesid, cmd, mid))
282483
484
+DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
283485 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
284486 DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
285487
....@@ -348,6 +550,33 @@
348550
349551 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
350552
553
+
554
+DECLARE_EVENT_CLASS(smb3_sync_err_class,
555
+ TP_PROTO(unsigned long ino,
556
+ int rc),
557
+ TP_ARGS(ino, rc),
558
+ TP_STRUCT__entry(
559
+ __field(unsigned long, ino)
560
+ __field(int, rc)
561
+ ),
562
+ TP_fast_assign(
563
+ __entry->ino = ino;
564
+ __entry->rc = rc;
565
+ ),
566
+ TP_printk("\tino=%lu rc=%d",
567
+ __entry->ino, __entry->rc)
568
+)
569
+
570
+#define DEFINE_SMB3_SYNC_ERR_EVENT(name) \
571
+DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \
572
+ TP_PROTO(unsigned long ino, \
573
+ int rc), \
574
+ TP_ARGS(ino, rc))
575
+
576
+DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
577
+DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
578
+
579
+
351580 DECLARE_EVENT_CLASS(smb3_enter_exit_class,
352581 TP_PROTO(unsigned int xid,
353582 const char *func_name),
....@@ -374,8 +603,89 @@
374603 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
375604
376605 /*
377
- * For smb2/smb3 open call
606
+ * For SMB2/SMB3 tree connect
378607 */
608
+
609
+DECLARE_EVENT_CLASS(smb3_tcon_class,
610
+ TP_PROTO(unsigned int xid,
611
+ __u32 tid,
612
+ __u64 sesid,
613
+ const char *unc_name,
614
+ int rc),
615
+ TP_ARGS(xid, tid, sesid, unc_name, rc),
616
+ TP_STRUCT__entry(
617
+ __field(unsigned int, xid)
618
+ __field(__u32, tid)
619
+ __field(__u64, sesid)
620
+ __string(name, unc_name)
621
+ __field(int, rc)
622
+ ),
623
+ TP_fast_assign(
624
+ __entry->xid = xid;
625
+ __entry->tid = tid;
626
+ __entry->sesid = sesid;
627
+ __assign_str(name, unc_name);
628
+ __entry->rc = rc;
629
+ ),
630
+ TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
631
+ __entry->xid, __entry->sesid, __entry->tid,
632
+ __get_str(name), __entry->rc)
633
+)
634
+
635
+#define DEFINE_SMB3_TCON_EVENT(name) \
636
+DEFINE_EVENT(smb3_tcon_class, smb3_##name, \
637
+ TP_PROTO(unsigned int xid, \
638
+ __u32 tid, \
639
+ __u64 sesid, \
640
+ const char *unc_name, \
641
+ int rc), \
642
+ TP_ARGS(xid, tid, sesid, unc_name, rc))
643
+
644
+DEFINE_SMB3_TCON_EVENT(tcon);
645
+
646
+
647
+/*
648
+ * For smb2/smb3 open (including create and mkdir) calls
649
+ */
650
+
651
+DECLARE_EVENT_CLASS(smb3_open_enter_class,
652
+ TP_PROTO(unsigned int xid,
653
+ __u32 tid,
654
+ __u64 sesid,
655
+ int create_options,
656
+ int desired_access),
657
+ TP_ARGS(xid, tid, sesid, create_options, desired_access),
658
+ TP_STRUCT__entry(
659
+ __field(unsigned int, xid)
660
+ __field(__u32, tid)
661
+ __field(__u64, sesid)
662
+ __field(int, create_options)
663
+ __field(int, desired_access)
664
+ ),
665
+ TP_fast_assign(
666
+ __entry->xid = xid;
667
+ __entry->tid = tid;
668
+ __entry->sesid = sesid;
669
+ __entry->create_options = create_options;
670
+ __entry->desired_access = desired_access;
671
+ ),
672
+ TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
673
+ __entry->xid, __entry->sesid, __entry->tid,
674
+ __entry->create_options, __entry->desired_access)
675
+)
676
+
677
+#define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \
678
+DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
679
+ TP_PROTO(unsigned int xid, \
680
+ __u32 tid, \
681
+ __u64 sesid, \
682
+ int create_options, \
683
+ int desired_access), \
684
+ TP_ARGS(xid, tid, sesid, create_options, desired_access))
685
+
686
+DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
687
+DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
688
+
379689 DECLARE_EVENT_CLASS(smb3_open_err_class,
380690 TP_PROTO(unsigned int xid,
381691 __u32 tid,
....@@ -460,6 +770,85 @@
460770 DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
461771 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
462772
773
+
774
+DECLARE_EVENT_CLASS(smb3_lease_done_class,
775
+ TP_PROTO(__u32 lease_state,
776
+ __u32 tid,
777
+ __u64 sesid,
778
+ __u64 lease_key_low,
779
+ __u64 lease_key_high),
780
+ TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
781
+ TP_STRUCT__entry(
782
+ __field(__u32, lease_state)
783
+ __field(__u32, tid)
784
+ __field(__u64, sesid)
785
+ __field(__u64, lease_key_low)
786
+ __field(__u64, lease_key_high)
787
+ ),
788
+ TP_fast_assign(
789
+ __entry->lease_state = lease_state;
790
+ __entry->tid = tid;
791
+ __entry->sesid = sesid;
792
+ __entry->lease_key_low = lease_key_low;
793
+ __entry->lease_key_high = lease_key_high;
794
+ ),
795
+ TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
796
+ __entry->sesid, __entry->tid, __entry->lease_key_high,
797
+ __entry->lease_key_low, __entry->lease_state)
798
+)
799
+
800
+#define DEFINE_SMB3_LEASE_DONE_EVENT(name) \
801
+DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \
802
+ TP_PROTO(__u32 lease_state, \
803
+ __u32 tid, \
804
+ __u64 sesid, \
805
+ __u64 lease_key_low, \
806
+ __u64 lease_key_high), \
807
+ TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
808
+
809
+DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
810
+
811
+DECLARE_EVENT_CLASS(smb3_lease_err_class,
812
+ TP_PROTO(__u32 lease_state,
813
+ __u32 tid,
814
+ __u64 sesid,
815
+ __u64 lease_key_low,
816
+ __u64 lease_key_high,
817
+ int rc),
818
+ TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
819
+ TP_STRUCT__entry(
820
+ __field(__u32, lease_state)
821
+ __field(__u32, tid)
822
+ __field(__u64, sesid)
823
+ __field(__u64, lease_key_low)
824
+ __field(__u64, lease_key_high)
825
+ __field(int, rc)
826
+ ),
827
+ TP_fast_assign(
828
+ __entry->lease_state = lease_state;
829
+ __entry->tid = tid;
830
+ __entry->sesid = sesid;
831
+ __entry->lease_key_low = lease_key_low;
832
+ __entry->lease_key_high = lease_key_high;
833
+ __entry->rc = rc;
834
+ ),
835
+ TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
836
+ __entry->sesid, __entry->tid, __entry->lease_key_high,
837
+ __entry->lease_key_low, __entry->lease_state, __entry->rc)
838
+)
839
+
840
+#define DEFINE_SMB3_LEASE_ERR_EVENT(name) \
841
+DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \
842
+ TP_PROTO(__u32 lease_state, \
843
+ __u32 tid, \
844
+ __u64 sesid, \
845
+ __u64 lease_key_low, \
846
+ __u64 lease_key_high, \
847
+ int rc), \
848
+ TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
849
+
850
+DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
851
+
463852 DECLARE_EVENT_CLASS(smb3_reconnect_class,
464853 TP_PROTO(__u64 currmid,
465854 char *hostname),
....@@ -486,6 +875,43 @@
486875 DEFINE_SMB3_RECONNECT_EVENT(reconnect);
487876 DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
488877
878
+DECLARE_EVENT_CLASS(smb3_credit_class,
879
+ TP_PROTO(__u64 currmid,
880
+ char *hostname,
881
+ int credits,
882
+ int credits_to_add),
883
+ TP_ARGS(currmid, hostname, credits, credits_to_add),
884
+ TP_STRUCT__entry(
885
+ __field(__u64, currmid)
886
+ __field(char *, hostname)
887
+ __field(int, credits)
888
+ __field(int, credits_to_add)
889
+ ),
890
+ TP_fast_assign(
891
+ __entry->currmid = currmid;
892
+ __entry->hostname = hostname;
893
+ __entry->credits = credits;
894
+ __entry->credits_to_add = credits_to_add;
895
+ ),
896
+ TP_printk("server=%s current_mid=0x%llx credits=%d credits_to_add=%d",
897
+ __entry->hostname,
898
+ __entry->currmid,
899
+ __entry->credits,
900
+ __entry->credits_to_add)
901
+)
902
+
903
+#define DEFINE_SMB3_CREDIT_EVENT(name) \
904
+DEFINE_EVENT(smb3_credit_class, smb3_##name, \
905
+ TP_PROTO(__u64 currmid, \
906
+ char *hostname, \
907
+ int credits, \
908
+ int credits_to_add), \
909
+ TP_ARGS(currmid, hostname, credits, credits_to_add))
910
+
911
+DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
912
+DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
913
+DEFINE_SMB3_CREDIT_EVENT(add_credits);
914
+
489915 #endif /* _CIFS_TRACE_H */
490916
491917 #undef TRACE_INCLUDE_PATH