Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cifs: append path to open_enter trace event

We do not dump the file path for smb3_open_enter ftrace
calls, which is a severe handicap while debugging
using ftrace evens. This change adds that info.

Unfortunately, we're not updating the path in open params
in many places; which I had to do as a part of this change.
SMB2_open gets path in utf16 format, but it's easier of
path is supplied as char pointer in oparms.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Shyam Prasad N and committed by
Steve French
fddc6ccc 175b54ab

+25 -6
+1
fs/cifs/cached_dir.c
··· 184 184 185 185 oparms = (struct cifs_open_parms) { 186 186 .tcon = tcon, 187 + .path = path, 187 188 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE), 188 189 .desired_access = FILE_READ_ATTRIBUTES, 189 190 .disposition = FILE_OPEN,
+2
fs/cifs/link.c
··· 360 360 oparms = (struct cifs_open_parms) { 361 361 .tcon = tcon, 362 362 .cifs_sb = cifs_sb, 363 + .path = path, 363 364 .desired_access = GENERIC_READ, 364 365 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 365 366 .disposition = FILE_OPEN, ··· 428 427 oparms = (struct cifs_open_parms) { 429 428 .tcon = tcon, 430 429 .cifs_sb = cifs_sb, 430 + .path = path, 431 431 .desired_access = GENERIC_WRITE, 432 432 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 433 433 .disposition = FILE_CREATE,
+1
fs/cifs/smb2inode.c
··· 107 107 108 108 vars->oparms = (struct cifs_open_parms) { 109 109 .tcon = tcon, 110 + .path = full_path, 110 111 .desired_access = desired_access, 111 112 .disposition = create_disposition, 112 113 .create_options = cifs_create_options(cifs_sb, create_options),
+11
fs/cifs/smb2ops.c
··· 745 745 746 746 oparms = (struct cifs_open_parms) { 747 747 .tcon = tcon, 748 + .path = "", 748 749 .desired_access = FILE_READ_ATTRIBUTES, 749 750 .disposition = FILE_OPEN, 750 751 .create_options = cifs_create_options(cifs_sb, 0), ··· 789 788 790 789 oparms = (struct cifs_open_parms) { 791 790 .tcon = tcon, 791 + .path = "", 792 792 .desired_access = FILE_READ_ATTRIBUTES, 793 793 .disposition = FILE_OPEN, 794 794 .create_options = cifs_create_options(cifs_sb, 0), ··· 837 835 838 836 oparms = (struct cifs_open_parms) { 839 837 .tcon = tcon, 838 + .path = full_path, 840 839 .desired_access = FILE_READ_ATTRIBUTES, 841 840 .disposition = FILE_OPEN, 842 841 .create_options = cifs_create_options(cifs_sb, 0), ··· 1122 1119 1123 1120 oparms = (struct cifs_open_parms) { 1124 1121 .tcon = tcon, 1122 + .path = path, 1125 1123 .desired_access = FILE_WRITE_EA, 1126 1124 .disposition = FILE_OPEN, 1127 1125 .create_options = cifs_create_options(cifs_sb, 0), ··· 2114 2110 tcon = cifs_sb_master_tcon(cifs_sb); 2115 2111 oparms = (struct cifs_open_parms) { 2116 2112 .tcon = tcon, 2113 + .path = path, 2117 2114 .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, 2118 2115 .disposition = FILE_OPEN, 2119 2116 .create_options = cifs_create_options(cifs_sb, 0), ··· 2187 2182 2188 2183 oparms = (struct cifs_open_parms) { 2189 2184 .tcon = tcon, 2185 + .path = path, 2190 2186 .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, 2191 2187 .disposition = FILE_OPEN, 2192 2188 .create_options = cifs_create_options(cifs_sb, 0), ··· 2520 2514 2521 2515 oparms = (struct cifs_open_parms) { 2522 2516 .tcon = tcon, 2517 + .path = path, 2523 2518 .desired_access = desired_access, 2524 2519 .disposition = FILE_OPEN, 2525 2520 .create_options = cifs_create_options(cifs_sb, 0), ··· 2655 2648 2656 2649 oparms = (struct cifs_open_parms) { 2657 2650 .tcon = tcon, 2651 + .path = "", 2658 2652 .desired_access = FILE_READ_ATTRIBUTES, 2659 2653 .disposition = FILE_OPEN, 2660 2654 .create_options = cifs_create_options(cifs_sb, 0), ··· 2950 2942 2951 2943 oparms = (struct cifs_open_parms) { 2952 2944 .tcon = tcon, 2945 + .path = full_path, 2953 2946 .desired_access = FILE_READ_ATTRIBUTES, 2954 2947 .disposition = FILE_OPEN, 2955 2948 .create_options = cifs_create_options(cifs_sb, create_options), ··· 3091 3082 3092 3083 oparms = (struct cifs_open_parms) { 3093 3084 .tcon = tcon, 3085 + .path = full_path, 3094 3086 .desired_access = FILE_READ_ATTRIBUTES, 3095 3087 .disposition = FILE_OPEN, 3096 3088 .create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT), ··· 3232 3222 3233 3223 oparms = (struct cifs_open_parms) { 3234 3224 .tcon = tcon, 3225 + .path = path, 3235 3226 .desired_access = READ_CONTROL, 3236 3227 .disposition = FILE_OPEN, 3237 3228 /*
+2 -2
fs/cifs/smb2pdu.c
··· 2705 2705 rqst.rq_nvec = n_iov; 2706 2706 2707 2707 /* no need to inc num_remote_opens because we close it just below */ 2708 - trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE, 2708 + trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE, 2709 2709 FILE_WRITE_ATTRIBUTES); 2710 2710 /* resource #4: response buffer */ 2711 2711 rc = cifs_send_recv(xid, ses, server, ··· 2973 2973 if (rc) 2974 2974 goto creat_exit; 2975 2975 2976 - trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, 2976 + trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path, 2977 2977 oparms->create_options, oparms->desired_access); 2978 2978 2979 2979 rc = cifs_send_recv(xid, ses, server,
+8 -4
fs/cifs/trace.h
··· 701 701 TP_PROTO(unsigned int xid, 702 702 __u32 tid, 703 703 __u64 sesid, 704 + const char *full_path, 704 705 int create_options, 705 706 int desired_access), 706 - TP_ARGS(xid, tid, sesid, create_options, desired_access), 707 + TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access), 707 708 TP_STRUCT__entry( 708 709 __field(unsigned int, xid) 709 710 __field(__u32, tid) 710 711 __field(__u64, sesid) 712 + __string(path, full_path) 711 713 __field(int, create_options) 712 714 __field(int, desired_access) 713 715 ), ··· 717 715 __entry->xid = xid; 718 716 __entry->tid = tid; 719 717 __entry->sesid = sesid; 718 + __assign_str(path, full_path); 720 719 __entry->create_options = create_options; 721 720 __entry->desired_access = desired_access; 722 721 ), 723 - TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x", 724 - __entry->xid, __entry->sesid, __entry->tid, 722 + TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x", 723 + __entry->xid, __entry->sesid, __entry->tid, __get_str(path), 725 724 __entry->create_options, __entry->desired_access) 726 725 ) 727 726 ··· 731 728 TP_PROTO(unsigned int xid, \ 732 729 __u32 tid, \ 733 730 __u64 sesid, \ 731 + const char *full_path, \ 734 732 int create_options, \ 735 733 int desired_access), \ 736 - TP_ARGS(xid, tid, sesid, create_options, desired_access)) 734 + TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access)) 737 735 738 736 DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); 739 737 DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);