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>
                if (rc == -EREMCHG) {
                        tcon->need_reconnect = true;
                        pr_warn_once("server share %s deleted\n",
-                                    tcon->treeName);
+                                    tcon->tree_name);
                }
                goto oshr_exit;
        }
 
 {
        __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",
                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",
 
 #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__);     \
 #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, ...)                                            \
 
        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);
        }
                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);
 
        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 */
 
        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) {
 {
        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;
                }
                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);
        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;
        /* 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;
        }
 
        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)
 
 
        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);
 
        }
 
        if (add_treename)
-               dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
+               dfsplen = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1);
        else
                dfsplen = 0;
 
                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));
                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;
 
        }
        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++) {
 
 
        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;
 
                } 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);
                }
        }
 }
 
                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");
 
        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.
 
 
        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;
        }
 
 
                        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);
                                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;
                        }
                }
                if (rc == -EREMCHG) {
                        tcon->need_reconnect = true;
                        pr_warn_once("server share %s deleted\n",
-                                    tcon->treeName);
+                                    tcon->tree_name);
                }
                goto qic_exit;
        }
 
        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))
        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))) {
        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;
 }
                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;
 
                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);
                                    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;
                                     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,
 
 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,
 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,
 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