Lines Matching full:tcon
395 struct cifs_tcon *tcon; in cifs_reconnect() local
460 tcon = list_entry(tmp2, struct cifs_tcon, tcon_list); in cifs_reconnect()
461 tcon->need_reconnect = true; in cifs_reconnect()
2704 * cifs_setup_ipc - helper to setup the IPC tcon for the session
2707 * tcon_ipc. The IPC tcon has the same lifetime as the session.
2713 struct cifs_tcon *tcon; in cifs_setup_ipc() local
2733 tcon = tconInfoAlloc(); in cifs_setup_ipc()
2734 if (tcon == NULL) in cifs_setup_ipc()
2743 tcon->ses = ses; in cifs_setup_ipc()
2744 tcon->ipc = true; in cifs_setup_ipc()
2745 tcon->seal = seal; in cifs_setup_ipc()
2746 rc = server->ops->tree_connect(xid, ses, unc, tcon, nls_codepage); in cifs_setup_ipc()
2751 tconInfoFree(tcon); in cifs_setup_ipc()
2755 cifs_dbg(FYI, "IPC tcon rc = %d ipc tid = %d\n", rc, tcon->tid); in cifs_setup_ipc()
2757 ses->tcon_ipc = tcon; in cifs_setup_ipc()
2764 * cifs_free_ipc - helper to release the session IPC tcon
2772 struct cifs_tcon *tcon = ses->tcon_ipc; in cifs_free_ipc() local
2774 if (tcon == NULL) in cifs_free_ipc()
2779 rc = ses->server->ops->tree_disconnect(xid, tcon); in cifs_free_ipc()
2784 cifs_dbg(FYI, "failed to disconnect IPC tcon (rc=%d)\n", rc); in cifs_free_ipc()
2786 tconInfoFree(tcon); in cifs_free_ipc()
3134 static int match_tcon(struct cifs_tcon *tcon, struct smb_vol *volume_info) in match_tcon() argument
3136 if (tcon->tidStatus == CifsExiting) in match_tcon()
3138 if (strncmp(tcon->treeName, volume_info->UNC, MAX_TREE_SIZE)) in match_tcon()
3140 if (tcon->seal != volume_info->seal) in match_tcon()
3142 if (tcon->snapshot_time != volume_info->snapshot_time) in match_tcon()
3144 if (tcon->handle_timeout != volume_info->handle_timeout) in match_tcon()
3146 if (tcon->no_lease != volume_info->no_lease) in match_tcon()
3148 if (tcon->nodelete != volume_info->nodelete) in match_tcon()
3157 struct cifs_tcon *tcon; in cifs_find_tcon() local
3161 tcon = list_entry(tmp, struct cifs_tcon, tcon_list); in cifs_find_tcon()
3163 if (tcon->dfs_path) in cifs_find_tcon()
3166 if (!match_tcon(tcon, volume_info)) in cifs_find_tcon()
3168 ++tcon->tc_count; in cifs_find_tcon()
3170 return tcon; in cifs_find_tcon()
3177 cifs_put_tcon(struct cifs_tcon *tcon) in cifs_put_tcon() argument
3183 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
3186 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
3189 ses = tcon->ses; in cifs_put_tcon()
3190 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
3192 if (--tcon->tc_count > 0) { in cifs_put_tcon()
3197 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
3202 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
3205 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
3206 tconInfoFree(tcon); in cifs_put_tcon()
3211 * cifs_get_tcon - get a tcon matching @volume_info data from @ses
3213 * - tcon refcount is the number of mount points using the tcon.
3214 * - ses refcount is the number of tcon using the session.
3222 * a) a new tcon already allocated with refcount=1 (1 mount point) and
3223 * its session refcount incremented (1 new tcon). This +1 was
3226 * b) an existing tcon with refcount+1 (add a mount point to it) and
3227 * identical ses refcount (no new tcon). Because of (1) we need to
3234 struct cifs_tcon *tcon; in cifs_get_tcon() local
3236 tcon = cifs_find_tcon(ses, volume_info); in cifs_get_tcon()
3237 if (tcon) { in cifs_get_tcon()
3239 * tcon has refcount already incremented but we need to in cifs_get_tcon()
3244 return tcon; in cifs_get_tcon()
3252 tcon = tconInfoAlloc(); in cifs_get_tcon()
3253 if (tcon == NULL) { in cifs_get_tcon()
3265 tcon->snapshot_time = volume_info->snapshot_time; in cifs_get_tcon()
3275 tcon->handle_timeout = volume_info->handle_timeout; in cifs_get_tcon()
3278 tcon->ses = ses; in cifs_get_tcon()
3280 tcon->password = kstrdup(volume_info->password, GFP_KERNEL); in cifs_get_tcon()
3281 if (!tcon->password) { in cifs_get_tcon()
3293 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
3295 tcon->seal = true; in cifs_get_tcon()
3305 tcon->posix_extensions = true; in cifs_get_tcon()
3315 * BB Do we need to wrap session_mutex around this TCon call and Unix in cifs_get_tcon()
3319 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, in cifs_get_tcon()
3322 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
3326 tcon->use_persistent = false; in cifs_get_tcon()
3336 tcon->use_persistent = true; in cifs_get_tcon()
3343 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
3347 tcon->use_persistent = true; in cifs_get_tcon()
3355 tcon->use_resilient = true; in cifs_get_tcon()
3359 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
3373 tcon->no_lease = volume_info->no_lease; in cifs_get_tcon()
3381 tcon->retry = volume_info->retry; in cifs_get_tcon()
3382 tcon->nocase = volume_info->nocase; in cifs_get_tcon()
3384 tcon->nohandlecache = volume_info->nohandlecache; in cifs_get_tcon()
3386 tcon->nohandlecache = 1; in cifs_get_tcon()
3387 tcon->nodelete = volume_info->nodelete; in cifs_get_tcon()
3388 tcon->local_lease = volume_info->local_lease; in cifs_get_tcon()
3389 INIT_LIST_HEAD(&tcon->pending_opens); in cifs_get_tcon()
3392 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
3395 cifs_fscache_get_super_cookie(tcon); in cifs_get_tcon()
3397 return tcon; in cifs_get_tcon()
3400 tconInfoFree(tcon); in cifs_get_tcon()
3491 struct cifs_tcon *tcon; in cifs_match_super() local
3502 tcon = tlink_tcon(tlink); in cifs_match_super()
3503 ses = tcon->ses; in cifs_match_super()
3510 !match_tcon(tcon, volume_info) || in cifs_match_super()
3794 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3801 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3806 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3809 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3810 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3814 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3816 if (tcon->unix_ext == 0) { in reset_cifs_unix_caps()
3821 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3822 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3884 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
4039 struct cifs_ses *ses, struct cifs_tcon *tcon) in mount_put_conns() argument
4043 if (tcon) in mount_put_conns()
4044 cifs_put_tcon(tcon); in mount_put_conns()
4053 /* Get connections for tcp, ses and tcon */
4062 struct cifs_tcon *tcon; in mount_get_conns() local
4099 /* search for existing tcon to this server share */ in mount_get_conns()
4100 tcon = cifs_get_tcon(ses, vol); in mount_get_conns()
4101 if (IS_ERR(tcon)) { in mount_get_conns()
4102 rc = PTR_ERR(tcon); in mount_get_conns()
4106 *ntcon = tcon; in mount_get_conns()
4109 if (tcon->posix_extensions) in mount_get_conns()
4113 if (cap_unix(tcon->ses)) { in mount_get_conns()
4118 reset_cifs_unix_caps(*xid, tcon, cifs_sb, vol); in mount_get_conns()
4119 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in mount_get_conns()
4120 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in mount_get_conns()
4124 tcon->unix_ext = 0; /* server does not support them */ in mount_get_conns()
4127 if (!tcon->pipe && server->ops->qfs_tcon) { in mount_get_conns()
4128 server->ops->qfs_tcon(*xid, tcon, cifs_sb); in mount_get_conns()
4130 if (tcon->fsDevInfo.DeviceCharacteristics & in mount_get_conns()
4140 cifs_sb->wsize = server->ops->negotiate_wsize(tcon, vol); in mount_get_conns()
4141 cifs_sb->rsize = server->ops->negotiate_rsize(tcon, vol); in mount_get_conns()
4147 struct cifs_tcon *tcon) in mount_setup_tlink() argument
4151 /* hang the tcon off of the superblock */ in mount_setup_tlink()
4157 tlink->tl_tcon = tcon; in mount_setup_tlink()
4175 * exiting connection (tcon)
4301 struct cifs_tcon **tcon) in setup_dfs_tgt_conn() argument
4334 mount_put_conns(cifs_sb, *xid, *server, *ses, *tcon); in setup_dfs_tgt_conn()
4336 tcon); in setup_dfs_tgt_conn()
4352 struct cifs_tcon **tcon) in do_dfs_failover() argument
4372 tcon); in do_dfs_failover()
4452 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
4465 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
4489 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
4503 struct cifs_tcon *tcon) in is_path_remote() argument
4512 * cifs_build_path_to_root works only when we have a valid tcon in is_path_remote()
4514 full_path = cifs_build_path_to_root(vol, cifs_sb, tcon, in is_path_remote()
4515 tcon->Flags & SMB_SHARE_IS_IN_DFS); in is_path_remote()
4521 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in is_path_remote()
4529 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in is_path_remote()
4530 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in is_path_remote()
4565 struct cifs_tcon *tcon, char **dfs_path) in check_dfs_prepath() argument
4571 int added_treename = tcon->Flags & SMB_SHARE_IS_IN_DFS; in check_dfs_prepath()
4574 path = cifs_build_path_to_root(vol, cifs_sb, tcon, added_treename); in check_dfs_prepath()
4603 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, path); in check_dfs_prepath()
4639 struct cifs_tcon *tcon = NULL; in cifs_mount() local
4645 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); in cifs_mount()
4659 rc = is_path_remote(cifs_sb, vol, xid, server, tcon); in cifs_mount()
4696 mount_put_conns(cifs_sb, xid, server, ses, tcon); in cifs_mount()
4697 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); in cifs_mount()
4702 &server, &ses, &tcon); in cifs_mount()
4706 if (!tcon) in cifs_mount()
4709 if (is_tcon_dfs(tcon)) { in cifs_mount()
4714 rc = check_dfs_prepath(cifs_sb, vol, xid, server, tcon, &ref_path); in cifs_mount()
4730 * only the root path is set in cifs_sb->origin_fullpath and tcon->dfs_path. And for DFS in cifs_mount()
4740 tcon->dfs_path = full_path; in cifs_mount()
4742 tcon->remap = cifs_remap(cifs_sb); in cifs_mount()
4767 return mount_setup_tlink(cifs_sb, ses, tcon); in cifs_mount()
4775 mount_put_conns(cifs_sb, xid, server, ses, tcon); in cifs_mount()
4784 struct cifs_tcon *tcon; in cifs_mount() local
4787 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); in cifs_mount()
4791 if (tcon) { in cifs_mount()
4792 rc = is_path_remote(cifs_sb, vol, xid, server, tcon); in cifs_mount()
4801 return mount_setup_tlink(cifs_sb, ses, tcon); in cifs_mount()
4804 mount_put_conns(cifs_sb, xid, server, ses, tcon); in cifs_mount()
4814 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
4846 if (tcon->pipe || (ses->server->sec_mode & SECMODE_USER)) { in CIFSTCon()
4862 calc_lanman_hash(tcon->password, ses->server->cryptkey, in CIFSTCon()
4868 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, in CIFSTCon()
4920 tcon->tidStatus = CifsGood; in CIFSTCon()
4921 tcon->need_reconnect = false; in CIFSTCon()
4922 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
4937 tcon->ipc = true; in CIFSTCon()
4938 tcon->pipe = true; in CIFSTCon()
4948 strlcpy(tcon->treeName, tree, sizeof(tcon->treeName)); in CIFSTCon()
4951 kfree(tcon->nativeFileSystem); in CIFSTCon()
4952 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
4956 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
4961 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
4963 tcon->Flags = 0; in CIFSTCon()
4964 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
5086 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
5113 tcon = ERR_PTR(rc); in cifs_construct_tcon()
5124 tcon = (struct cifs_tcon *)ses; in cifs_construct_tcon()
5129 tcon = cifs_get_tcon(ses, vol_info); in cifs_construct_tcon()
5130 if (IS_ERR(tcon)) { in cifs_construct_tcon()
5136 reset_cifs_unix_caps(0, tcon, NULL, vol_info); in cifs_construct_tcon()
5143 return tcon; in cifs_construct_tcon()
5194 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
5198 * the master tcon for the mount.
5200 * First, search the rbtree for an existing tcon for this fsuid. If one
5330 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc) in cifs_tree_connect() argument
5333 struct TCP_Server_Info *server = tcon->ses->server; in cifs_tree_connect()
5350 if (!tcon->dfs_path) { in cifs_tree_connect()
5351 if (tcon->ipc) { in cifs_tree_connect()
5353 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc); in cifs_tree_connect()
5355 rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc); in cifs_tree_connect()
5360 rc = dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl); in cifs_tree_connect()
5376 rc = dfs_cache_get_tgt_share(tcon->dfs_path + 1, it, &share, &prefix); in cifs_tree_connect()
5402 if (tcon->ipc) { in cifs_tree_connect()
5404 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc); in cifs_tree_connect()
5407 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc); in cifs_tree_connect()
5410 rc = update_super_prepath(tcon, prefix); in cifs_tree_connect()
5423 rc = dfs_cache_noreq_update_tgthint(tcon->dfs_path + 1, it); in cifs_tree_connect()
5433 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc) in cifs_tree_connect() argument
5435 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
5437 return ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc); in cifs_tree_connect()