Skip to content

Commit fddc6cc

Browse files
sprasad-microsoftsmfrench
authored andcommitted
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 <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent 175b54a commit fddc6cc

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

fs/cifs/cached_dir.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
184184

185185
oparms = (struct cifs_open_parms) {
186186
.tcon = tcon,
187+
.path = path,
187188
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE),
188189
.desired_access = FILE_READ_ATTRIBUTES,
189190
.disposition = FILE_OPEN,

fs/cifs/link.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
360360
oparms = (struct cifs_open_parms) {
361361
.tcon = tcon,
362362
.cifs_sb = cifs_sb,
363+
.path = path,
363364
.desired_access = GENERIC_READ,
364365
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
365366
.disposition = FILE_OPEN,
@@ -427,6 +428,7 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
427428
oparms = (struct cifs_open_parms) {
428429
.tcon = tcon,
429430
.cifs_sb = cifs_sb,
431+
.path = path,
430432
.desired_access = GENERIC_WRITE,
431433
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
432434
.disposition = FILE_CREATE,

fs/cifs/smb2inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
107107

108108
vars->oparms = (struct cifs_open_parms) {
109109
.tcon = tcon,
110+
.path = full_path,
110111
.desired_access = desired_access,
111112
.disposition = create_disposition,
112113
.create_options = cifs_create_options(cifs_sb, create_options),

fs/cifs/smb2ops.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
745745

746746
oparms = (struct cifs_open_parms) {
747747
.tcon = tcon,
748+
.path = "",
748749
.desired_access = FILE_READ_ATTRIBUTES,
749750
.disposition = FILE_OPEN,
750751
.create_options = cifs_create_options(cifs_sb, 0),
@@ -788,6 +789,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
788789

789790
oparms = (struct cifs_open_parms) {
790791
.tcon = tcon,
792+
.path = "",
791793
.desired_access = FILE_READ_ATTRIBUTES,
792794
.disposition = FILE_OPEN,
793795
.create_options = cifs_create_options(cifs_sb, 0),
@@ -835,6 +837,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
835837

836838
oparms = (struct cifs_open_parms) {
837839
.tcon = tcon,
840+
.path = full_path,
838841
.desired_access = FILE_READ_ATTRIBUTES,
839842
.disposition = FILE_OPEN,
840843
.create_options = cifs_create_options(cifs_sb, 0),
@@ -1119,6 +1122,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11191122

11201123
oparms = (struct cifs_open_parms) {
11211124
.tcon = tcon,
1125+
.path = path,
11221126
.desired_access = FILE_WRITE_EA,
11231127
.disposition = FILE_OPEN,
11241128
.create_options = cifs_create_options(cifs_sb, 0),
@@ -2110,6 +2114,7 @@ smb3_notify(const unsigned int xid, struct file *pfile,
21102114
tcon = cifs_sb_master_tcon(cifs_sb);
21112115
oparms = (struct cifs_open_parms) {
21122116
.tcon = tcon,
2117+
.path = path,
21132118
.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
21142119
.disposition = FILE_OPEN,
21152120
.create_options = cifs_create_options(cifs_sb, 0),
@@ -2182,6 +2187,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
21822187

21832188
oparms = (struct cifs_open_parms) {
21842189
.tcon = tcon,
2190+
.path = path,
21852191
.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
21862192
.disposition = FILE_OPEN,
21872193
.create_options = cifs_create_options(cifs_sb, 0),
@@ -2514,6 +2520,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
25142520

25152521
oparms = (struct cifs_open_parms) {
25162522
.tcon = tcon,
2523+
.path = path,
25172524
.desired_access = desired_access,
25182525
.disposition = FILE_OPEN,
25192526
.create_options = cifs_create_options(cifs_sb, 0),
@@ -2648,6 +2655,7 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
26482655

26492656
oparms = (struct cifs_open_parms) {
26502657
.tcon = tcon,
2658+
.path = "",
26512659
.desired_access = FILE_READ_ATTRIBUTES,
26522660
.disposition = FILE_OPEN,
26532661
.create_options = cifs_create_options(cifs_sb, 0),
@@ -2942,6 +2950,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
29422950

29432951
oparms = (struct cifs_open_parms) {
29442952
.tcon = tcon,
2953+
.path = full_path,
29452954
.desired_access = FILE_READ_ATTRIBUTES,
29462955
.disposition = FILE_OPEN,
29472956
.create_options = cifs_create_options(cifs_sb, create_options),
@@ -3082,6 +3091,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
30823091

30833092
oparms = (struct cifs_open_parms) {
30843093
.tcon = tcon,
3094+
.path = full_path,
30853095
.desired_access = FILE_READ_ATTRIBUTES,
30863096
.disposition = FILE_OPEN,
30873097
.create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT),
@@ -3222,6 +3232,7 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
32223232

32233233
oparms = (struct cifs_open_parms) {
32243234
.tcon = tcon,
3235+
.path = path,
32253236
.desired_access = READ_CONTROL,
32263237
.disposition = FILE_OPEN,
32273238
/*

fs/cifs/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,7 +2705,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
27052705
rqst.rq_nvec = n_iov;
27062706

27072707
/* 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,
27092709
FILE_WRITE_ATTRIBUTES);
27102710
/* resource #4: response buffer */
27112711
rc = cifs_send_recv(xid, ses, server,
@@ -2973,7 +2973,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
29732973
if (rc)
29742974
goto creat_exit;
29752975

2976-
trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid,
2976+
trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path,
29772977
oparms->create_options, oparms->desired_access);
29782978

29792979
rc = cifs_send_recv(xid, ses, server,

fs/cifs/trace.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,25 +701,28 @@ DECLARE_EVENT_CLASS(smb3_open_enter_class,
701701
TP_PROTO(unsigned int xid,
702702
__u32 tid,
703703
__u64 sesid,
704+
const char *full_path,
704705
int create_options,
705706
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),
707708
TP_STRUCT__entry(
708709
__field(unsigned int, xid)
709710
__field(__u32, tid)
710711
__field(__u64, sesid)
712+
__string(path, full_path)
711713
__field(int, create_options)
712714
__field(int, desired_access)
713715
),
714716
TP_fast_assign(
715717
__entry->xid = xid;
716718
__entry->tid = tid;
717719
__entry->sesid = sesid;
720+
__assign_str(path, full_path);
718721
__entry->create_options = create_options;
719722
__entry->desired_access = desired_access;
720723
),
721-
TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
722-
__entry->xid, __entry->sesid, __entry->tid,
724+
TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x",
725+
__entry->xid, __entry->sesid, __entry->tid, __get_str(path),
723726
__entry->create_options, __entry->desired_access)
724727
)
725728

@@ -728,9 +731,10 @@ DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
728731
TP_PROTO(unsigned int xid, \
729732
__u32 tid, \
730733
__u64 sesid, \
734+
const char *full_path, \
731735
int create_options, \
732736
int desired_access), \
733-
TP_ARGS(xid, tid, sesid, create_options, desired_access))
737+
TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access))
734738

735739
DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
736740
DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);

0 commit comments

Comments
 (0)