Lines Matching full:tcon
120 struct cifs_tcon *tcon = container_of(work, in smb2_query_server_interfaces() local
123 struct TCP_Server_Info *server = tcon->ses->server; in smb2_query_server_interfaces()
132 rc = server->ops->query_server_interfaces(xid, tcon, false); in smb2_query_server_interfaces()
143 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in smb2_query_server_interfaces()
211 struct cifs_tcon *tcon; in cifs_mark_tcp_ses_conns_for_reconnect() local
270 /* If all channels need reconnect, then tcon needs reconnect */ in cifs_mark_tcp_ses_conns_for_reconnect()
281 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_mark_tcp_ses_conns_for_reconnect()
282 tcon->need_reconnect = true; in cifs_mark_tcp_ses_conns_for_reconnect()
283 spin_lock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
284 tcon->status = TID_NEED_RECON; in cifs_mark_tcp_ses_conns_for_reconnect()
285 spin_unlock(&tcon->tc_lock); in cifs_mark_tcp_ses_conns_for_reconnect()
287 cancel_delayed_work(&tcon->query_interfaces); in cifs_mark_tcp_ses_conns_for_reconnect()
384 * the smb session (and tcon) for reconnect as well. This value
547 * process waiting for reconnect will know it needs to re-establish session and tcon in reconnect_dfs_server()
1914 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1920 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1926 struct cifs_tcon *tcon; in cifs_setup_ipc() local
1946 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc); in cifs_setup_ipc()
1947 if (tcon == NULL) in cifs_setup_ipc()
1955 tcon->ses = ses; in cifs_setup_ipc()
1956 tcon->ipc = true; in cifs_setup_ipc()
1957 tcon->seal = seal; in cifs_setup_ipc()
1958 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
1963 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail); in cifs_setup_ipc()
1967 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid); in cifs_setup_ipc()
1969 spin_lock(&tcon->tc_lock); in cifs_setup_ipc()
1970 tcon->status = TID_GOOD; in cifs_setup_ipc()
1971 spin_unlock(&tcon->tc_lock); in cifs_setup_ipc()
1972 ses->tcon_ipc = tcon; in cifs_setup_ipc()
2008 struct cifs_tcon *tcon; in __cifs_put_smb_ses() local
2033 tcon = ses->tcon_ipc; in __cifs_put_smb_ses()
2046 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc); in __cifs_put_smb_ses()
2390 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2392 struct TCP_Server_Info *server = tcon->ses->server; in match_tcon()
2394 if (tcon->status == TID_EXITING) in match_tcon()
2397 if (tcon->origin_fullpath) { in match_tcon()
2400 tcon->origin_fullpath)) in match_tcon()
2403 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) { in match_tcon()
2406 if (tcon->seal != ctx->seal) in match_tcon()
2408 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2410 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2412 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2414 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2422 struct cifs_tcon *tcon; in cifs_find_tcon() local
2425 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_find_tcon()
2426 spin_lock(&tcon->tc_lock); in cifs_find_tcon()
2427 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2428 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2431 ++tcon->tc_count; in cifs_find_tcon()
2432 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, in cifs_find_tcon()
2434 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2436 return tcon; in cifs_find_tcon()
2443 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in cifs_put_tcon() argument
2450 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
2453 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
2456 ses = tcon->ses; in cifs_put_tcon()
2457 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
2459 spin_lock(&tcon->tc_lock); in cifs_put_tcon()
2460 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace); in cifs_put_tcon()
2461 if (--tcon->tc_count > 0) { in cifs_put_tcon()
2462 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2468 WARN_ON(tcon->tc_count < 0); in cifs_put_tcon()
2470 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
2471 tcon->status = TID_EXITING; in cifs_put_tcon()
2473 list_replace_init(&tcon->dfs_ses_list, &ses_list); in cifs_put_tcon()
2475 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2479 cancel_delayed_work_sync(&tcon->query_interfaces); in cifs_put_tcon()
2481 cancel_delayed_work_sync(&tcon->dfs_cache_work); in cifs_put_tcon()
2484 if (tcon->use_witness) { in cifs_put_tcon()
2487 rc = cifs_swn_unregister(tcon); in cifs_put_tcon()
2496 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2499 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
2500 tconInfoFree(tcon, netfs_trace_tcon_ref_free); in cifs_put_tcon()
2508 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2512 * - tcon refcount is the number of mount points using the tcon.
2513 * - ses refcount is the number of tcon using the session.
2521 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2522 * its session refcount incremented (1 new tcon). This +1 was
2525 * b) an existing tcon with refcount+1 (add a mount point to it) and
2526 * identical ses refcount (no new tcon). Because of (1) we need to
2532 struct cifs_tcon *tcon; in cifs_get_tcon() local
2536 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2537 if (tcon) { in cifs_get_tcon()
2539 * tcon has refcount already incremented but we need to in cifs_get_tcon()
2544 return tcon; in cifs_get_tcon()
2557 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new); in cifs_get_tcon()
2558 if (tcon == NULL) { in cifs_get_tcon()
2562 tcon->nohandlecache = nohandlecache; in cifs_get_tcon()
2571 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2581 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2584 tcon->ses = ses; in cifs_get_tcon()
2586 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2587 if (!tcon->password) { in cifs_get_tcon()
2599 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
2601 tcon->seal = true; in cifs_get_tcon()
2611 tcon->posix_extensions = true; in cifs_get_tcon()
2637 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2640 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
2644 tcon->use_persistent = false; in cifs_get_tcon()
2654 tcon->use_persistent = true; in cifs_get_tcon()
2661 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
2665 tcon->use_persistent = true; in cifs_get_tcon()
2673 tcon->use_resilient = true; in cifs_get_tcon()
2676 tcon->use_witness = false; in cifs_get_tcon()
2679 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) { in cifs_get_tcon()
2684 tcon->use_witness = true; in cifs_get_tcon()
2686 rc = cifs_swn_register(tcon); in cifs_get_tcon()
2705 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
2719 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2727 tcon->retry = ctx->retry; in cifs_get_tcon()
2728 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2729 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2730 tcon->max_cached_dirs = ctx->max_cached_dirs; in cifs_get_tcon()
2731 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2732 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2733 INIT_LIST_HEAD(&tcon->pending_opens); in cifs_get_tcon()
2734 tcon->status = TID_GOOD; in cifs_get_tcon()
2736 INIT_DELAYED_WORK(&tcon->query_interfaces, in cifs_get_tcon()
2741 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in cifs_get_tcon()
2745 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh); in cifs_get_tcon()
2748 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2751 return tcon; in cifs_get_tcon()
2754 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail); in cifs_get_tcon()
2826 struct cifs_tcon *tcon, in match_prepath() argument
2837 if (tcon->origin_fullpath && in match_prepath()
2838 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source)) in match_prepath()
2857 struct cifs_tcon *tcon; in cifs_match_super() local
2877 tcon = tlink_tcon(tlink); in cifs_match_super()
2878 ses = tcon->ses; in cifs_match_super()
2886 spin_lock(&tcon->tc_lock); in cifs_match_super()
2889 !match_tcon(tcon, ctx) || in cifs_match_super()
2890 !match_prepath(sb, tcon, mnt_data)) { in cifs_match_super()
2897 spin_unlock(&tcon->tc_lock); in cifs_match_super()
3179 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3187 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3193 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3196 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3197 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3201 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3203 if (!tcon->unix_ext) { in reset_cifs_unix_caps()
3208 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3209 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3276 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
3344 if (mnt_ctx->tcon) in cifs_mount_put_conns()
3345 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx); in cifs_mount_put_conns()
3351 mnt_ctx->tcon = NULL; in cifs_mount_put_conns()
3399 mnt_ctx->tcon = NULL; in cifs_mount_get_session()
3409 struct cifs_tcon *tcon = NULL; in cifs_mount_get_tcon() local
3421 /* search for existing tcon to this server share */ in cifs_mount_get_tcon()
3422 tcon = cifs_get_tcon(mnt_ctx->ses, ctx); in cifs_mount_get_tcon()
3423 if (IS_ERR(tcon)) { in cifs_mount_get_tcon()
3424 rc = PTR_ERR(tcon); in cifs_mount_get_tcon()
3425 tcon = NULL; in cifs_mount_get_tcon()
3430 if (tcon->posix_extensions) in cifs_mount_get_tcon()
3435 if (cap_unix(tcon->ses)) { in cifs_mount_get_tcon()
3440 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx); in cifs_mount_get_tcon()
3441 spin_lock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3442 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount_get_tcon()
3443 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in cifs_mount_get_tcon()
3445 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3449 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3452 tcon->unix_ext = 0; /* server does not support them */ in cifs_mount_get_tcon()
3455 if (!tcon->pipe && server->ops->qfs_tcon) { in cifs_mount_get_tcon()
3456 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb); in cifs_mount_get_tcon()
3458 if (tcon->fsDevInfo.DeviceCharacteristics & in cifs_mount_get_tcon()
3474 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) { in cifs_mount_get_tcon()
3476 round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE); in cifs_mount_get_tcon()
3487 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) in cifs_mount_get_tcon()
3488 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); in cifs_mount_get_tcon()
3496 cifs_fscache_get_super_cookie(tcon); in cifs_mount_get_tcon()
3499 mnt_ctx->tcon = tcon; in cifs_mount_get_tcon()
3504 struct cifs_tcon *tcon) in mount_setup_tlink() argument
3508 /* hang the tcon off of the superblock */ in mount_setup_tlink()
3514 tlink->tl_tcon = tcon; in mount_setup_tlink()
3532 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
3545 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
3569 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
3587 struct cifs_tcon *tcon = mnt_ctx->tcon; in cifs_is_path_remote() local
3595 * cifs_build_path_to_root works only when we have a valid tcon in cifs_is_path_remote()
3597 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in cifs_is_path_remote()
3598 tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3604 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_is_path_remote()
3610 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in cifs_is_path_remote()
3611 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3652 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3683 else if (WARN_ON(!mnt_ctx.tcon)) in cifs_mount()
3695 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3714 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
3787 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
3802 tcon->ipc = true; in CIFSTCon()
3803 tcon->pipe = true; in CIFSTCon()
3813 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); in CIFSTCon()
3816 kfree(tcon->nativeFileSystem); in CIFSTCon()
3817 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
3821 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
3826 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
3828 tcon->Flags = 0; in CIFSTCon()
3829 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
3836 * need_reconnect when tcon was successful but needed to be in CIFSTCon()
3839 if (tcon->need_reconnect && tcon->unix_ext) { in CIFSTCon()
3840 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); in CIFSTCon()
3841 tcon->need_reconnect = false; in CIFSTCon()
3842 reset_cifs_unix_caps(xid, tcon, NULL, NULL); in CIFSTCon()
4043 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
4073 tcon = ERR_PTR(rc); in cifs_construct_tcon()
4084 tcon = ERR_CAST(ses); in cifs_construct_tcon()
4095 tcon = ERR_CAST(origin_fullpath); in cifs_construct_tcon()
4105 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4106 if (IS_ERR(tcon)) { in cifs_construct_tcon()
4113 spin_lock(&tcon->tc_lock); in cifs_construct_tcon()
4114 tcon->origin_fullpath = origin_fullpath; in cifs_construct_tcon()
4115 spin_unlock(&tcon->tc_lock); in cifs_construct_tcon()
4117 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work, in cifs_construct_tcon()
4124 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4133 return tcon; in cifs_construct_tcon()
4184 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4188 * the master tcon for the mount.
4190 * First, search the rbtree for an existing tcon for this fsuid. If one
4327 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc) in cifs_tree_connect() argument
4330 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
4333 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4335 /* if tcon is marked for needing reconnect, update state */ in cifs_tree_connect()
4336 if (tcon->need_reconnect) in cifs_tree_connect()
4337 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4339 if (tcon->status == TID_GOOD) { in cifs_tree_connect()
4340 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4344 if (tcon->status != TID_NEW && in cifs_tree_connect()
4345 tcon->status != TID_NEED_TCON) { in cifs_tree_connect()
4346 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4350 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4351 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4353 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc); in cifs_tree_connect()
4355 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4356 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4357 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4358 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4360 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4361 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4362 tcon->status = TID_GOOD; in cifs_tree_connect()
4363 tcon->need_reconnect = false; in cifs_tree_connect()
4364 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()