Lines Matching defs:tcon

104 	struct cifs_tcon *tcon = container_of(work,
107 struct TCP_Server_Info *server = tcon->ses->server;
116 rc = server->ops->query_server_interfaces(xid, tcon, false);
127 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
195 struct cifs_tcon *tcon;
254 /* If all channels need reconnect, then tcon needs reconnect */
265 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
266 tcon->need_reconnect = true;
267 spin_lock(&tcon->tc_lock);
268 tcon->status = TID_NEED_RECON;
269 spin_unlock(&tcon->tc_lock);
271 cancel_delayed_work(&tcon->query_interfaces);
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
1907 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1913 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1919 struct cifs_tcon *tcon;
1939 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc);
1940 if (tcon == NULL)
1948 tcon->ses = ses;
1949 tcon->ipc = true;
1950 tcon->seal = seal;
1951 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls);
1956 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail);
1960 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid);
1962 spin_lock(&tcon->tc_lock);
1963 tcon->status = TID_GOOD;
1964 spin_unlock(&tcon->tc_lock);
1965 ses->tcon_ipc = tcon;
2001 struct cifs_tcon *tcon;
2026 tcon = ses->tcon_ipc;
2039 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc);
2431 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
2433 struct TCP_Server_Info *server = tcon->ses->server;
2435 if (tcon->status == TID_EXITING)
2438 if (tcon->origin_fullpath) {
2441 tcon->origin_fullpath))
2444 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) {
2447 if (tcon->seal != ctx->seal)
2449 if (tcon->snapshot_time != ctx->snapshot_time)
2451 if (tcon->handle_timeout != ctx->handle_timeout)
2453 if (tcon->no_lease != ctx->no_lease)
2455 if (tcon->nodelete != ctx->nodelete)
2463 struct cifs_tcon *tcon;
2466 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
2467 spin_lock(&tcon->tc_lock);
2468 if (!match_tcon(tcon, ctx)) {
2469 spin_unlock(&tcon->tc_lock);
2472 ++tcon->tc_count;
2473 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
2475 spin_unlock(&tcon->tc_lock);
2477 return tcon;
2484 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
2491 * IPC tcon share the lifetime of their session and are
2494 if (tcon == NULL || tcon->ipc)
2497 ses = tcon->ses;
2498 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
2500 spin_lock(&tcon->tc_lock);
2501 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace);
2502 if (--tcon->tc_count > 0) {
2503 spin_unlock(&tcon->tc_lock);
2509 WARN_ON(tcon->tc_count < 0);
2511 list_del_init(&tcon->tcon_list);
2512 tcon->status = TID_EXITING;
2513 spin_unlock(&tcon->tc_lock);
2517 cancel_delayed_work_sync(&tcon->query_interfaces);
2519 cancel_delayed_work_sync(&tcon->dfs_cache_work);
2520 list_replace_init(&tcon->dfs_ses_list, &ses_list);
2523 if (tcon->use_witness) {
2526 rc = cifs_swn_unregister(tcon);
2535 ses->server->ops->tree_disconnect(xid, tcon);
2538 cifs_fscache_release_super_cookie(tcon);
2539 tconInfoFree(tcon, netfs_trace_tcon_ref_free);
2547 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2551 * - tcon refcount is the number of mount points using the tcon.
2552 * - ses refcount is the number of tcon using the session.
2560 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2561 * its session refcount incremented (1 new tcon). This +1 was
2564 * b) an existing tcon with refcount+1 (add a mount point to it) and
2565 * identical ses refcount (no new tcon). Because of (1) we need to
2571 struct cifs_tcon *tcon;
2575 tcon = cifs_find_tcon(ses, ctx);
2576 if (tcon) {
2578 * tcon has refcount already incremented but we need to
2583 return tcon;
2596 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new);
2597 if (tcon == NULL) {
2601 tcon->nohandlecache = nohandlecache;
2610 tcon->snapshot_time = ctx->snapshot_time;
2620 tcon->handle_timeout = ctx->handle_timeout;
2623 tcon->ses = ses;
2625 tcon->password = kstrdup(ctx->password, GFP_KERNEL);
2626 if (!tcon->password) {
2638 } else if (tcon->ses->server->capabilities &
2640 tcon->seal = true;
2650 tcon->posix_extensions = true;
2676 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon,
2683 tcon->use_persistent = false;
2693 tcon->use_persistent = true;
2700 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
2704 tcon->use_persistent = true;
2712 tcon->use_resilient = true;
2715 tcon->use_witness = false;
2718 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) {
2723 tcon->use_witness = true;
2725 rc = cifs_swn_register(tcon);
2744 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
2758 tcon->no_lease = ctx->no_lease;
2766 tcon->retry = ctx->retry;
2767 tcon->nocase = ctx->nocase;
2768 tcon->broken_sparse_sup = ctx->no_sparse;
2769 tcon->max_cached_dirs = ctx->max_cached_dirs;
2770 tcon->nodelete = ctx->nodelete;
2771 tcon->local_lease = ctx->local_lease;
2772 INIT_LIST_HEAD(&tcon->pending_opens);
2773 tcon->status = TID_GOOD;
2775 INIT_DELAYED_WORK(&tcon->query_interfaces,
2780 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
2784 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh);
2787 list_add(&tcon->tcon_list, &ses->tcon_list);
2790 return tcon;
2793 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail);
2869 struct cifs_tcon *tcon,
2880 if (tcon->origin_fullpath &&
2881 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source))
2900 struct cifs_tcon *tcon;
2920 tcon = tlink_tcon(tlink);
2921 ses = tcon->ses;
2929 spin_lock(&tcon->tc_lock);
2932 !match_tcon(tcon, ctx) ||
2933 !match_prepath(sb, tcon, mnt_data)) {
2940 spin_unlock(&tcon->tc_lock);
3228 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3236 * Perhaps we could add a backpointer to array of sb from tcon
3242 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3245 tcon->fsUnixInfo.Capability = 0;
3246 tcon->unix_ext = 0; /* Unix Extensions disabled */
3250 tcon->unix_ext = 1; /* Unix Extensions supported */
3252 if (!tcon->unix_ext) {
3257 if (!CIFSSMBQFSUnixInfo(xid, tcon)) {
3258 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3325 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
3393 if (mnt_ctx->tcon)
3394 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx);
3400 mnt_ctx->tcon = NULL;
3448 mnt_ctx->tcon = NULL;
3458 struct cifs_tcon *tcon = NULL;
3470 /* search for existing tcon to this server share */
3471 tcon = cifs_get_tcon(mnt_ctx->ses, ctx);
3472 if (IS_ERR(tcon)) {
3473 rc = PTR_ERR(tcon);
3474 tcon = NULL;
3479 if (tcon->posix_extensions)
3484 if (cap_unix(tcon->ses)) {
3489 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx);
3490 spin_lock(&tcon->ses->server->srv_lock);
3491 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
3492 (le64_to_cpu(tcon->fsUnixInfo.Capability) &
3494 spin_unlock(&tcon->ses->server->srv_lock);
3498 spin_unlock(&tcon->ses->server->srv_lock);
3501 tcon->unix_ext = 0; /* server does not support them */
3504 if (!tcon->pipe && server->ops->qfs_tcon) {
3505 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);
3507 if (tcon->fsDevInfo.DeviceCharacteristics &
3523 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) {
3525 round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE);
3536 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
3537 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
3545 cifs_fscache_get_super_cookie(tcon);
3548 mnt_ctx->tcon = tcon;
3553 struct cifs_tcon *tcon)
3557 /* hang the tcon off of the superblock */
3563 tlink->tl_tcon = tcon;
3581 struct cifs_tcon *tcon,
3594 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, "");
3618 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3636 struct cifs_tcon *tcon = mnt_ctx->tcon;
3644 * cifs_build_path_to_root works only when we have a valid tcon
3646 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon,
3647 tcon->Flags & SMB_SHARE_IS_IN_DFS);
3653 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3659 rc = cifs_are_all_path_components_accessible(server, xid, tcon,
3660 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS);
3701 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3732 else if (WARN_ON(!mnt_ctx.tcon))
3744 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3763 const char *tree, struct cifs_tcon *tcon,
3836 tcon->tid = smb_buffer_response->Tid;
3851 tcon->ipc = true;
3852 tcon->pipe = true;
3862 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
3865 kfree(tcon->nativeFileSystem);
3866 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr,
3870 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem);
3875 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
3877 tcon->Flags = 0;
3878 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
3885 * need_reconnect when tcon was successful but needed to be
3888 if (tcon->need_reconnect && tcon->unix_ext) {
3889 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name);
3890 tcon->need_reconnect = false;
3891 reset_cifs_unix_caps(xid, tcon, NULL, NULL);
4092 struct cifs_tcon *tcon = NULL;
4122 tcon = ERR_PTR(rc);
4133 tcon = ERR_CAST(ses);
4144 tcon = ERR_CAST(origin_fullpath);
4154 tcon = cifs_get_tcon(ses, ctx);
4155 if (IS_ERR(tcon)) {
4162 spin_lock(&tcon->tc_lock);
4163 tcon->origin_fullpath = origin_fullpath;
4164 spin_unlock(&tcon->tc_lock);
4166 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work,
4173 reset_cifs_unix_caps(0, tcon, NULL, ctx);
4182 return tcon;
4233 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4237 * the master tcon for the mount.
4239 * First, search the rbtree for an existing tcon for this fsuid. If one
4376 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon)
4378 const struct smb_version_operations *ops = tcon->ses->server->ops;
4382 spin_lock(&tcon->tc_lock);
4384 /* if tcon is marked for needing reconnect, update state */
4385 if (tcon->need_reconnect)
4386 tcon->status = TID_NEED_TCON;
4388 if (tcon->status == TID_GOOD) {
4389 spin_unlock(&tcon->tc_lock);
4393 if (tcon->status != TID_NEW &&
4394 tcon->status != TID_NEED_TCON) {
4395 spin_unlock(&tcon->tc_lock);
4399 tcon->status = TID_IN_TCON;
4400 spin_unlock(&tcon->tc_lock);
4402 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name,
4403 tcon, tcon->ses->local_nls);
4405 spin_lock(&tcon->tc_lock);
4406 if (tcon->status == TID_IN_TCON)
4407 tcon->status = TID_NEED_TCON;
4408 spin_unlock(&tcon->tc_lock);
4410 spin_lock(&tcon->tc_lock);
4411 if (tcon->status == TID_IN_TCON)
4412 tcon->status = TID_GOOD;
4413 tcon->need_reconnect = false;
4414 spin_unlock(&tcon->tc_lock);