@@ -1943,7 +1943,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx)
19431943 }
19441944
19451945 /* no need to setup directory caching on IPC share, so pass in false */
1946- tcon = tcon_info_alloc (false);
1946+ tcon = tcon_info_alloc (false, netfs_trace_tcon_ref_new_ipc );
19471947 if (tcon == NULL )
19481948 return - ENOMEM ;
19491949
@@ -1960,7 +1960,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx)
19601960
19611961 if (rc ) {
19621962 cifs_server_dbg (VFS , "failed to connect to IPC (rc=%d)\n" , rc );
1963- tconInfoFree (tcon );
1963+ tconInfoFree (tcon , netfs_trace_tcon_ref_free_ipc_fail );
19641964 goto out ;
19651965 }
19661966
@@ -2043,7 +2043,7 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
20432043 * files on session close, as specified in MS-SMB2 3.3.5.6 Receiving an
20442044 * SMB2 LOGOFF Request.
20452045 */
2046- tconInfoFree (tcon );
2046+ tconInfoFree (tcon , netfs_trace_tcon_ref_free_ipc );
20472047 if (do_logoff ) {
20482048 xid = get_xid ();
20492049 rc = server -> ops -> logoff (xid , ses );
@@ -2432,6 +2432,8 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
24322432 continue ;
24332433 }
24342434 ++ tcon -> tc_count ;
2435+ trace_smb3_tcon_ref (tcon -> debug_id , tcon -> tc_count ,
2436+ netfs_trace_tcon_ref_get_find );
24352437 spin_unlock (& tcon -> tc_lock );
24362438 spin_unlock (& cifs_tcp_ses_lock );
24372439 return tcon ;
@@ -2441,7 +2443,7 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
24412443}
24422444
24432445void
2444- cifs_put_tcon (struct cifs_tcon * tcon )
2446+ cifs_put_tcon (struct cifs_tcon * tcon , enum smb3_tcon_ref_trace trace )
24452447{
24462448 unsigned int xid ;
24472449 struct cifs_ses * ses ;
@@ -2457,6 +2459,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
24572459 cifs_dbg (FYI , "%s: tc_count=%d\n" , __func__ , tcon -> tc_count );
24582460 spin_lock (& cifs_tcp_ses_lock );
24592461 spin_lock (& tcon -> tc_lock );
2462+ trace_smb3_tcon_ref (tcon -> debug_id , tcon -> tc_count - 1 , trace );
24602463 if (-- tcon -> tc_count > 0 ) {
24612464 spin_unlock (& tcon -> tc_lock );
24622465 spin_unlock (& cifs_tcp_ses_lock );
@@ -2493,7 +2496,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
24932496 _free_xid (xid );
24942497
24952498 cifs_fscache_release_super_cookie (tcon );
2496- tconInfoFree (tcon );
2499+ tconInfoFree (tcon , netfs_trace_tcon_ref_free );
24972500 cifs_put_smb_ses (ses );
24982501}
24992502
@@ -2547,7 +2550,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
25472550 nohandlecache = ctx -> nohandlecache ;
25482551 else
25492552 nohandlecache = true;
2550- tcon = tcon_info_alloc (!nohandlecache );
2553+ tcon = tcon_info_alloc (!nohandlecache , netfs_trace_tcon_ref_new );
25512554 if (tcon == NULL ) {
25522555 rc = - ENOMEM ;
25532556 goto out_fail ;
@@ -2737,7 +2740,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
27372740 return tcon ;
27382741
27392742out_fail :
2740- tconInfoFree (tcon );
2743+ tconInfoFree (tcon , netfs_trace_tcon_ref_free_fail );
27412744 return ERR_PTR (rc );
27422745}
27432746
@@ -2754,7 +2757,7 @@ cifs_put_tlink(struct tcon_link *tlink)
27542757 }
27552758
27562759 if (!IS_ERR (tlink_tcon (tlink )))
2757- cifs_put_tcon (tlink_tcon (tlink ));
2760+ cifs_put_tcon (tlink_tcon (tlink ), netfs_trace_tcon_ref_put_tlink );
27582761 kfree (tlink );
27592762}
27602763
@@ -3319,7 +3322,7 @@ void cifs_mount_put_conns(struct cifs_mount_ctx *mnt_ctx)
33193322 int rc = 0 ;
33203323
33213324 if (mnt_ctx -> tcon )
3322- cifs_put_tcon (mnt_ctx -> tcon );
3325+ cifs_put_tcon (mnt_ctx -> tcon , netfs_trace_tcon_ref_put_mnt_ctx );
33233326 else if (mnt_ctx -> ses )
33243327 cifs_put_smb_ses (mnt_ctx -> ses );
33253328 else if (mnt_ctx -> server )
0 commit comments