Lines Matching full:tcon
104 struct cifs_tcon *tcon = container_of(work, in smb2_query_server_interfaces() local
107 struct TCP_Server_Info *server = tcon->ses->server; in smb2_query_server_interfaces()
116 rc = server->ops->query_server_interfaces(xid, tcon, false); in smb2_query_server_interfaces()
123 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in smb2_query_server_interfaces()
205 struct cifs_tcon *tcon; in cifs_mark_tcp_ses_conns_for_reconnect() local
264 /* If all channels need reconnect, then tcon needs reconnect */ in cifs_mark_tcp_ses_conns_for_reconnect()
275 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_mark_tcp_ses_conns_for_reconnect()
276 tcon->need_reconnect = true; in cifs_mark_tcp_ses_conns_for_reconnect()
277 spin_lock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
278 tcon->status = TID_NEED_RECON; in cifs_mark_tcp_ses_conns_for_reconnect()
279 spin_unlock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
281 cancel_delayed_work(&tcon->query_interfaces); in cifs_mark_tcp_ses_conns_for_reconnect()
378 * the smb session (and tcon) for reconnect as well. This value
560 * process waiting for reconnect will know it needs to re-establish session and tcon in reconnect_dfs_server()
2016 * cifs_setup_ipc - helper to setup the IPC tcon for the session
2022 * tcon_ipc. The IPC tcon has the same lifetime as the session.
2028 struct cifs_tcon *tcon; in cifs_setup_ipc() local
2048 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc); in cifs_setup_ipc()
2049 if (tcon == NULL) in cifs_setup_ipc()
2057 tcon->ses = ses; in cifs_setup_ipc()
2058 tcon->ipc = true; in cifs_setup_ipc()
2059 tcon->seal = seal; in cifs_setup_ipc()
2060 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
2065 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail); in cifs_setup_ipc()
2069 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid); in cifs_setup_ipc()
2071 spin_lock(&tcon->tc_lock); in cifs_setup_ipc()
2072 tcon->status = TID_GOOD; in cifs_setup_ipc()
2073 spin_unlock(&tcon->tc_lock); in cifs_setup_ipc()
2074 ses->tcon_ipc = tcon; in cifs_setup_ipc()
2110 struct cifs_tcon *tcon; in __cifs_put_smb_ses() local
2135 tcon = ses->tcon_ipc; in __cifs_put_smb_ses()
2148 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc); in __cifs_put_smb_ses()
2541 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2543 struct TCP_Server_Info *server = tcon->ses->server; in match_tcon()
2545 if (tcon->status == TID_EXITING) in match_tcon()
2548 if (tcon->origin_fullpath) { in match_tcon()
2551 tcon->origin_fullpath)) in match_tcon()
2554 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) { in match_tcon()
2557 if (tcon->seal != ctx->seal) in match_tcon()
2559 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2561 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2563 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2565 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2567 if (tcon->posix_extensions != ctx->linux_ext) in match_tcon()
2575 struct cifs_tcon *tcon; in cifs_find_tcon() local
2578 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_find_tcon()
2579 spin_lock(&tcon->tc_lock); in cifs_find_tcon()
2580 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2581 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2584 ++tcon->tc_count; in cifs_find_tcon()
2585 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, in cifs_find_tcon()
2587 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2589 return tcon; in cifs_find_tcon()
2596 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in cifs_put_tcon() argument
2603 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
2606 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
2609 ses = tcon->ses; in cifs_put_tcon()
2610 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
2612 spin_lock(&tcon->tc_lock); in cifs_put_tcon()
2613 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace); in cifs_put_tcon()
2614 if (--tcon->tc_count > 0) { in cifs_put_tcon()
2615 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2621 WARN_ON(tcon->tc_count < 0); in cifs_put_tcon()
2623 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
2624 tcon->status = TID_EXITING; in cifs_put_tcon()
2625 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2629 cancel_delayed_work_sync(&tcon->query_interfaces); in cifs_put_tcon()
2631 cancel_delayed_work_sync(&tcon->dfs_cache_work); in cifs_put_tcon()
2632 list_replace_init(&tcon->dfs_ses_list, &ses_list); in cifs_put_tcon()
2635 if (tcon->use_witness) { in cifs_put_tcon()
2638 rc = cifs_swn_unregister(tcon); in cifs_put_tcon()
2647 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2650 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
2651 tconInfoFree(tcon, netfs_trace_tcon_ref_free); in cifs_put_tcon()
2659 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2663 * - tcon refcount is the number of mount points using the tcon.
2664 * - ses refcount is the number of tcon using the session.
2672 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2673 * its session refcount incremented (1 new tcon). This +1 was
2676 * b) an existing tcon with refcount+1 (add a mount point to it) and
2677 * identical ses refcount (no new tcon). Because of (1) we need to
2683 struct cifs_tcon *tcon; in cifs_get_tcon() local
2687 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2688 if (tcon) { in cifs_get_tcon()
2690 * tcon has refcount already incremented but we need to in cifs_get_tcon()
2695 return tcon; in cifs_get_tcon()
2708 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new); in cifs_get_tcon()
2709 if (tcon == NULL) { in cifs_get_tcon()
2713 tcon->nohandlecache = nohandlecache; in cifs_get_tcon()
2722 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2732 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2735 tcon->ses = ses; in cifs_get_tcon()
2737 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2738 if (!tcon->password) { in cifs_get_tcon()
2750 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
2752 tcon->seal = true; in cifs_get_tcon()
2762 tcon->posix_extensions = true; in cifs_get_tcon()
2788 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2791 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
2795 tcon->use_persistent = false; in cifs_get_tcon()
2805 tcon->use_persistent = true; in cifs_get_tcon()
2812 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
2816 tcon->use_persistent = true; in cifs_get_tcon()
2824 tcon->use_resilient = true; in cifs_get_tcon()
2827 tcon->use_witness = false; in cifs_get_tcon()
2830 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) { in cifs_get_tcon()
2835 tcon->use_witness = true; in cifs_get_tcon()
2837 rc = cifs_swn_register(tcon); in cifs_get_tcon()
2856 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
2870 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2878 tcon->retry = ctx->retry; in cifs_get_tcon()
2879 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2880 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2881 tcon->max_cached_dirs = ctx->max_cached_dirs; in cifs_get_tcon()
2882 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2883 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2884 tcon->status = TID_GOOD; in cifs_get_tcon()
2889 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in cifs_get_tcon()
2893 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2896 return tcon; in cifs_get_tcon()
2899 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail); in cifs_get_tcon()
2975 struct cifs_tcon *tcon, in match_prepath() argument
2986 if (tcon->origin_fullpath && in match_prepath()
2987 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source)) in match_prepath()
3006 struct cifs_tcon *tcon; in cifs_match_super() local
3026 tcon = tlink_tcon(tlink); in cifs_match_super()
3027 ses = tcon->ses; in cifs_match_super()
3035 spin_lock(&tcon->tc_lock); in cifs_match_super()
3038 !match_tcon(tcon, ctx) || in cifs_match_super()
3039 !match_prepath(sb, tcon, mnt_data)) { in cifs_match_super()
3046 spin_unlock(&tcon->tc_lock); in cifs_match_super()
3476 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3484 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3490 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3493 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3494 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3498 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3500 if (!tcon->unix_ext) { in reset_cifs_unix_caps()
3505 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3506 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3573 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
3642 if (mnt_ctx->tcon) in cifs_mount_put_conns()
3643 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx); in cifs_mount_put_conns()
3649 mnt_ctx->tcon = NULL; in cifs_mount_put_conns()
3697 mnt_ctx->tcon = NULL; in cifs_mount_get_session()
3707 struct cifs_tcon *tcon = NULL; in cifs_mount_get_tcon() local
3719 /* search for existing tcon to this server share */ in cifs_mount_get_tcon()
3720 tcon = cifs_get_tcon(mnt_ctx->ses, ctx); in cifs_mount_get_tcon()
3721 if (IS_ERR(tcon)) { in cifs_mount_get_tcon()
3722 rc = PTR_ERR(tcon); in cifs_mount_get_tcon()
3723 tcon = NULL; in cifs_mount_get_tcon()
3731 if (tcon->posix_extensions) { in cifs_mount_get_tcon()
3739 if (cap_unix(tcon->ses)) { in cifs_mount_get_tcon()
3744 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx); in cifs_mount_get_tcon()
3745 spin_lock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3746 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount_get_tcon()
3747 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in cifs_mount_get_tcon()
3749 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3753 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3756 tcon->unix_ext = 0; /* server does not support them */ in cifs_mount_get_tcon()
3759 if (!tcon->pipe && server->ops->qfs_tcon) { in cifs_mount_get_tcon()
3760 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb); in cifs_mount_get_tcon()
3762 if (tcon->fsDevInfo.DeviceCharacteristics & in cifs_mount_get_tcon()
3772 cifs_negotiate_iosize(server, cifs_sb->ctx, tcon); in cifs_mount_get_tcon()
3779 cifs_fscache_get_super_cookie(tcon); in cifs_mount_get_tcon()
3782 mnt_ctx->tcon = tcon; in cifs_mount_get_tcon()
3787 struct cifs_tcon *tcon) in mount_setup_tlink() argument
3791 /* hang the tcon off of the superblock */ in mount_setup_tlink()
3797 tlink->tl_tcon = tcon; in mount_setup_tlink()
3807 spin_lock(&tcon->sb_list_lock); in mount_setup_tlink()
3808 list_add(&cifs_sb->tcon_sb_link, &tcon->cifs_sb_list); in mount_setup_tlink()
3809 spin_unlock(&tcon->sb_list_lock); in mount_setup_tlink()
3819 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
3832 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
3856 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
3874 struct cifs_tcon *tcon = mnt_ctx->tcon; in cifs_is_path_remote() local
3882 * cifs_build_path_to_root works only when we have a valid tcon in cifs_is_path_remote()
3884 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in cifs_is_path_remote()
3885 tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3891 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_is_path_remote()
3897 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in cifs_is_path_remote()
3898 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3939 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3970 else if (WARN_ON(!mnt_ctx.tcon)) in cifs_mount()
3982 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
4001 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
4074 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
4089 tcon->ipc = true; in CIFSTCon()
4090 tcon->pipe = true; in CIFSTCon()
4100 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); in CIFSTCon()
4103 kfree(tcon->nativeFileSystem); in CIFSTCon()
4104 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
4108 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
4113 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
4115 tcon->Flags = 0; in CIFSTCon()
4116 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
4123 * need_reconnect when tcon was successful but needed to be in CIFSTCon()
4126 if (tcon->need_reconnect && tcon->unix_ext) { in CIFSTCon()
4127 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); in CIFSTCon()
4128 tcon->need_reconnect = false; in CIFSTCon()
4129 reset_cifs_unix_caps(xid, tcon, NULL, NULL); in CIFSTCon()
4152 struct cifs_tcon *tcon = NULL; in cifs_umount() local
4157 tcon = cifs_sb->master_tlink->tl_tcon; in cifs_umount()
4158 if (tcon) { in cifs_umount()
4159 spin_lock(&tcon->sb_list_lock); in cifs_umount()
4161 spin_unlock(&tcon->sb_list_lock); in cifs_umount()
4375 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
4406 tcon = ERR_PTR(rc); in cifs_construct_tcon()
4417 tcon = ERR_CAST(ses); in cifs_construct_tcon()
4428 tcon = ERR_CAST(origin_fullpath); in cifs_construct_tcon()
4438 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4439 if (IS_ERR(tcon)) { in cifs_construct_tcon()
4446 spin_lock(&tcon->tc_lock); in cifs_construct_tcon()
4447 tcon->origin_fullpath = origin_fullpath; in cifs_construct_tcon()
4448 spin_unlock(&tcon->tc_lock); in cifs_construct_tcon()
4450 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work, in cifs_construct_tcon()
4457 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4466 return tcon; in cifs_construct_tcon()
4517 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4521 * the master tcon for the mount.
4523 * First, search the rbtree for an existing tcon for this fsuid. If one
4660 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon) in cifs_tree_connect() argument
4662 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
4666 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4668 /* if tcon is marked for needing reconnect, update state */ in cifs_tree_connect()
4669 if (tcon->need_reconnect) in cifs_tree_connect()
4670 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4672 if (tcon->status == TID_GOOD) { in cifs_tree_connect()
4673 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4677 if (tcon->status != TID_NEW && in cifs_tree_connect()
4678 tcon->status != TID_NEED_TCON) { in cifs_tree_connect()
4679 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4683 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4684 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4686 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, in cifs_tree_connect()
4687 tcon, tcon->ses->local_nls); in cifs_tree_connect()
4689 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4690 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4691 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4692 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4694 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4695 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4696 tcon->status = TID_GOOD; in cifs_tree_connect()
4697 tcon->need_reconnect = false; in cifs_tree_connect()
4698 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()