Skip to content

Commit 68e1456

Browse files
committed
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) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0350d7a commit 68e1456

File tree

15 files changed

+46
-38
lines changed

15 files changed

+46
-38
lines changed

fs/cifs/cached_dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
160160
if (rc == -EREMCHG) {
161161
tcon->need_reconnect = true;
162162
pr_warn_once("server share %s deleted\n",
163-
tcon->treeName);
163+
tcon->tree_name);
164164
}
165165
goto oshr_exit;
166166
}

fs/cifs/cifs_debug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
8787
{
8888
__u32 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
8989

90-
seq_printf(m, "%s Mounts: %d ", tcon->treeName, tcon->tc_count);
90+
seq_printf(m, "%s Mounts: %d ", tcon->tree_name, tcon->tc_count);
9191
if (tcon->nativeFileSystem)
9292
seq_printf(m, "Type: %s ", tcon->nativeFileSystem);
9393
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)
601601
list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
602602
list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
603603
i++;
604-
seq_printf(m, "\n%d) %s", i, tcon->treeName);
604+
seq_printf(m, "\n%d) %s", i, tcon->tree_name);
605605
if (tcon->need_reconnect)
606606
seq_puts(m, "\tDISCONNECTED ");
607607
seq_printf(m, "\nSMBs: %d",

fs/cifs/cifs_debug.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ do { \
108108
#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \
109109
do { \
110110
const char *tn = ""; \
111-
if (tcon && tcon->treeName) \
112-
tn = tcon->treeName; \
111+
if (tcon && tcon->tree_name) \
112+
tn = tcon->tree_name; \
113113
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
114114
pr_debug_ ## ratefunc("%s: %s " fmt, \
115115
__FILE__, tn, ##__VA_ARGS__); \
@@ -150,7 +150,7 @@ do { \
150150
#define cifs_tcon_dbg(type, fmt, ...) \
151151
do { \
152152
if (0) \
153-
pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__); \
153+
pr_debug("%s " fmt, tcon->tree_name, ##__VA_ARGS__); \
154154
} while (0)
155155

156156
#define cifs_info(fmt, ...) \

fs/cifs/cifs_swn.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,23 @@ static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
256256
const char *share_name;
257257
const char *net_name;
258258

259-
net_name = extract_hostname(tcon->treeName);
259+
net_name = extract_hostname(tcon->tree_name);
260260
if (IS_ERR(net_name)) {
261261
int ret;
262262

263263
ret = PTR_ERR(net_name);
264264
cifs_dbg(VFS, "%s: failed to extract host name from target '%s': %d\n",
265-
__func__, tcon->treeName, ret);
265+
__func__, tcon->tree_name, ret);
266266
return ERR_PTR(-EINVAL);
267267
}
268268

269-
share_name = extract_sharename(tcon->treeName);
269+
share_name = extract_sharename(tcon->tree_name);
270270
if (IS_ERR(share_name)) {
271271
int ret;
272272

273273
ret = PTR_ERR(share_name);
274274
cifs_dbg(VFS, "%s: failed to extract share name from target '%s': %d\n",
275-
__func__, tcon->treeName, ret);
275+
__func__, tcon->tree_name, ret);
276276
kfree(net_name);
277277
return ERR_PTR(-EINVAL);
278278
}
@@ -335,14 +335,14 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
335335
goto fail;
336336
}
337337

338-
reg->net_name = extract_hostname(tcon->treeName);
338+
reg->net_name = extract_hostname(tcon->tree_name);
339339
if (IS_ERR(reg->net_name)) {
340340
ret = PTR_ERR(reg->net_name);
341341
cifs_dbg(VFS, "%s: failed to extract host name from target: %d\n", __func__, ret);
342342
goto fail_idr;
343343
}
344344

345-
reg->share_name = extract_sharename(tcon->treeName);
345+
reg->share_name = extract_sharename(tcon->tree_name);
346346
if (IS_ERR(reg->share_name)) {
347347
ret = PTR_ERR(reg->share_name);
348348
cifs_dbg(VFS, "%s: failed to extract share name from target: %d\n", __func__, ret);

fs/cifs/cifsglob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ struct cifs_tcon {
11491149
struct list_head openFileList;
11501150
spinlock_t open_file_lock; /* protects list above */
11511151
struct cifs_ses *ses; /* pointer to session associated with */
1152-
char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
1152+
char tree_name[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
11531153
char *nativeFileSystem;
11541154
char *password; /* for share-level security */
11551155
__u32 tid; /* The 4 byte tree id */

fs/cifs/connect.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,8 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
19401940
spin_unlock(&ses->ses_lock);
19411941

19421942
cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count);
1943-
cifs_dbg(FYI, "%s: ses ipc: %s\n", __func__, ses->tcon_ipc ? ses->tcon_ipc->treeName : "NONE");
1943+
cifs_dbg(FYI,
1944+
"%s: ses ipc: %s\n", __func__, ses->tcon_ipc ? ses->tcon_ipc->tree_name : "NONE");
19441945

19451946
spin_lock(&cifs_tcp_ses_lock);
19461947
if (--ses->ses_count > 0) {
@@ -2293,7 +2294,7 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
22932294
{
22942295
if (tcon->status == TID_EXITING)
22952296
return 0;
2296-
if (strncmp(tcon->treeName, ctx->UNC, MAX_TREE_SIZE))
2297+
if (strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE))
22972298
return 0;
22982299
if (tcon->seal != ctx->seal)
22992300
return 0;
@@ -3989,7 +3990,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
39893990
}
39903991
bcc_ptr += length + 1;
39913992
bytes_left -= (length + 1);
3992-
strscpy(tcon->treeName, tree, sizeof(tcon->treeName));
3993+
strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
39933994

39943995
/* mostly informational -- no need to fail on error here */
39953996
kfree(tcon->nativeFileSystem);
@@ -4197,7 +4198,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
41974198
ctx->local_nls = cifs_sb->local_nls;
41984199
ctx->linux_uid = fsuid;
41994200
ctx->cred_uid = fsuid;
4200-
ctx->UNC = master_tcon->treeName;
4201+
ctx->UNC = master_tcon->tree_name;
42014202
ctx->retry = master_tcon->retry;
42024203
ctx->nocase = master_tcon->nocase;
42034204
ctx->nohandlecache = master_tcon->nohandlecache;
@@ -4663,7 +4664,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
46634664
/* If it is not dfs or there was no cached dfs referral, then reconnect to same share */
46644665
if (!server->current_fullpath ||
46654666
dfs_cache_noreq_find(server->current_fullpath + 1, &ref, &tl)) {
4666-
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, cifs_sb->local_nls);
4667+
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, cifs_sb->local_nls);
46674668
goto out;
46684669
}
46694670

@@ -4707,7 +4708,7 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
47074708
tcon->status = TID_IN_TCON;
47084709
spin_unlock(&tcon->tc_lock);
47094710

4710-
rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
4711+
rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
47114712
if (rc) {
47124713
spin_lock(&tcon->tc_lock);
47134714
if (tcon->status == TID_IN_TCON)

fs/cifs/dfs_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static struct cifs_ses *find_ipc_from_server_path(struct cifs_ses **ses, const c
9898

9999
get_ipc_unc(path, unc, sizeof(unc));
100100
for (; *ses; ses++) {
101-
if (!strcasecmp(unc, (*ses)->tcon_ipc->treeName))
101+
if (!strcasecmp(unc, (*ses)->tcon_ipc->tree_name))
102102
return *ses;
103103
}
104104
return ERR_PTR(-ENOENT);

fs/cifs/dir.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cifs_build_path_to_root(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_s
5050
}
5151

5252
if (add_treename)
53-
dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
53+
dfsplen = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1);
5454
else
5555
dfsplen = 0;
5656

@@ -59,7 +59,7 @@ cifs_build_path_to_root(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_s
5959
return full_path;
6060

6161
if (dfsplen)
62-
memcpy(full_path, tcon->treeName, dfsplen);
62+
memcpy(full_path, tcon->tree_name, dfsplen);
6363
full_path[dfsplen] = CIFS_DIR_SEP(cifs_sb);
6464
memcpy(full_path + dfsplen + 1, ctx->prepath, pplen);
6565
convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
@@ -93,7 +93,7 @@ build_path_from_dentry_optional_prefix(struct dentry *direntry, void *page,
9393
return ERR_PTR(-ENOMEM);
9494

9595
if (prefix)
96-
dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
96+
dfsplen = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1);
9797
else
9898
dfsplen = 0;
9999

@@ -123,7 +123,7 @@ build_path_from_dentry_optional_prefix(struct dentry *direntry, void *page,
123123
}
124124
if (dfsplen) {
125125
s -= dfsplen;
126-
memcpy(s, tcon->treeName, dfsplen);
126+
memcpy(s, tcon->tree_name, dfsplen);
127127
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
128128
int i;
129129
for (i = 0; i < dfsplen; i++) {

fs/cifs/fscache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
4545

4646
memset(&key, 0, sizeof(key));
4747

48-
sharename = extract_sharename(tcon->treeName);
48+
sharename = extract_sharename(tcon->tree_name);
4949
if (IS_ERR(sharename)) {
5050
cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__);
5151
return -EINVAL;

fs/cifs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ cifs_set_fattr_ino(int xid,
913913
} else {
914914
/* make an ino by hashing the UNC */
915915
fattr->cf_flags |= CIFS_FATTR_FAKE_ROOT_INO;
916-
fattr->cf_uniqueid = simple_hashstr(tcon->treeName);
916+
fattr->cf_uniqueid = simple_hashstr(tcon->tree_name);
917917
}
918918
}
919919
}

0 commit comments

Comments
 (0)