Lines Matching defs:tcon

395 	struct cifs_tcon *tcon;
460 tcon = list_entry(tmp2, struct cifs_tcon, tcon_list);
461 tcon->need_reconnect = true;
2722 * cifs_setup_ipc - helper to setup the IPC tcon for the session
2725 * tcon_ipc. The IPC tcon has the same lifetime as the session.
2731 struct cifs_tcon *tcon;
2751 tcon = tconInfoAlloc();
2752 if (tcon == NULL)
2761 tcon->ses = ses;
2762 tcon->ipc = true;
2763 tcon->seal = seal;
2764 rc = server->ops->tree_connect(xid, ses, unc, tcon, nls_codepage);
2769 tconInfoFree(tcon);
2773 cifs_dbg(FYI, "IPC tcon rc = %d ipc tid = %d\n", rc, tcon->tid);
2775 ses->tcon_ipc = tcon;
2782 * cifs_free_ipc - helper to release the session IPC tcon
2790 struct cifs_tcon *tcon = ses->tcon_ipc;
2792 if (tcon == NULL)
2797 rc = ses->server->ops->tree_disconnect(xid, tcon);
2802 cifs_dbg(FYI, "failed to disconnect IPC tcon (rc=%d)\n", rc);
2804 tconInfoFree(tcon);
3157 static int match_tcon(struct cifs_tcon *tcon, struct smb_vol *volume_info)
3159 if (tcon->tidStatus == CifsExiting)
3161 if (strncmp(tcon->treeName, volume_info->UNC, MAX_TREE_SIZE))
3163 if (tcon->seal != volume_info->seal)
3165 if (tcon->snapshot_time != volume_info->snapshot_time)
3167 if (tcon->handle_timeout != volume_info->handle_timeout)
3169 if (tcon->no_lease != volume_info->no_lease)
3171 if (tcon->nodelete != volume_info->nodelete)
3180 struct cifs_tcon *tcon;
3184 tcon = list_entry(tmp, struct cifs_tcon, tcon_list);
3186 if (tcon->dfs_path)
3189 if (!match_tcon(tcon, volume_info))
3191 ++tcon->tc_count;
3193 return tcon;
3200 cifs_put_tcon(struct cifs_tcon *tcon)
3206 * IPC tcon share the lifetime of their session and are
3209 if (tcon == NULL || tcon->ipc)
3212 ses = tcon->ses;
3213 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
3215 if (--tcon->tc_count > 0) {
3220 list_del_init(&tcon->tcon_list);
3225 ses->server->ops->tree_disconnect(xid, tcon);
3228 cifs_fscache_release_super_cookie(tcon);
3229 tconInfoFree(tcon);
3234 * cifs_get_tcon - get a tcon matching @volume_info data from @ses
3236 * - tcon refcount is the number of mount points using the tcon.
3237 * - ses refcount is the number of tcon using the session.
3245 * a) a new tcon already allocated with refcount=1 (1 mount point) and
3246 * its session refcount incremented (1 new tcon). This +1 was
3249 * b) an existing tcon with refcount+1 (add a mount point to it) and
3250 * identical ses refcount (no new tcon). Because of (1) we need to
3257 struct cifs_tcon *tcon;
3259 tcon = cifs_find_tcon(ses, volume_info);
3260 if (tcon) {
3262 * tcon has refcount already incremented but we need to
3267 return tcon;
3275 tcon = tconInfoAlloc();
3276 if (tcon == NULL) {
3288 tcon->snapshot_time = volume_info->snapshot_time;
3298 tcon->handle_timeout = volume_info->handle_timeout;
3301 tcon->ses = ses;
3303 tcon->password = kstrdup(volume_info->password, GFP_KERNEL);
3304 if (!tcon->password) {
3316 } else if (tcon->ses->server->capabilities &
3318 tcon->seal = true;
3328 tcon->posix_extensions = true;
3342 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon,
3349 tcon->use_persistent = false;
3359 tcon->use_persistent = true;
3366 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
3370 tcon->use_persistent = true;
3378 tcon->use_resilient = true;
3382 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
3396 tcon->no_lease = volume_info->no_lease;
3404 tcon->retry = volume_info->retry;
3405 tcon->nocase = volume_info->nocase;
3407 tcon->nohandlecache = volume_info->nohandlecache;
3409 tcon->nohandlecache = 1;
3410 tcon->nodelete = volume_info->nodelete;
3411 tcon->local_lease = volume_info->local_lease;
3412 INIT_LIST_HEAD(&tcon->pending_opens);
3415 list_add(&tcon->tcon_list, &ses->tcon_list);
3418 cifs_fscache_get_super_cookie(tcon);
3420 return tcon;
3423 tconInfoFree(tcon);
3514 struct cifs_tcon *tcon;
3526 tcon = tlink_tcon(tlink);
3527 ses = tcon->ses;
3534 !match_tcon(tcon, volume_info) ||
3818 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3825 * Perhaps we could add a backpointer to array of sb from tcon
3830 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3833 tcon->fsUnixInfo.Capability = 0;
3834 tcon->unix_ext = 0; /* Unix Extensions disabled */
3838 tcon->unix_ext = 1; /* Unix Extensions supported */
3840 if (tcon->unix_ext == 0) {
3845 if (!CIFSSMBQFSUnixInfo(xid, tcon)) {
3846 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3908 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
4064 struct cifs_ses *ses, struct cifs_tcon *tcon)
4068 if (tcon)
4069 cifs_put_tcon(tcon);
4078 /* Get connections for tcp, ses and tcon */
4087 struct cifs_tcon *tcon;
4119 /* search for existing tcon to this server share */
4120 tcon = cifs_get_tcon(ses, vol);
4121 if (IS_ERR(tcon)) {
4122 rc = PTR_ERR(tcon);
4126 *ntcon = tcon;
4129 if (tcon->posix_extensions)
4133 if (cap_unix(tcon->ses)) {
4138 reset_cifs_unix_caps(*xid, tcon, cifs_sb, vol);
4139 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
4140 (le64_to_cpu(tcon->fsUnixInfo.Capability) &
4144 tcon->unix_ext = 0; /* server does not support them */
4147 if (!tcon->pipe && server->ops->qfs_tcon) {
4148 server->ops->qfs_tcon(*xid, tcon, cifs_sb);
4150 if (tcon->fsDevInfo.DeviceCharacteristics &
4160 cifs_sb->wsize = server->ops->negotiate_wsize(tcon, vol);
4161 cifs_sb->rsize = server->ops->negotiate_rsize(tcon, vol);
4167 struct cifs_tcon *tcon)
4171 /* hang the tcon off of the superblock */
4177 tlink->tl_tcon = tcon;
4195 * exiting connection (tcon)
4321 struct cifs_tcon **tcon)
4354 mount_put_conns(cifs_sb, *xid, *server, *ses, *tcon);
4356 tcon);
4372 struct cifs_tcon **tcon)
4392 tcon);
4472 struct cifs_tcon *tcon,
4485 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, "");
4509 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
4523 struct cifs_tcon *tcon)
4532 * cifs_build_path_to_root works only when we have a valid tcon
4534 full_path = cifs_build_path_to_root(vol, cifs_sb, tcon,
4535 tcon->Flags & SMB_SHARE_IS_IN_DFS);
4541 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
4549 rc = cifs_are_all_path_components_accessible(server, xid, tcon,
4550 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS);
4585 struct cifs_tcon *tcon, char **dfs_path)
4591 int added_treename = tcon->Flags & SMB_SHARE_IS_IN_DFS;
4594 path = cifs_build_path_to_root(vol, cifs_sb, tcon, added_treename);
4623 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, path);
4659 struct cifs_tcon *tcon = NULL;
4665 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon);
4679 rc = is_path_remote(cifs_sb, vol, xid, server, tcon);
4716 mount_put_conns(cifs_sb, xid, server, ses, tcon);
4717 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon);
4722 &server, &ses, &tcon);
4726 if (!tcon)
4729 if (is_tcon_dfs(tcon)) {
4734 rc = check_dfs_prepath(cifs_sb, vol, xid, server, tcon, &ref_path);
4750 * only the root path is set in cifs_sb->origin_fullpath and tcon->dfs_path. And for DFS
4760 tcon->dfs_path = full_path;
4762 tcon->remap = cifs_remap(cifs_sb);
4787 return mount_setup_tlink(cifs_sb, ses, tcon);
4795 mount_put_conns(cifs_sb, xid, server, ses, tcon);
4804 struct cifs_tcon *tcon;
4807 rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon);
4811 if (tcon) {
4812 rc = is_path_remote(cifs_sb, vol, xid, server, tcon);
4821 return mount_setup_tlink(cifs_sb, ses, tcon);
4824 mount_put_conns(cifs_sb, xid, server, ses, tcon);
4834 const char *tree, struct cifs_tcon *tcon,
4866 if (tcon->pipe || (ses->server->sec_mode & SECMODE_USER)) {
4882 calc_lanman_hash(tcon->password, ses->server->cryptkey,
4888 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
4940 tcon->tidStatus = CifsGood;
4941 tcon->need_reconnect = false;
4942 tcon->tid = smb_buffer_response->Tid;
4957 tcon->ipc = true;
4958 tcon->pipe = true;
4968 strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
4971 kfree(tcon->nativeFileSystem);
4972 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr,
4976 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem);
4981 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
4983 tcon->Flags = 0;
4984 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
5106 struct cifs_tcon *tcon = NULL;
5133 tcon = ERR_PTR(rc);
5144 tcon = (struct cifs_tcon *)ses;
5149 tcon = cifs_get_tcon(ses, vol_info);
5150 if (IS_ERR(tcon)) {
5156 reset_cifs_unix_caps(0, tcon, NULL, vol_info);
5163 return tcon;
5214 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
5218 * the master tcon for the mount.
5220 * First, search the rbtree for an existing tcon for this fsuid. If one
5350 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
5353 struct TCP_Server_Info *server = tcon->ses->server;
5371 if (!tcon->dfs_path || dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl)) {
5372 if (tcon->ipc) {
5374 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
5376 rc = ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);
5394 rc = dfs_cache_get_tgt_share(tcon->dfs_path + 1, it, &share, &prefix);
5420 if (tcon->ipc) {
5422 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
5425 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
5428 rc = update_super_prepath(tcon, prefix);
5441 rc = dfs_cache_noreq_update_tgthint(tcon->dfs_path + 1, it);
5451 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
5453 const struct smb_version_operations *ops = tcon->ses->server->ops;
5455 return ops->tree_connect(xid, tcon->ses, tcon->treeName, tcon, nlsc);