smb: client: fix order of arguments of tracepoints

BugLink: https://bugs.launchpad.net/bugs/2114239

commit 11f8b80ab9f99291dc88d09855b9f8f43b772335 upstream.

The tracepoints based on smb3_inf_compound_*_class have tcon id and
session id swapped around. This results in incorrect output in
`trace-cmd report`.

Fix the order of arguments to resolve this issue. The trace-cmd output
below shows the before and after of the smb3_delete_enter and
smb3_delete_done events as an example. The smb3_cmd_* events show the
correct session and tcon id for reference.

Also fix tracepoint set -> get in the SMB2_OP_GET_REPARSE case.

BEFORE:
rm-2211  [001] .....  1839.550888: smb3_delete_enter:    xid=281 sid=0x5 tid=0x3d path=\hello2.txt
rm-2211  [001] .....  1839.550894: smb3_cmd_enter:        sid=0x1ac000000003d tid=0x5 cmd=5 mid=61
rm-2211  [001] .....  1839.550896: smb3_cmd_enter:        sid=0x1ac000000003d tid=0x5 cmd=6 mid=62
rm-2211  [001] .....  1839.552091: smb3_cmd_done:         sid=0x1ac000000003d tid=0x5 cmd=5 mid=61
rm-2211  [001] .....  1839.552093: smb3_cmd_done:         sid=0x1ac000000003d tid=0x5 cmd=6 mid=62
rm-2211  [001] .....  1839.552103: smb3_delete_done:     xid=281 sid=0x5 tid=0x3d

AFTER:
rm-2501  [001] .....  3237.656110: smb3_delete_enter:    xid=88 sid=0x1ac0000000041 tid=0x5 path=\hello2.txt
rm-2501  [001] .....  3237.656122: smb3_cmd_enter:        sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84
rm-2501  [001] .....  3237.656123: smb3_cmd_enter:        sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85
rm-2501  [001] .....  3237.657909: smb3_cmd_done:         sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84
rm-2501  [001] .....  3237.657909: smb3_cmd_done:         sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85
rm-2501  [001] .....  3237.657922: smb3_delete_done:     xid=88 sid=0x1ac0000000041 tid=0x5

Cc: stable@vger.kernel.org
Signed-off-by: Ruben Devos <devosruben6@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[nwager: Context changes and some nonexistent lines]
Signed-off-by: Noah Wager <noah.wager@canonical.com>
Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
Ruben Devos
2025-01-18 21:03:30 +01:00
committed by Mehmet Basaran
parent 2df1159cb4
commit 179e75c0ad
+49 -51
View File
@@ -211,8 +211,8 @@ replay_again:
if (rc)
goto finished;
num_rqst++;
trace_smb3_query_info_compound_enter(xid, ses->Suid,
tcon->tid, full_path);
trace_smb3_query_info_compound_enter(xid, tcon->tid,
ses->Suid, full_path);
break;
case SMB2_OP_POSIX_QUERY_INFO:
rqst[num_rqst].rq_iov = &vars->qi_iov;
@@ -248,18 +248,18 @@ replay_again:
if (rc)
goto finished;
num_rqst++;
trace_smb3_posix_query_info_compound_enter(xid, ses->Suid,
tcon->tid, full_path);
trace_smb3_posix_query_info_compound_enter(xid, tcon->tid,
ses->Suid, full_path);
break;
case SMB2_OP_DELETE:
trace_smb3_delete_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_delete_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_MKDIR:
/*
* Directories are created through parameters in the
* SMB2_open() call.
*/
trace_smb3_mkdir_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_mkdir_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_RMDIR:
rqst[num_rqst].rq_iov = &vars->si_iov[0];
@@ -277,7 +277,7 @@ replay_again:
goto finished;
smb2_set_next_command(tcon, &rqst[num_rqst]);
smb2_set_related(&rqst[num_rqst++]);
trace_smb3_rmdir_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_rmdir_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_SET_EOF:
rqst[num_rqst].rq_iov = &vars->si_iov[0];
@@ -312,7 +312,7 @@ replay_again:
if (rc)
goto finished;
num_rqst++;
trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_set_eof_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_SET_INFO:
rqst[num_rqst].rq_iov = &vars->si_iov[0];
@@ -344,8 +344,8 @@ replay_again:
if (rc)
goto finished;
num_rqst++;
trace_smb3_set_info_compound_enter(xid, ses->Suid,
tcon->tid, full_path);
trace_smb3_set_info_compound_enter(xid, tcon->tid,
ses->Suid, full_path);
break;
case SMB2_OP_RENAME:
rqst[num_rqst].rq_iov = &vars->si_iov[0];
@@ -384,7 +384,7 @@ replay_again:
if (rc)
goto finished;
num_rqst++;
trace_smb3_rename_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_rename_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_HARDLINK:
rqst[num_rqst].rq_iov = &vars->si_iov[0];
@@ -411,7 +411,7 @@ replay_again:
goto finished;
smb2_set_next_command(tcon, &rqst[num_rqst]);
smb2_set_related(&rqst[num_rqst++]);
trace_smb3_hardlink_enter(xid, ses->Suid, tcon->tid, full_path);
trace_smb3_hardlink_enter(xid, tcon->tid, ses->Suid, full_path);
break;
case SMB2_OP_SET_REPARSE:
rqst[num_rqst].rq_iov = vars->io_iov;
@@ -426,8 +426,8 @@ replay_again:
goto finished;
smb2_set_next_command(tcon, &rqst[num_rqst]);
smb2_set_related(&rqst[num_rqst++]);
trace_smb3_set_reparse_compound_enter(xid, ses->Suid,
tcon->tid, full_path);
trace_smb3_set_reparse_compound_enter(xid, tcon->tid,
ses->Suid, full_path);
break;
case SMB2_OP_GET_REPARSE:
rqst[num_rqst].rq_iov = vars->io_iov;
@@ -441,8 +441,8 @@ replay_again:
goto finished;
smb2_set_next_command(tcon, &rqst[num_rqst]);
smb2_set_related(&rqst[num_rqst++]);
trace_smb3_get_reparse_compound_enter(xid, ses->Suid,
tcon->tid, full_path);
trace_smb3_get_reparse_compound_enter(xid, tcon->tid,
ses->Suid, full_path);
break;
default:
cifs_dbg(VFS, "Invalid command\n");
@@ -515,11 +515,11 @@ finished:
}
SMB2_query_info_free(&rqst[num_rqst++]);
if (rc)
trace_smb3_query_info_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_query_info_compound_err(xid, tcon->tid,
ses->Suid, rc);
else
trace_smb3_query_info_compound_done(xid, ses->Suid,
tcon->tid);
trace_smb3_query_info_compound_done(xid, tcon->tid,
ses->Suid);
break;
case SMB2_OP_POSIX_QUERY_INFO:
idata = in_iov[i].iov_base;
@@ -542,68 +542,66 @@ finished:
SMB2_query_info_free(&rqst[num_rqst++]);
if (rc)
trace_smb3_posix_query_info_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_posix_query_info_compound_err(xid, tcon->tid,
ses->Suid, rc);
else
trace_smb3_posix_query_info_compound_done(xid, ses->Suid,
tcon->tid);
trace_smb3_posix_query_info_compound_done(xid, tcon->tid,
ses->Suid);
break;
case SMB2_OP_DELETE:
if (rc)
trace_smb3_delete_err(xid, ses->Suid, tcon->tid, rc);
else
trace_smb3_delete_done(xid, ses->Suid, tcon->tid);
trace_smb3_delete_err(xid, tcon->tid, ses->Suid, rc);
break;
case SMB2_OP_MKDIR:
if (rc)
trace_smb3_mkdir_err(xid, ses->Suid, tcon->tid, rc);
trace_smb3_mkdir_err(xid, tcon->tid, ses->Suid, rc);
else
trace_smb3_mkdir_done(xid, ses->Suid, tcon->tid);
trace_smb3_mkdir_done(xid, tcon->tid, ses->Suid);
break;
case SMB2_OP_HARDLINK:
if (rc)
trace_smb3_hardlink_err(xid, ses->Suid, tcon->tid, rc);
trace_smb3_hardlink_err(xid, tcon->tid, ses->Suid, rc);
else
trace_smb3_hardlink_done(xid, ses->Suid, tcon->tid);
trace_smb3_hardlink_done(xid, tcon->tid, ses->Suid);
SMB2_set_info_free(&rqst[num_rqst++]);
break;
case SMB2_OP_RENAME:
if (rc)
trace_smb3_rename_err(xid, ses->Suid, tcon->tid, rc);
trace_smb3_rename_err(xid, tcon->tid, ses->Suid, rc);
else
trace_smb3_rename_done(xid, ses->Suid, tcon->tid);
trace_smb3_rename_done(xid, tcon->tid, ses->Suid);
SMB2_set_info_free(&rqst[num_rqst++]);
break;
case SMB2_OP_RMDIR:
if (rc)
trace_smb3_rmdir_err(xid, ses->Suid, tcon->tid, rc);
trace_smb3_rmdir_err(xid, tcon->tid, ses->Suid, rc);
else
trace_smb3_rmdir_done(xid, ses->Suid, tcon->tid);
trace_smb3_rmdir_done(xid, tcon->tid, ses->Suid);
SMB2_set_info_free(&rqst[num_rqst++]);
break;
case SMB2_OP_SET_EOF:
if (rc)
trace_smb3_set_eof_err(xid, ses->Suid, tcon->tid, rc);
trace_smb3_set_eof_err(xid, tcon->tid, ses->Suid, rc);
else
trace_smb3_set_eof_done(xid, ses->Suid, tcon->tid);
trace_smb3_set_eof_done(xid, tcon->tid, ses->Suid);
SMB2_set_info_free(&rqst[num_rqst++]);
break;
case SMB2_OP_SET_INFO:
if (rc)
trace_smb3_set_info_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_set_info_compound_err(xid, tcon->tid,
ses->Suid, rc);
else
trace_smb3_set_info_compound_done(xid, ses->Suid,
tcon->tid);
trace_smb3_set_info_compound_done(xid, tcon->tid,
ses->Suid);
SMB2_set_info_free(&rqst[num_rqst++]);
break;
case SMB2_OP_SET_REPARSE:
if (rc) {
trace_smb3_set_reparse_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_set_reparse_compound_err(xid, tcon->tid,
ses->Suid, rc);
} else {
trace_smb3_set_reparse_compound_done(xid, ses->Suid,
tcon->tid);
trace_smb3_set_reparse_compound_done(xid, tcon->tid,
ses->Suid);
}
SMB2_ioctl_free(&rqst[num_rqst++]);
break;
@@ -616,18 +614,18 @@ finished:
rbuf = reparse_buf_ptr(iov);
if (IS_ERR(rbuf)) {
rc = PTR_ERR(rbuf);
trace_smb3_set_reparse_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_get_reparse_compound_err(xid, tcon->tid,
ses->Suid, rc);
} else {
idata->reparse.tag = le32_to_cpu(rbuf->ReparseTag);
trace_smb3_set_reparse_compound_done(xid, ses->Suid,
tcon->tid);
trace_smb3_get_reparse_compound_done(xid, tcon->tid,
ses->Suid);
}
memset(iov, 0, sizeof(*iov));
resp_buftype[i + 1] = CIFS_NO_BUFFER;
} else {
trace_smb3_set_reparse_compound_err(xid, ses->Suid,
tcon->tid, rc);
trace_smb3_set_reparse_compound_err(xid, tcon->tid,
ses->Suid, rc);
}
SMB2_ioctl_free(&rqst[num_rqst++]);
break;