Lines Matching full:tcon
70 struct cifs_tcon *tcon; member
151 struct cifs_tcon *tcon = container_of(work, in smb2_query_server_interfaces() local
158 rc = SMB3_request_interfaces(0, tcon, false); in smb2_query_server_interfaces()
164 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in smb2_query_server_interfaces()
245 struct cifs_tcon *tcon; in cifs_mark_tcp_ses_conns_for_reconnect() local
272 /* If all channels need reconnect, then tcon needs reconnect */ in cifs_mark_tcp_ses_conns_for_reconnect()
278 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_mark_tcp_ses_conns_for_reconnect()
279 tcon->need_reconnect = true; in cifs_mark_tcp_ses_conns_for_reconnect()
280 tcon->status = TID_NEED_RECON; in cifs_mark_tcp_ses_conns_for_reconnect()
376 * the smb session (and tcon) for reconnect as well. This value
535 * process waiting for reconnect will know it needs to re-establish session and tcon in reconnect_dfs_server()
1822 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1828 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1834 struct cifs_tcon *tcon; in cifs_setup_ipc() local
1853 tcon = tconInfoAlloc(); in cifs_setup_ipc()
1854 if (tcon == NULL) in cifs_setup_ipc()
1860 tcon->ses = ses; in cifs_setup_ipc()
1861 tcon->ipc = true; in cifs_setup_ipc()
1862 tcon->seal = seal; in cifs_setup_ipc()
1863 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
1868 tconInfoFree(tcon); in cifs_setup_ipc()
1872 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid); in cifs_setup_ipc()
1874 ses->tcon_ipc = tcon; in cifs_setup_ipc()
1880 * cifs_free_ipc - helper to release the session IPC tcon
1894 struct cifs_tcon *tcon = ses->tcon_ipc; in cifs_free_ipc() local
1896 if (tcon == NULL) in cifs_free_ipc()
1899 tconInfoFree(tcon); in cifs_free_ipc()
2294 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2296 if (tcon->status == TID_EXITING) in match_tcon()
2298 if (strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) in match_tcon()
2300 if (tcon->seal != ctx->seal) in match_tcon()
2302 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2304 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2306 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2308 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2316 struct cifs_tcon *tcon; in cifs_find_tcon() local
2319 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_find_tcon()
2320 spin_lock(&tcon->tc_lock); in cifs_find_tcon()
2321 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2322 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2325 ++tcon->tc_count; in cifs_find_tcon()
2326 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2328 return tcon; in cifs_find_tcon()
2335 cifs_put_tcon(struct cifs_tcon *tcon) in cifs_put_tcon() argument
2341 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
2344 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
2347 ses = tcon->ses; in cifs_put_tcon()
2348 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
2350 spin_lock(&tcon->tc_lock); in cifs_put_tcon()
2351 if (--tcon->tc_count > 0) { in cifs_put_tcon()
2352 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2358 WARN_ON(tcon->tc_count < 0); in cifs_put_tcon()
2360 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
2361 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2365 cancel_delayed_work_sync(&tcon->query_interfaces); in cifs_put_tcon()
2367 if (tcon->use_witness) { in cifs_put_tcon()
2370 rc = cifs_swn_unregister(tcon); in cifs_put_tcon()
2379 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2382 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
2383 tconInfoFree(tcon); in cifs_put_tcon()
2388 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2392 * - tcon refcount is the number of mount points using the tcon.
2393 * - ses refcount is the number of tcon using the session.
2401 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2402 * its session refcount incremented (1 new tcon). This +1 was
2405 * b) an existing tcon with refcount+1 (add a mount point to it) and
2406 * identical ses refcount (no new tcon). Because of (1) we need to
2413 struct cifs_tcon *tcon; in cifs_get_tcon() local
2415 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2416 if (tcon) { in cifs_get_tcon()
2418 * tcon has refcount already incremented but we need to in cifs_get_tcon()
2423 return tcon; in cifs_get_tcon()
2431 tcon = tconInfoAlloc(); in cifs_get_tcon()
2432 if (tcon == NULL) { in cifs_get_tcon()
2444 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2454 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2457 tcon->ses = ses; in cifs_get_tcon()
2459 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2460 if (!tcon->password) { in cifs_get_tcon()
2472 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
2474 tcon->seal = true; in cifs_get_tcon()
2484 tcon->posix_extensions = true; in cifs_get_tcon()
2503 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2506 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
2510 tcon->use_persistent = false; in cifs_get_tcon()
2520 tcon->use_persistent = true; in cifs_get_tcon()
2527 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
2531 tcon->use_persistent = true; in cifs_get_tcon()
2539 tcon->use_resilient = true; in cifs_get_tcon()
2542 tcon->use_witness = false; in cifs_get_tcon()
2545 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) { in cifs_get_tcon()
2550 tcon->use_witness = true; in cifs_get_tcon()
2552 rc = cifs_swn_register(tcon); in cifs_get_tcon()
2571 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
2585 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2593 tcon->retry = ctx->retry; in cifs_get_tcon()
2594 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2595 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2597 tcon->nohandlecache = ctx->nohandlecache; in cifs_get_tcon()
2599 tcon->nohandlecache = true; in cifs_get_tcon()
2600 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2601 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2602 INIT_LIST_HEAD(&tcon->pending_opens); in cifs_get_tcon()
2605 INIT_DELAYED_WORK(&tcon->query_interfaces, in cifs_get_tcon()
2607 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in cifs_get_tcon()
2611 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2614 return tcon; in cifs_get_tcon()
2617 tconInfoFree(tcon); in cifs_get_tcon()
2713 struct cifs_tcon *tcon; in cifs_match_super() local
2725 tcon = tlink_tcon(tlink); in cifs_match_super()
2726 ses = tcon->ses; in cifs_match_super()
2733 spin_lock(&tcon->tc_lock); in cifs_match_super()
2736 !match_tcon(tcon, ctx) || in cifs_match_super()
2744 spin_unlock(&tcon->tc_lock); in cifs_match_super()
3033 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3041 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3047 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3050 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3051 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3055 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3057 if (!tcon->unix_ext) { in reset_cifs_unix_caps()
3062 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3063 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3129 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
3197 if (mnt_ctx->tcon) in mount_put_conns()
3198 cifs_put_tcon(mnt_ctx->tcon); in mount_put_conns()
3207 /* Get connections for tcp, ses and tcon */
3213 struct cifs_tcon *tcon = NULL; in mount_get_conns() local
3243 /* search for existing tcon to this server share */ in mount_get_conns()
3244 tcon = cifs_get_tcon(ses, ctx); in mount_get_conns()
3245 if (IS_ERR(tcon)) { in mount_get_conns()
3246 rc = PTR_ERR(tcon); in mount_get_conns()
3247 tcon = NULL; in mount_get_conns()
3252 if (tcon->posix_extensions) in mount_get_conns()
3257 if (cap_unix(tcon->ses)) { in mount_get_conns()
3262 reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx); in mount_get_conns()
3263 spin_lock(&tcon->ses->server->srv_lock); in mount_get_conns()
3264 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in mount_get_conns()
3265 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in mount_get_conns()
3267 spin_unlock(&tcon->ses->server->srv_lock); in mount_get_conns()
3271 spin_unlock(&tcon->ses->server->srv_lock); in mount_get_conns()
3274 tcon->unix_ext = 0; /* server does not support them */ in mount_get_conns()
3277 if (!tcon->pipe && server->ops->qfs_tcon) { in mount_get_conns()
3278 server->ops->qfs_tcon(xid, tcon, cifs_sb); in mount_get_conns()
3280 if (tcon->fsDevInfo.DeviceCharacteristics & in mount_get_conns()
3296 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) in mount_get_conns()
3297 cifs_sb->ctx->wsize = server->ops->negotiate_wsize(tcon, ctx); in mount_get_conns()
3299 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) in mount_get_conns()
3300 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); in mount_get_conns()
3308 cifs_fscache_get_super_cookie(tcon); in mount_get_conns()
3313 mnt_ctx->tcon = tcon; in mount_get_conns()
3320 struct cifs_tcon *tcon) in mount_setup_tlink() argument
3324 /* hang the tcon off of the superblock */ in mount_setup_tlink()
3330 tlink->tl_tcon = tcon; in mount_setup_tlink()
3364 * existing connection (tcon)
3488 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
3501 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
3525 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
3543 struct cifs_tcon *tcon = mnt_ctx->tcon; in is_path_remote() local
3554 * cifs_build_path_to_root works only when we have a valid tcon in is_path_remote()
3556 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in is_path_remote()
3557 tcon->Flags & SMB_SHARE_IS_IN_DFS); in is_path_remote()
3563 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in is_path_remote()
3574 if (rc == -ENOENT && is_tcon_dfs(tcon)) in is_path_remote()
3575 rc = cifs_dfs_query_info_nonascii_quirk(xid, tcon, cifs_sb, in is_path_remote()
3582 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in is_path_remote()
3583 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in is_path_remote()
3664 if (cifs_is_referral_server(mnt_ctx->tcon, &ref)) in connect_dfs_target()
3859 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3883 if (mnt_ctx.tcon) { in cifs_mount()
3891 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3909 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
3982 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
3997 tcon->ipc = true; in CIFSTCon()
3998 tcon->pipe = true; in CIFSTCon()
4008 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); in CIFSTCon()
4011 kfree(tcon->nativeFileSystem); in CIFSTCon()
4012 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
4016 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
4021 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
4023 tcon->Flags = 0; in CIFSTCon()
4024 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
4206 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
4234 tcon = ERR_PTR(rc); in cifs_construct_tcon()
4245 tcon = (struct cifs_tcon *)ses; in cifs_construct_tcon()
4250 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4251 if (IS_ERR(tcon)) { in cifs_construct_tcon()
4258 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4266 return tcon; in cifs_construct_tcon()
4317 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4321 * the master tcon for the mount.
4323 * First, search the rbtree for an existing tcon for this fsuid. If one
4516 static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tcon, in __tree_connect_dfs_target() argument
4521 struct TCP_Server_Info *server = tcon->ses->server; in __tree_connect_dfs_target()
4523 struct cifs_tcon *ipc = tcon->ses->tcon_ipc; in __tree_connect_dfs_target()
4572 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, cifs_sb->local_nls); in __tree_connect_dfs_target()
4581 if (dfs_cache_find(xid, tcon->ses, cifs_sb->local_nls, cifs_remap(cifs_sb), target, in __tree_connect_dfs_target()
4583 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, cifs_sb->local_nls); in __tree_connect_dfs_target()
4610 static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tcon, in tree_connect_dfs_target() argument
4616 struct TCP_Server_Info *server = tcon->ses->server; in tree_connect_dfs_target()
4619 rc = __tree_connect_dfs_target(xid, tcon, cifs_sb, tree, islink, tl); in tree_connect_dfs_target()
4636 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc) in cifs_tree_connect() argument
4639 struct TCP_Server_Info *server = tcon->ses->server; in cifs_tree_connect()
4648 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4649 if (tcon->ses->ses_status != SES_GOOD || in cifs_tree_connect()
4650 (tcon->status != TID_NEW && in cifs_tree_connect()
4651 tcon->status != TID_NEED_TCON)) { in cifs_tree_connect()
4652 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4655 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4656 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4664 if (tcon->ipc) { in cifs_tree_connect()
4666 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc); in cifs_tree_connect()
4682 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, cifs_sb->local_nls); in cifs_tree_connect()
4686 rc = tree_connect_dfs_target(xid, tcon, cifs_sb, tree, ref.server_type == DFS_TYPE_LINK, in cifs_tree_connect()
4695 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4696 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4697 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4698 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4700 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4701 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4702 tcon->status = TID_GOOD; in cifs_tree_connect()
4703 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4704 tcon->need_reconnect = false; in cifs_tree_connect()
4710 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc) in cifs_tree_connect() argument
4713 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
4716 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4717 if (tcon->ses->ses_status != SES_GOOD || in cifs_tree_connect()
4718 (tcon->status != TID_NEW && in cifs_tree_connect()
4719 tcon->status != TID_NEED_TCON)) { in cifs_tree_connect()
4720 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4723 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4724 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4726 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc); in cifs_tree_connect()
4728 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4729 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4730 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4731 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4733 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4734 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4735 tcon->status = TID_GOOD; in cifs_tree_connect()
4736 tcon->need_reconnect = false; in cifs_tree_connect()
4737 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()