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()
127 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in smb2_query_server_interfaces()
195 struct cifs_tcon *tcon; in cifs_mark_tcp_ses_conns_for_reconnect() local
254 /* If all channels need reconnect, then tcon needs reconnect */ in cifs_mark_tcp_ses_conns_for_reconnect()
265 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_mark_tcp_ses_conns_for_reconnect()
266 tcon->need_reconnect = true; in cifs_mark_tcp_ses_conns_for_reconnect()
267 spin_lock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
268 tcon->status = TID_NEED_RECON; in cifs_mark_tcp_ses_conns_for_reconnect()
269 spin_unlock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
271 cancel_delayed_work(&tcon->query_interfaces); in cifs_mark_tcp_ses_conns_for_reconnect()
368 * the smb session (and tcon) for reconnect as well. This value
542 * process waiting for reconnect will know it needs to re-establish session and tcon in reconnect_dfs_server()
1997 * cifs_setup_ipc - helper to setup the IPC tcon for the session
2003 * tcon_ipc. The IPC tcon has the same lifetime as the session.
2009 struct cifs_tcon *tcon; in cifs_setup_ipc() local
2029 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc); in cifs_setup_ipc()
2030 if (tcon == NULL) in cifs_setup_ipc()
2038 tcon->ses = ses; in cifs_setup_ipc()
2039 tcon->ipc = true; in cifs_setup_ipc()
2040 tcon->seal = seal; in cifs_setup_ipc()
2041 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
2046 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail); in cifs_setup_ipc()
2050 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid); in cifs_setup_ipc()
2052 spin_lock(&tcon->tc_lock); in cifs_setup_ipc()
2053 tcon->status = TID_GOOD; in cifs_setup_ipc()
2054 spin_unlock(&tcon->tc_lock); in cifs_setup_ipc()
2055 ses->tcon_ipc = tcon; in cifs_setup_ipc()
2091 struct cifs_tcon *tcon; in __cifs_put_smb_ses() local
2116 tcon = ses->tcon_ipc; in __cifs_put_smb_ses()
2129 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc); in __cifs_put_smb_ses()
2522 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2524 struct TCP_Server_Info *server = tcon->ses->server; in match_tcon()
2526 if (tcon->status == TID_EXITING) in match_tcon()
2529 if (tcon->origin_fullpath) { in match_tcon()
2532 tcon->origin_fullpath)) in match_tcon()
2535 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) { in match_tcon()
2538 if (tcon->seal != ctx->seal) in match_tcon()
2540 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2542 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2544 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2546 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2548 if (tcon->posix_extensions != ctx->linux_ext) in match_tcon()
2556 struct cifs_tcon *tcon; in cifs_find_tcon() local
2559 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_find_tcon()
2560 spin_lock(&tcon->tc_lock); in cifs_find_tcon()
2561 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2562 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2565 ++tcon->tc_count; in cifs_find_tcon()
2566 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, in cifs_find_tcon()
2568 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2570 return tcon; in cifs_find_tcon()
2577 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in cifs_put_tcon() argument
2584 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
2587 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
2590 ses = tcon->ses; in cifs_put_tcon()
2591 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
2593 spin_lock(&tcon->tc_lock); in cifs_put_tcon()
2594 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace); in cifs_put_tcon()
2595 if (--tcon->tc_count > 0) { in cifs_put_tcon()
2596 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2602 WARN_ON(tcon->tc_count < 0); in cifs_put_tcon()
2604 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
2605 tcon->status = TID_EXITING; in cifs_put_tcon()
2606 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2610 cancel_delayed_work_sync(&tcon->query_interfaces); in cifs_put_tcon()
2612 cancel_delayed_work_sync(&tcon->dfs_cache_work); in cifs_put_tcon()
2613 list_replace_init(&tcon->dfs_ses_list, &ses_list); in cifs_put_tcon()
2616 if (tcon->use_witness) { in cifs_put_tcon()
2619 rc = cifs_swn_unregister(tcon); in cifs_put_tcon()
2628 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2631 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
2632 tconInfoFree(tcon, netfs_trace_tcon_ref_free); in cifs_put_tcon()
2640 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2644 * - tcon refcount is the number of mount points using the tcon.
2645 * - ses refcount is the number of tcon using the session.
2653 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2654 * its session refcount incremented (1 new tcon). This +1 was
2657 * b) an existing tcon with refcount+1 (add a mount point to it) and
2658 * identical ses refcount (no new tcon). Because of (1) we need to
2664 struct cifs_tcon *tcon; in cifs_get_tcon() local
2668 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2669 if (tcon) { in cifs_get_tcon()
2671 * tcon has refcount already incremented but we need to in cifs_get_tcon()
2676 return tcon; in cifs_get_tcon()
2689 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new); in cifs_get_tcon()
2690 if (tcon == NULL) { in cifs_get_tcon()
2694 tcon->nohandlecache = nohandlecache; in cifs_get_tcon()
2703 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2713 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2716 tcon->ses = ses; in cifs_get_tcon()
2718 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2719 if (!tcon->password) { in cifs_get_tcon()
2731 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
2733 tcon->seal = true; in cifs_get_tcon()
2743 tcon->posix_extensions = true; in cifs_get_tcon()
2769 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2772 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
2776 tcon->use_persistent = false; in cifs_get_tcon()
2786 tcon->use_persistent = true; in cifs_get_tcon()
2793 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
2797 tcon->use_persistent = true; in cifs_get_tcon()
2805 tcon->use_resilient = true; in cifs_get_tcon()
2808 tcon->use_witness = false; in cifs_get_tcon()
2811 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) { in cifs_get_tcon()
2816 tcon->use_witness = true; in cifs_get_tcon()
2818 rc = cifs_swn_register(tcon); in cifs_get_tcon()
2837 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
2851 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2859 tcon->retry = ctx->retry; in cifs_get_tcon()
2860 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2861 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2862 tcon->max_cached_dirs = ctx->max_cached_dirs; in cifs_get_tcon()
2863 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2864 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2865 INIT_LIST_HEAD(&tcon->pending_opens); in cifs_get_tcon()
2866 tcon->status = TID_GOOD; in cifs_get_tcon()
2868 INIT_DELAYED_WORK(&tcon->query_interfaces, in cifs_get_tcon()
2873 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in cifs_get_tcon()
2877 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh); in cifs_get_tcon()
2880 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2883 return tcon; in cifs_get_tcon()
2886 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail); in cifs_get_tcon()
2962 struct cifs_tcon *tcon, in match_prepath() argument
2973 if (tcon->origin_fullpath && in match_prepath()
2974 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source)) in match_prepath()
2993 struct cifs_tcon *tcon; in cifs_match_super() local
3013 tcon = tlink_tcon(tlink); in cifs_match_super()
3014 ses = tcon->ses; in cifs_match_super()
3022 spin_lock(&tcon->tc_lock); in cifs_match_super()
3025 !match_tcon(tcon, ctx) || in cifs_match_super()
3026 !match_prepath(sb, tcon, mnt_data)) { in cifs_match_super()
3033 spin_unlock(&tcon->tc_lock); in cifs_match_super()
3466 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3474 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3480 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3483 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3484 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3488 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3490 if (!tcon->unix_ext) { in reset_cifs_unix_caps()
3495 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3496 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3563 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
3632 if (mnt_ctx->tcon) in cifs_mount_put_conns()
3633 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx); in cifs_mount_put_conns()
3639 mnt_ctx->tcon = NULL; in cifs_mount_put_conns()
3687 mnt_ctx->tcon = NULL; in cifs_mount_get_session()
3697 struct cifs_tcon *tcon = NULL; in cifs_mount_get_tcon() local
3709 /* search for existing tcon to this server share */ in cifs_mount_get_tcon()
3710 tcon = cifs_get_tcon(mnt_ctx->ses, ctx); in cifs_mount_get_tcon()
3711 if (IS_ERR(tcon)) { in cifs_mount_get_tcon()
3712 rc = PTR_ERR(tcon); in cifs_mount_get_tcon()
3713 tcon = NULL; in cifs_mount_get_tcon()
3718 if (tcon->posix_extensions) in cifs_mount_get_tcon()
3723 if (cap_unix(tcon->ses)) { in cifs_mount_get_tcon()
3728 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx); in cifs_mount_get_tcon()
3729 spin_lock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3730 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount_get_tcon()
3731 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in cifs_mount_get_tcon()
3733 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3737 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3740 tcon->unix_ext = 0; /* server does not support them */ in cifs_mount_get_tcon()
3743 if (!tcon->pipe && server->ops->qfs_tcon) { in cifs_mount_get_tcon()
3744 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb); in cifs_mount_get_tcon()
3746 if (tcon->fsDevInfo.DeviceCharacteristics & in cifs_mount_get_tcon()
3756 cifs_negotiate_iosize(server, cifs_sb->ctx, tcon); in cifs_mount_get_tcon()
3763 cifs_fscache_get_super_cookie(tcon); in cifs_mount_get_tcon()
3766 mnt_ctx->tcon = tcon; in cifs_mount_get_tcon()
3771 struct cifs_tcon *tcon) in mount_setup_tlink() argument
3775 /* hang the tcon off of the superblock */ in mount_setup_tlink()
3781 tlink->tl_tcon = tcon; in mount_setup_tlink()
3791 spin_lock(&tcon->sb_list_lock); in mount_setup_tlink()
3792 list_add(&cifs_sb->tcon_sb_link, &tcon->cifs_sb_list); in mount_setup_tlink()
3793 spin_unlock(&tcon->sb_list_lock); in mount_setup_tlink()
3803 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
3816 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
3840 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
3858 struct cifs_tcon *tcon = mnt_ctx->tcon; in cifs_is_path_remote() local
3866 * cifs_build_path_to_root works only when we have a valid tcon in cifs_is_path_remote()
3868 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in cifs_is_path_remote()
3869 tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3875 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_is_path_remote()
3881 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in cifs_is_path_remote()
3882 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3923 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3954 else if (WARN_ON(!mnt_ctx.tcon)) in cifs_mount()
3966 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3985 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
4058 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
4073 tcon->ipc = true; in CIFSTCon()
4074 tcon->pipe = true; in CIFSTCon()
4084 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); in CIFSTCon()
4087 kfree(tcon->nativeFileSystem); in CIFSTCon()
4088 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
4092 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
4097 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
4099 tcon->Flags = 0; in CIFSTCon()
4100 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
4107 * need_reconnect when tcon was successful but needed to be in CIFSTCon()
4110 if (tcon->need_reconnect && tcon->unix_ext) { in CIFSTCon()
4111 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); in CIFSTCon()
4112 tcon->need_reconnect = false; in CIFSTCon()
4113 reset_cifs_unix_caps(xid, tcon, NULL, NULL); in CIFSTCon()
4136 struct cifs_tcon *tcon = NULL; in cifs_umount() local
4141 tcon = cifs_sb->master_tlink->tl_tcon; in cifs_umount()
4142 if (tcon) { in cifs_umount()
4143 spin_lock(&tcon->sb_list_lock); in cifs_umount()
4145 spin_unlock(&tcon->sb_list_lock); in cifs_umount()
4358 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
4389 tcon = ERR_PTR(rc); in cifs_construct_tcon()
4400 tcon = ERR_CAST(ses); in cifs_construct_tcon()
4411 tcon = ERR_CAST(origin_fullpath); in cifs_construct_tcon()
4421 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4422 if (IS_ERR(tcon)) { in cifs_construct_tcon()
4429 spin_lock(&tcon->tc_lock); in cifs_construct_tcon()
4430 tcon->origin_fullpath = origin_fullpath; in cifs_construct_tcon()
4431 spin_unlock(&tcon->tc_lock); in cifs_construct_tcon()
4433 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work, in cifs_construct_tcon()
4440 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4449 return tcon; in cifs_construct_tcon()
4500 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4504 * the master tcon for the mount.
4506 * First, search the rbtree for an existing tcon for this fsuid. If one
4643 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon) in cifs_tree_connect() argument
4645 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
4649 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4651 /* if tcon is marked for needing reconnect, update state */ in cifs_tree_connect()
4652 if (tcon->need_reconnect) in cifs_tree_connect()
4653 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4655 if (tcon->status == TID_GOOD) { in cifs_tree_connect()
4656 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4660 if (tcon->status != TID_NEW && in cifs_tree_connect()
4661 tcon->status != TID_NEED_TCON) { in cifs_tree_connect()
4662 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4666 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4667 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4669 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, in cifs_tree_connect()
4670 tcon, tcon->ses->local_nls); in cifs_tree_connect()
4672 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4673 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4674 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4675 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4677 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4678 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4679 tcon->status = TID_GOOD; in cifs_tree_connect()
4680 tcon->need_reconnect = false; in cifs_tree_connect()
4681 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()