Commit b6f6a7aa authored by Steve French's avatar Steve French

smb3: add dynamic trace point for session setup key expired failures

There are cases where services need to remount (or change their
credentials files) when keys have expired, but it can be helpful
to have a dynamic trace point to make it easier to notify the
service to refresh the storage account key.

Here is sample output, one from mount with bad password, one
from a reconnect where the password has been changed or expired
and reconnect fails (requiring remount with new storage account key)

       TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
          | |         |   |||||     |         |

  mount.cifs-11362  [000] .....  6000.241620: smb3_key_expired:
    rc=-13 user=testpassu conn_id=0x2 server=localhost addr=127.0.0.1:445
  kworker/4:0-8458  [004] .....  6044.892283: smb3_key_expired:
    rc=-13 user=testpassu conn_id=0x3 server=localhost addr=127.0.0.1:445
Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 6629f87b
......@@ -1562,8 +1562,14 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
cifs_small_buf_release(sess_data->iov[0].iov_base);
if (rc == 0)
sess_data->ses->expired_pwd = false;
else if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED))
else if ((rc == -EACCES) || (rc == -EKEYEXPIRED) || (rc == -EKEYREVOKED)) {
if (sess_data->ses->expired_pwd == false)
trace_smb3_key_expired(sess_data->server->hostname,
sess_data->ses->user_name,
sess_data->server->conn_id,
&sess_data->server->dstaddr, rc);
sess_data->ses->expired_pwd = true;
}
memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
......
......@@ -1281,6 +1281,46 @@ DEFINE_EVENT(smb3_connect_err_class, smb3_##name, \
DEFINE_SMB3_CONNECT_ERR_EVENT(connect_err);
DECLARE_EVENT_CLASS(smb3_sess_setup_err_class,
TP_PROTO(char *hostname, char *username, __u64 conn_id,
const struct __kernel_sockaddr_storage *dst_addr, int rc),
TP_ARGS(hostname, username, conn_id, dst_addr, rc),
TP_STRUCT__entry(
__string(hostname, hostname)
__string(username, username)
__field(__u64, conn_id)
__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
__field(int, rc)
),
TP_fast_assign(
struct sockaddr_storage *pss = NULL;
__entry->conn_id = conn_id;
__entry->rc = rc;
pss = (struct sockaddr_storage *)__entry->dst_addr;
*pss = *dst_addr;
__assign_str(hostname);
__assign_str(username);
),
TP_printk("rc=%d user=%s conn_id=0x%llx server=%s addr=%pISpsfc",
__entry->rc,
__get_str(username),
__entry->conn_id,
__get_str(hostname),
__entry->dst_addr)
)
#define DEFINE_SMB3_SES_SETUP_ERR_EVENT(name) \
DEFINE_EVENT(smb3_sess_setup_err_class, smb3_##name, \
TP_PROTO(char *hostname, \
char *username, \
__u64 conn_id, \
const struct __kernel_sockaddr_storage *addr, \
int rc), \
TP_ARGS(hostname, username, conn_id, addr, rc))
DEFINE_SMB3_SES_SETUP_ERR_EVENT(key_expired);
DECLARE_EVENT_CLASS(smb3_reconnect_class,
TP_PROTO(__u64 currmid,
__u64 conn_id,
......
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