forked from Minki/linux
smb3: add dynamic trace points for tree disconnect
Needed this for debugging a failing xfstest. Also change camel case for "treeName" to "tree_name" in tcon struct. Example trace output (from "trace-cmd record -e smb3_tdis*"): umount-9718 [006] ..... 5909.780244: smb3_tdis_enter: xid=206 sid=0xcf38894e tid=0x3d0b8cf8 path=\\localhost\test umount-9718 [007] ..... 5909.780878: smb3_tdis_done: xid=206 sid=0xcf38894e tid=0x3d0b8cf8 Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
0350d7a39c
commit
68e14569d7
@ -160,7 +160,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
|
||||
if (rc == -EREMCHG) {
|
||||
tcon->need_reconnect = true;
|
||||
pr_warn_once("server share %s deleted\n",
|
||||
tcon->treeName);
|
||||
tcon->tree_name);
|
||||
}
|
||||
goto oshr_exit;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
|
||||
{
|
||||
__u32 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
|
||||
|
||||
seq_printf(m, "%s Mounts: %d ", tcon->treeName, tcon->tc_count);
|
||||
seq_printf(m, "%s Mounts: %d ", tcon->tree_name, tcon->tc_count);
|
||||
if (tcon->nativeFileSystem)
|
||||
seq_printf(m, "Type: %s ", tcon->nativeFileSystem);
|
||||
seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d Status: %d",
|
||||
@ -601,7 +601,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
|
||||
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
|
||||
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
|
||||
i++;
|
||||
seq_printf(m, "\n%d) %s", i, tcon->treeName);
|
||||
seq_printf(m, "\n%d) %s", i, tcon->tree_name);
|
||||
if (tcon->need_reconnect)
|
||||
seq_puts(m, "\tDISCONNECTED ");
|
||||
seq_printf(m, "\nSMBs: %d",
|
||||
|
@ -108,8 +108,8 @@ do { \
|
||||
#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \
|
||||
do { \
|
||||
const char *tn = ""; \
|
||||
if (tcon && tcon->treeName) \
|
||||
tn = tcon->treeName; \
|
||||
if (tcon && tcon->tree_name) \
|
||||
tn = tcon->tree_name; \
|
||||
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
|
||||
pr_debug_ ## ratefunc("%s: %s " fmt, \
|
||||
__FILE__, tn, ##__VA_ARGS__); \
|
||||
@ -150,7 +150,7 @@ do { \
|
||||
#define cifs_tcon_dbg(type, fmt, ...) \
|
||||
do { \
|
||||
if (0) \
|
||||
pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__); \
|
||||
pr_debug("%s " fmt, tcon->tree_name, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define cifs_info(fmt, ...) \
|
||||
|
@ -256,23 +256,23 @@ static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
|
||||
const char *share_name;
|
||||
const char *net_name;
|
||||
|
||||
net_name = extract_hostname(tcon->treeName);
|
||||
net_name = extract_hostname(tcon->tree_name);
|
||||
if (IS_ERR(net_name)) {
|
||||
int ret;
|
||||
|
||||
ret = PTR_ERR(net_name);
|
||||
cifs_dbg(VFS, "%s: failed to extract host name from target '%s': %d\n",
|
||||
__func__, tcon->treeName, ret);
|
||||
__func__, tcon->tree_name, ret);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
share_name = extract_sharename(tcon->treeName);
|
||||
share_name = extract_sharename(tcon->tree_name);
|
||||
if (IS_ERR(share_name)) {
|
||||
int ret;
|
||||
|
||||
ret = PTR_ERR(share_name);
|
||||
cifs_dbg(VFS, "%s: failed to extract share name from target '%s': %d\n",
|
||||
__func__, tcon->treeName, ret);
|
||||
__func__, tcon->tree_name, ret);
|
||||
kfree(net_name);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
@ -335,14 +335,14 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
reg->net_name = extract_hostname(tcon->treeName);
|
||||
reg->net_name = extract_hostname(tcon->tree_name);
|
||||
if (IS_ERR(reg->net_name)) {
|
||||
ret = PTR_ERR(reg->net_name);
|
||||
cifs_dbg(VFS, "%s: failed to extract host name from target: %d\n", __func__, ret);
|
||||
goto fail_idr;
|
||||
}
|
||||
|
||||
reg->share_name = extract_sharename(tcon->treeName);
|
||||
reg->share_name = extract_sharename(tcon->tree_name);
|
||||
if (IS_ERR(reg->share_name)) {
|
||||
ret = PTR_ERR(reg->share_name);
|
||||
cifs_dbg(VFS, "%s: failed to extract share name from target: %d\n", __func__, ret);
|
||||
|
@ -1149,7 +1149,7 @@ struct cifs_tcon {
|
||||
struct list_head openFileList;
|
||||
spinlock_t open_file_lock; /* protects list above */
|
||||
struct cifs_ses *ses; /* pointer to session associated with */
|
||||
char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
|
||||
char tree_name[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
|
||||
char *nativeFileSystem;
|
||||
char *password; /* for share-level security */
|
||||
__u32 tid; /* The 4 byte tree id */
|
||||
|
@ -1940,7 +1940,8 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
|
||||
spin_unlock(&ses->ses_lock);
|
||||
|
||||
cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count);
|
||||
cifs_dbg(FYI, "%s: ses ipc: %s\n", __func__, ses->tcon_ipc ? ses->tcon_ipc->treeName : "NONE");
|
||||
cifs_dbg(FYI,
|
||||
"%s: ses ipc: %s\n", __func__, ses->tcon_ipc ? ses->tcon_ipc->tree_name : "NONE");
|
||||
|
||||
spin_lock(&cifs_tcp_ses_lock);
|
||||
if (--ses->ses_count > 0) {
|
||||
@ -2293,7 +2294,7 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
|
||||
{
|
||||
if (tcon->status == TID_EXITING)
|
||||
return 0;
|
||||
if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE))
|
||||
if (strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE))
|
||||
return 0;
|
||||
if (tcon->seal != ctx->seal)
|
||||
return 0;
|
||||
@ -3989,7 +3990,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
|
||||
}
|
||||
bcc_ptr += length + 1;
|
||||
bytes_left -= (length + 1);
|
||||
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
|
||||
strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
|
||||
|
||||
/* mostly informational -- no need to fail on error here */
|
||||
kfree(tcon->nativeFileSystem);
|
||||
@ -4197,7 +4198,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
|
||||
ctx->local_nls = cifs_sb->local_nls;
|
||||
ctx->linux_uid = fsuid;
|
||||
ctx->cred_uid = fsuid;
|
||||
ctx->UNC = master_tcon->treeName;
|
||||
ctx->UNC = master_tcon->tree_name;
|
||||
ctx->retry = master_tcon->retry;
|
||||
ctx->nocase = master_tcon->nocase;
|
||||
ctx->nohandlecache = master_tcon->nohandlecache;
|
||||
@ -4663,7 +4664,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
|
||||
/* If it is not dfs or there was no cached dfs referral, then reconnect to same share */
|
||||
if (!server->current_fullpath ||
|
||||
dfs_cache_noreq_find(server->current_fullpath + 1, &ref, &tl)) {
|
||||
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, cifs_sb->local_nls);
|
||||
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, cifs_sb->local_nls);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -4707,7 +4708,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
|
||||
tcon->status = TID_IN_TCON;
|
||||
spin_unlock(&tcon->tc_lock);
|
||||
|
||||
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
|
||||
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
|
||||
if (rc) {
|
||||
spin_lock(&tcon->tc_lock);
|
||||
if (tcon->status == TID_IN_TCON)
|
||||
|
@ -98,7 +98,7 @@ static struct cifs_ses *find_ipc_from_server_path(struct cifs_ses **ses, const c
|
||||
|
||||
get_ipc_unc(path, unc, sizeof(unc));
|
||||
for (; *ses; ses++) {
|
||||
if (!strcasecmp(unc, (*ses)->tcon_ipc->treeName))
|
||||
if (!strcasecmp(unc, (*ses)->tcon_ipc->tree_name))
|
||||
return *ses;
|
||||
}
|
||||
return ERR_PTR(-ENOENT);
|
||||
|
@ -50,7 +50,7 @@ cifs_build_path_to_root(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_s
|
||||
}
|
||||
|
||||
if (add_treename)
|
||||
dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
|
||||
dfsplen = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1);
|
||||
else
|
||||
dfsplen = 0;
|
||||
|
||||
@ -59,7 +59,7 @@ cifs_build_path_to_root(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_s
|
||||
return full_path;
|
||||
|
||||
if (dfsplen)
|
||||
memcpy(full_path, tcon->treeName, dfsplen);
|
||||
memcpy(full_path, tcon->tree_name, dfsplen);
|
||||
full_path[dfsplen] = CIFS_DIR_SEP(cifs_sb);
|
||||
memcpy(full_path + dfsplen + 1, ctx->prepath, pplen);
|
||||
convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
|
||||
@ -93,7 +93,7 @@ build_path_from_dentry_optional_prefix(struct dentry *direntry, void *page,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
if (prefix)
|
||||
dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
|
||||
dfsplen = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1);
|
||||
else
|
||||
dfsplen = 0;
|
||||
|
||||
@ -123,7 +123,7 @@ build_path_from_dentry_optional_prefix(struct dentry *direntry, void *page,
|
||||
}
|
||||
if (dfsplen) {
|
||||
s -= dfsplen;
|
||||
memcpy(s, tcon->treeName, dfsplen);
|
||||
memcpy(s, tcon->tree_name, dfsplen);
|
||||
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
|
||||
int i;
|
||||
for (i = 0; i < dfsplen; i++) {
|
||||
|
@ -45,7 +45,7 @@ int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
sharename = extract_sharename(tcon->treeName);
|
||||
sharename = extract_sharename(tcon->tree_name);
|
||||
if (IS_ERR(sharename)) {
|
||||
cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__);
|
||||
return -EINVAL;
|
||||
|
@ -913,7 +913,7 @@ cifs_set_fattr_ino(int xid,
|
||||
} else {
|
||||
/* make an ino by hashing the UNC */
|
||||
fattr->cf_flags |= CIFS_FATTR_FAKE_ROOT_INO;
|
||||
fattr->cf_uniqueid = simple_hashstr(tcon->treeName);
|
||||
fattr->cf_uniqueid = simple_hashstr(tcon->tree_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
|
||||
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
|
||||
cifs_sb->mnt_cifs_serverino_autodisabled = true;
|
||||
cifs_dbg(VFS, "Autodisabling the use of server inode numbers on %s\n",
|
||||
tcon ? tcon->treeName : "new server");
|
||||
tcon ? tcon->tree_name : "new server");
|
||||
cifs_dbg(VFS, "The server doesn't seem to support them properly or the files might be on different servers (DFS)\n");
|
||||
cifs_dbg(VFS, "Hardlinks will not be recognized on this mount. Consider mounting with the \"noserverino\" option to silence this message.\n");
|
||||
|
||||
@ -1328,7 +1328,7 @@ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,
|
||||
char *treename, *dfspath, sep;
|
||||
int treenamelen, linkpathlen, rc;
|
||||
|
||||
treename = tcon->treeName;
|
||||
treename = tcon->tree_name;
|
||||
/* MS-DFSC: All paths in REQ_GET_DFS_REFERRAL and RESP_GET_DFS_REFERRAL
|
||||
* messages MUST be encoded with exactly one leading backslash, not two
|
||||
* leading backslashes.
|
||||
|
@ -379,7 +379,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
|
||||
SMB2_open_free(&rqst[0]);
|
||||
if (rc == -EREMCHG) {
|
||||
pr_warn_once("server share %s deleted\n", tcon->treeName);
|
||||
pr_warn_once("server share %s deleted\n", tcon->tree_name);
|
||||
tcon->need_reconnect = true;
|
||||
}
|
||||
|
||||
|
@ -1327,7 +1327,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
CIFSMaxBufSize, (char **)&res_key, &ret_data_len);
|
||||
|
||||
if (rc == -EOPNOTSUPP) {
|
||||
pr_warn_once("Server share %s does not support copy range\n", tcon->treeName);
|
||||
pr_warn_once("Server share %s does not support copy range\n", tcon->tree_name);
|
||||
goto req_res_key_exit;
|
||||
} else if (rc) {
|
||||
cifs_tcon_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc);
|
||||
@ -2289,7 +2289,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
|
||||
spin_unlock(&tcon->tc_lock);
|
||||
spin_unlock(&cifs_tcp_ses_lock);
|
||||
pr_warn_once("Server share %s deleted.\n",
|
||||
tcon->treeName);
|
||||
tcon->tree_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2498,7 +2498,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
if (rc == -EREMCHG) {
|
||||
tcon->need_reconnect = true;
|
||||
pr_warn_once("server share %s deleted\n",
|
||||
tcon->treeName);
|
||||
tcon->tree_name);
|
||||
}
|
||||
goto qic_exit;
|
||||
}
|
||||
|
@ -1930,7 +1930,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
|
||||
tcon->capabilities = rsp->Capabilities; /* we keep caps little endian */
|
||||
tcon->maximal_access = le32_to_cpu(rsp->MaximalAccess);
|
||||
tcon->tid = le32_to_cpu(rsp->hdr.Id.SyncId.TreeId);
|
||||
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
|
||||
strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
|
||||
|
||||
if ((rsp->Capabilities & SMB2_SHARE_CAP_DFS) &&
|
||||
((tcon->share_flags & SHI1005_FLAGS_DFS) == 0))
|
||||
@ -1973,6 +1973,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
|
||||
if (!ses || !(ses->server))
|
||||
return -EIO;
|
||||
|
||||
trace_smb3_tdis_enter(xid, tcon->tid, ses->Suid, tcon->tree_name);
|
||||
spin_lock(&ses->chan_lock);
|
||||
if ((tcon->need_reconnect) ||
|
||||
(CIFS_ALL_CHANS_NEED_RECONNECT(tcon->ses))) {
|
||||
@ -2004,8 +2005,11 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
|
||||
rc = cifs_send_recv(xid, ses, ses->server,
|
||||
&rqst, &resp_buf_type, flags, &rsp_iov);
|
||||
cifs_small_buf_release(req);
|
||||
if (rc)
|
||||
if (rc) {
|
||||
cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE);
|
||||
trace_smb3_tdis_err(xid, tcon->tid, ses->Suid, rc);
|
||||
}
|
||||
trace_smb3_tdis_done(xid, tcon->tid, ses->Suid);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -2674,7 +2678,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
|
||||
req->hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;
|
||||
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
||||
&name_len,
|
||||
tcon->treeName, utf16_path);
|
||||
tcon->tree_name, utf16_path);
|
||||
if (rc)
|
||||
goto err_free_req;
|
||||
|
||||
@ -2816,7 +2820,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
|
||||
req->hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;
|
||||
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
||||
&name_len,
|
||||
tcon->treeName, path);
|
||||
tcon->tree_name, path);
|
||||
if (rc)
|
||||
return rc;
|
||||
req->NameLength = cpu_to_le16(name_len * 2);
|
||||
@ -3011,7 +3015,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
||||
oparms->create_options, oparms->desired_access, rc);
|
||||
if (rc == -EREMCHG) {
|
||||
pr_warn_once("server share %s deleted\n",
|
||||
tcon->treeName);
|
||||
tcon->tree_name);
|
||||
tcon->need_reconnect = true;
|
||||
}
|
||||
goto creat_exit;
|
||||
@ -4429,7 +4433,7 @@ smb2_writev_callback(struct mid_q_entry *mid)
|
||||
wdata->bytes, wdata->result);
|
||||
if (wdata->result == -ENOSPC)
|
||||
pr_warn_once("Out of space writing to %s\n",
|
||||
tcon->treeName);
|
||||
tcon->tree_name);
|
||||
} else
|
||||
trace_smb3_write_done(0 /* no xid */,
|
||||
wdata->cfile->fid.persistent_fid,
|
||||
|
@ -372,6 +372,7 @@ DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
|
||||
DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
|
||||
DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
|
||||
DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
|
||||
DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter);
|
||||
|
||||
|
||||
DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
|
||||
@ -409,6 +410,7 @@ DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
|
||||
DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
|
||||
DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
|
||||
DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
|
||||
DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done);
|
||||
|
||||
|
||||
DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
|
||||
@ -451,6 +453,7 @@ DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
|
||||
DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
|
||||
DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
|
||||
DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
|
||||
DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err);
|
||||
|
||||
/*
|
||||
* For logging SMB3 Status code and Command for responses which return errors
|
||||
|
Loading…
Reference in New Issue
Block a user