Commit fddc6ccc authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

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: default avatarShyam Prasad N <sprasad@microsoft.com>
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 175b54ab
...@@ -184,6 +184,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, ...@@ -184,6 +184,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE), .create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE),
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
......
...@@ -360,6 +360,7 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -360,6 +360,7 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.cifs_sb = cifs_sb, .cifs_sb = cifs_sb,
.path = path,
.desired_access = GENERIC_READ, .desired_access = GENERIC_READ,
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
...@@ -427,6 +428,7 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -427,6 +428,7 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.cifs_sb = cifs_sb, .cifs_sb = cifs_sb,
.path = path,
.desired_access = GENERIC_WRITE, .desired_access = GENERIC_WRITE,
.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR),
.disposition = FILE_CREATE, .disposition = FILE_CREATE,
......
...@@ -107,6 +107,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -107,6 +107,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
vars->oparms = (struct cifs_open_parms) { vars->oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = full_path,
.desired_access = desired_access, .desired_access = desired_access,
.disposition = create_disposition, .disposition = create_disposition,
.create_options = cifs_create_options(cifs_sb, create_options), .create_options = cifs_create_options(cifs_sb, create_options),
......
...@@ -745,6 +745,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -745,6 +745,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = "",
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -788,6 +789,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -788,6 +789,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = "",
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -835,6 +837,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -835,6 +837,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = full_path,
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -1119,6 +1122,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1119,6 +1122,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.desired_access = FILE_WRITE_EA, .desired_access = FILE_WRITE_EA,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -2110,6 +2114,7 @@ smb3_notify(const unsigned int xid, struct file *pfile, ...@@ -2110,6 +2114,7 @@ smb3_notify(const unsigned int xid, struct file *pfile,
tcon = cifs_sb_master_tcon(cifs_sb); tcon = cifs_sb_master_tcon(cifs_sb);
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -2182,6 +2187,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2182,6 +2187,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -2514,6 +2520,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2514,6 +2520,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.desired_access = desired_access, .desired_access = desired_access,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -2648,6 +2655,7 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2648,6 +2655,7 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = "",
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, 0), .create_options = cifs_create_options(cifs_sb, 0),
...@@ -2942,6 +2950,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2942,6 +2950,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = full_path,
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, create_options), .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, ...@@ -3082,6 +3091,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = full_path,
.desired_access = FILE_READ_ATTRIBUTES, .desired_access = FILE_READ_ATTRIBUTES,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
.create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT), .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, ...@@ -3222,6 +3232,7 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
oparms = (struct cifs_open_parms) { oparms = (struct cifs_open_parms) {
.tcon = tcon, .tcon = tcon,
.path = path,
.desired_access = READ_CONTROL, .desired_access = READ_CONTROL,
.disposition = FILE_OPEN, .disposition = FILE_OPEN,
/* /*
......
...@@ -2705,7 +2705,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, ...@@ -2705,7 +2705,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
rqst.rq_nvec = n_iov; rqst.rq_nvec = n_iov;
/* no need to inc num_remote_opens because we close it just below */ /* no need to inc num_remote_opens because we close it just below */
trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE, trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE,
FILE_WRITE_ATTRIBUTES); FILE_WRITE_ATTRIBUTES);
/* resource #4: response buffer */ /* resource #4: response buffer */
rc = cifs_send_recv(xid, ses, server, rc = cifs_send_recv(xid, ses, server,
...@@ -2973,7 +2973,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, ...@@ -2973,7 +2973,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
if (rc) if (rc)
goto creat_exit; goto creat_exit;
trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path,
oparms->create_options, oparms->desired_access); oparms->create_options, oparms->desired_access);
rc = cifs_send_recv(xid, ses, server, rc = cifs_send_recv(xid, ses, server,
......
...@@ -701,13 +701,15 @@ DECLARE_EVENT_CLASS(smb3_open_enter_class, ...@@ -701,13 +701,15 @@ DECLARE_EVENT_CLASS(smb3_open_enter_class,
TP_PROTO(unsigned int xid, TP_PROTO(unsigned int xid,
__u32 tid, __u32 tid,
__u64 sesid, __u64 sesid,
const char *full_path,
int create_options, int create_options,
int desired_access), int desired_access),
TP_ARGS(xid, tid, sesid, create_options, desired_access), TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned int, xid) __field(unsigned int, xid)
__field(__u32, tid) __field(__u32, tid)
__field(__u64, sesid) __field(__u64, sesid)
__string(path, full_path)
__field(int, create_options) __field(int, create_options)
__field(int, desired_access) __field(int, desired_access)
), ),
...@@ -715,11 +717,12 @@ DECLARE_EVENT_CLASS(smb3_open_enter_class, ...@@ -715,11 +717,12 @@ DECLARE_EVENT_CLASS(smb3_open_enter_class,
__entry->xid = xid; __entry->xid = xid;
__entry->tid = tid; __entry->tid = tid;
__entry->sesid = sesid; __entry->sesid = sesid;
__assign_str(path, full_path);
__entry->create_options = create_options; __entry->create_options = create_options;
__entry->desired_access = desired_access; __entry->desired_access = desired_access;
), ),
TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x", TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x",
__entry->xid, __entry->sesid, __entry->tid, __entry->xid, __entry->sesid, __entry->tid, __get_str(path),
__entry->create_options, __entry->desired_access) __entry->create_options, __entry->desired_access)
) )
...@@ -728,9 +731,10 @@ DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \ ...@@ -728,9 +731,10 @@ DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
TP_PROTO(unsigned int xid, \ TP_PROTO(unsigned int xid, \
__u32 tid, \ __u32 tid, \
__u64 sesid, \ __u64 sesid, \
const char *full_path, \
int create_options, \ int create_options, \
int desired_access), \ int desired_access), \
TP_ARGS(xid, tid, sesid, create_options, desired_access)) TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access))
DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter); DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment