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
539 * process waiting for reconnect will know it needs to re-establish session and tcon in reconnect_dfs_server()
1898 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1904 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1910 struct cifs_tcon *tcon; in cifs_setup_ipc() local
1930 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc); in cifs_setup_ipc()
1931 if (tcon == NULL) in cifs_setup_ipc()
1939 tcon->ses = ses; in cifs_setup_ipc()
1940 tcon->ipc = true; in cifs_setup_ipc()
1941 tcon->seal = seal; in cifs_setup_ipc()
1942 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
1947 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail); in cifs_setup_ipc()
1951 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid); in cifs_setup_ipc()
1953 spin_lock(&tcon->tc_lock); in cifs_setup_ipc()
1954 tcon->status = TID_GOOD; in cifs_setup_ipc()
1955 spin_unlock(&tcon->tc_lock); in cifs_setup_ipc()
1956 ses->tcon_ipc = tcon; in cifs_setup_ipc()
1992 struct cifs_tcon *tcon; in __cifs_put_smb_ses() local
2017 tcon = ses->tcon_ipc; in __cifs_put_smb_ses()
2030 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc); in __cifs_put_smb_ses()
2422 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2424 struct TCP_Server_Info *server = tcon->ses->server; in match_tcon()
2426 if (tcon->status == TID_EXITING) in match_tcon()
2429 if (tcon->origin_fullpath) { in match_tcon()
2432 tcon->origin_fullpath)) in match_tcon()
2435 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) { in match_tcon()
2438 if (tcon->seal != ctx->seal) in match_tcon()
2440 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2442 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2444 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2446 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2448 if (tcon->posix_extensions != ctx->linux_ext) in match_tcon()
2456 struct cifs_tcon *tcon; in cifs_find_tcon() local
2459 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in cifs_find_tcon()
2460 spin_lock(&tcon->tc_lock); in cifs_find_tcon()
2461 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2462 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2465 ++tcon->tc_count; in cifs_find_tcon()
2466 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, in cifs_find_tcon()
2468 spin_unlock(&tcon->tc_lock); in cifs_find_tcon()
2470 return tcon; in cifs_find_tcon()
2477 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in cifs_put_tcon() argument
2484 * IPC tcon share the lifetime of their session and are in cifs_put_tcon()
2487 if (tcon == NULL || tcon->ipc) in cifs_put_tcon()
2490 ses = tcon->ses; in cifs_put_tcon()
2491 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); in cifs_put_tcon()
2493 spin_lock(&tcon->tc_lock); in cifs_put_tcon()
2494 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace); in cifs_put_tcon()
2495 if (--tcon->tc_count > 0) { in cifs_put_tcon()
2496 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2502 WARN_ON(tcon->tc_count < 0); in cifs_put_tcon()
2504 list_del_init(&tcon->tcon_list); in cifs_put_tcon()
2505 tcon->status = TID_EXITING; in cifs_put_tcon()
2506 spin_unlock(&tcon->tc_lock); in cifs_put_tcon()
2510 cancel_delayed_work_sync(&tcon->query_interfaces); in cifs_put_tcon()
2512 cancel_delayed_work_sync(&tcon->dfs_cache_work); in cifs_put_tcon()
2513 list_replace_init(&tcon->dfs_ses_list, &ses_list); in cifs_put_tcon()
2516 if (tcon->use_witness) { in cifs_put_tcon()
2519 rc = cifs_swn_unregister(tcon); in cifs_put_tcon()
2528 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2531 cifs_fscache_release_super_cookie(tcon); in cifs_put_tcon()
2532 tconInfoFree(tcon, netfs_trace_tcon_ref_free); in cifs_put_tcon()
2540 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2544 * - tcon refcount is the number of mount points using the tcon.
2545 * - ses refcount is the number of tcon using the session.
2553 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2554 * its session refcount incremented (1 new tcon). This +1 was
2557 * b) an existing tcon with refcount+1 (add a mount point to it) and
2558 * identical ses refcount (no new tcon). Because of (1) we need to
2564 struct cifs_tcon *tcon; in cifs_get_tcon() local
2568 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2569 if (tcon) { in cifs_get_tcon()
2571 * tcon has refcount already incremented but we need to in cifs_get_tcon()
2576 return tcon; in cifs_get_tcon()
2589 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new); in cifs_get_tcon()
2590 if (tcon == NULL) { in cifs_get_tcon()
2594 tcon->nohandlecache = nohandlecache; in cifs_get_tcon()
2603 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2613 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2616 tcon->ses = ses; in cifs_get_tcon()
2618 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2619 if (!tcon->password) { in cifs_get_tcon()
2631 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
2633 tcon->seal = true; in cifs_get_tcon()
2643 tcon->posix_extensions = true; in cifs_get_tcon()
2669 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2672 cifs_dbg(FYI, "Tcon rc = %d\n", rc); in cifs_get_tcon()
2676 tcon->use_persistent = false; in cifs_get_tcon()
2686 tcon->use_persistent = true; in cifs_get_tcon()
2693 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY) in cifs_get_tcon()
2697 tcon->use_persistent = true; in cifs_get_tcon()
2705 tcon->use_resilient = true; in cifs_get_tcon()
2708 tcon->use_witness = false; in cifs_get_tcon()
2711 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) { in cifs_get_tcon()
2716 tcon->use_witness = true; in cifs_get_tcon()
2718 rc = cifs_swn_register(tcon); in cifs_get_tcon()
2737 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) { in cifs_get_tcon()
2751 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2759 tcon->retry = ctx->retry; in cifs_get_tcon()
2760 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2761 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2762 tcon->max_cached_dirs = ctx->max_cached_dirs; in cifs_get_tcon()
2763 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2764 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2765 INIT_LIST_HEAD(&tcon->pending_opens); in cifs_get_tcon()
2766 tcon->status = TID_GOOD; in cifs_get_tcon()
2768 INIT_DELAYED_WORK(&tcon->query_interfaces, in cifs_get_tcon()
2773 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, in cifs_get_tcon()
2777 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh); in cifs_get_tcon()
2780 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2783 return tcon; in cifs_get_tcon()
2786 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail); in cifs_get_tcon()
2862 struct cifs_tcon *tcon, in match_prepath() argument
2873 if (tcon->origin_fullpath && in match_prepath()
2874 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source)) in match_prepath()
2893 struct cifs_tcon *tcon; in cifs_match_super() local
2913 tcon = tlink_tcon(tlink); in cifs_match_super()
2914 ses = tcon->ses; in cifs_match_super()
2922 spin_lock(&tcon->tc_lock); in cifs_match_super()
2925 !match_tcon(tcon, ctx) || in cifs_match_super()
2926 !match_prepath(sb, tcon, mnt_data)) { in cifs_match_super()
2933 spin_unlock(&tcon->tc_lock); in cifs_match_super()
3215 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, in reset_cifs_unix_caps() argument
3223 * Perhaps we could add a backpointer to array of sb from tcon in reset_cifs_unix_caps()
3229 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3232 tcon->fsUnixInfo.Capability = 0; in reset_cifs_unix_caps()
3233 tcon->unix_ext = 0; /* Unix Extensions disabled */ in reset_cifs_unix_caps()
3237 tcon->unix_ext = 1; /* Unix Extensions supported */ in reset_cifs_unix_caps()
3239 if (!tcon->unix_ext) { in reset_cifs_unix_caps()
3244 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { in reset_cifs_unix_caps()
3245 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); in reset_cifs_unix_caps()
3312 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { in reset_cifs_unix_caps()
3380 if (mnt_ctx->tcon) in cifs_mount_put_conns()
3381 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx); in cifs_mount_put_conns()
3387 mnt_ctx->tcon = NULL; in cifs_mount_put_conns()
3435 mnt_ctx->tcon = NULL; in cifs_mount_get_session()
3445 struct cifs_tcon *tcon = NULL; in cifs_mount_get_tcon() local
3457 /* search for existing tcon to this server share */ in cifs_mount_get_tcon()
3458 tcon = cifs_get_tcon(mnt_ctx->ses, ctx); in cifs_mount_get_tcon()
3459 if (IS_ERR(tcon)) { in cifs_mount_get_tcon()
3460 rc = PTR_ERR(tcon); in cifs_mount_get_tcon()
3461 tcon = NULL; in cifs_mount_get_tcon()
3466 if (tcon->posix_extensions) in cifs_mount_get_tcon()
3471 if (cap_unix(tcon->ses)) { in cifs_mount_get_tcon()
3476 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx); in cifs_mount_get_tcon()
3477 spin_lock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3478 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount_get_tcon()
3479 (le64_to_cpu(tcon->fsUnixInfo.Capability) & in cifs_mount_get_tcon()
3481 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3485 spin_unlock(&tcon->ses->server->srv_lock); in cifs_mount_get_tcon()
3488 tcon->unix_ext = 0; /* server does not support them */ in cifs_mount_get_tcon()
3491 if (!tcon->pipe && server->ops->qfs_tcon) { in cifs_mount_get_tcon()
3492 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb); in cifs_mount_get_tcon()
3494 if (tcon->fsDevInfo.DeviceCharacteristics & in cifs_mount_get_tcon()
3510 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) { in cifs_mount_get_tcon()
3512 round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE); in cifs_mount_get_tcon()
3523 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) in cifs_mount_get_tcon()
3524 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); in cifs_mount_get_tcon()
3532 cifs_fscache_get_super_cookie(tcon); in cifs_mount_get_tcon()
3535 mnt_ctx->tcon = tcon; in cifs_mount_get_tcon()
3540 struct cifs_tcon *tcon) in mount_setup_tlink() argument
3544 /* hang the tcon off of the superblock */ in mount_setup_tlink()
3550 tlink->tl_tcon = tcon; in mount_setup_tlink()
3568 struct cifs_tcon *tcon, in cifs_are_all_path_components_accessible() argument
3581 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, ""); in cifs_are_all_path_components_accessible()
3605 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_are_all_path_components_accessible()
3623 struct cifs_tcon *tcon = mnt_ctx->tcon; in cifs_is_path_remote() local
3631 * cifs_build_path_to_root works only when we have a valid tcon in cifs_is_path_remote()
3633 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in cifs_is_path_remote()
3634 tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3640 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, in cifs_is_path_remote()
3646 rc = cifs_are_all_path_components_accessible(server, xid, tcon, in cifs_is_path_remote()
3647 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS); in cifs_is_path_remote()
3688 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3719 else if (WARN_ON(!mnt_ctx.tcon)) in cifs_mount()
3731 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon); in cifs_mount()
3750 const char *tree, struct cifs_tcon *tcon, in CIFSTCon() argument
3823 tcon->tid = smb_buffer_response->Tid; in CIFSTCon()
3838 tcon->ipc = true; in CIFSTCon()
3839 tcon->pipe = true; in CIFSTCon()
3849 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name)); in CIFSTCon()
3852 kfree(tcon->nativeFileSystem); in CIFSTCon()
3853 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr, in CIFSTCon()
3857 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem); in CIFSTCon()
3862 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); in CIFSTCon()
3864 tcon->Flags = 0; in CIFSTCon()
3865 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); in CIFSTCon()
3872 * need_reconnect when tcon was successful but needed to be in CIFSTCon()
3875 if (tcon->need_reconnect && tcon->unix_ext) { in CIFSTCon()
3876 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); in CIFSTCon()
3877 tcon->need_reconnect = false; in CIFSTCon()
3878 reset_cifs_unix_caps(xid, tcon, NULL, NULL); in CIFSTCon()
4079 struct cifs_tcon *tcon = NULL; in cifs_construct_tcon() local
4109 tcon = ERR_PTR(rc); in cifs_construct_tcon()
4120 tcon = ERR_CAST(ses); in cifs_construct_tcon()
4131 tcon = ERR_CAST(origin_fullpath); in cifs_construct_tcon()
4141 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4142 if (IS_ERR(tcon)) { in cifs_construct_tcon()
4149 spin_lock(&tcon->tc_lock); in cifs_construct_tcon()
4150 tcon->origin_fullpath = origin_fullpath; in cifs_construct_tcon()
4151 spin_unlock(&tcon->tc_lock); in cifs_construct_tcon()
4153 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work, in cifs_construct_tcon()
4160 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4169 return tcon; in cifs_construct_tcon()
4220 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4224 * the master tcon for the mount.
4226 * First, search the rbtree for an existing tcon for this fsuid. If one
4363 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon) in cifs_tree_connect() argument
4365 const struct smb_version_operations *ops = tcon->ses->server->ops; in cifs_tree_connect()
4369 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4371 /* if tcon is marked for needing reconnect, update state */ in cifs_tree_connect()
4372 if (tcon->need_reconnect) in cifs_tree_connect()
4373 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4375 if (tcon->status == TID_GOOD) { in cifs_tree_connect()
4376 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4380 if (tcon->status != TID_NEW && in cifs_tree_connect()
4381 tcon->status != TID_NEED_TCON) { in cifs_tree_connect()
4382 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4386 tcon->status = TID_IN_TCON; in cifs_tree_connect()
4387 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4389 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, in cifs_tree_connect()
4390 tcon, tcon->ses->local_nls); in cifs_tree_connect()
4392 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4393 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4394 tcon->status = TID_NEED_TCON; in cifs_tree_connect()
4395 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()
4397 spin_lock(&tcon->tc_lock); in cifs_tree_connect()
4398 if (tcon->status == TID_IN_TCON) in cifs_tree_connect()
4399 tcon->status = TID_GOOD; in cifs_tree_connect()
4400 tcon->need_reconnect = false; in cifs_tree_connect()
4401 spin_unlock(&tcon->tc_lock); in cifs_tree_connect()