Lines Matching full:tcon
120 struct cifs_tcon *tcon = container_of(work,
123 struct TCP_Server_Info *server = tcon->ses->server;
132 rc = server->ops->query_server_interfaces(xid, tcon, false);
143 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
211 struct cifs_tcon *tcon;
270 /* If all channels need reconnect, then tcon needs reconnect */
281 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
282 tcon->need_reconnect = true;
283 spin_lock(&tcon->tc_lock);
284 tcon->status = TID_NEED_RECON;
285 spin_unlock(&tcon->tc_lock);
287 cancel_delayed_work(&tcon->query_interfaces);
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
1966 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1972 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1978 struct cifs_tcon *tcon;
1998 tcon = tcon_info_alloc(false, netfs_trace_tcon_ref_new_ipc);
1999 if (tcon == NULL)
2007 tcon->ses = ses;
2008 tcon->ipc = true;
2009 tcon->seal = seal;
2010 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls);
2015 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc_fail);
2019 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid);
2021 spin_lock(&tcon->tc_lock);
2022 tcon->status = TID_GOOD;
2023 spin_unlock(&tcon->tc_lock);
2024 ses->tcon_ipc = tcon;
2060 struct cifs_tcon *tcon;
2085 tcon = ses->tcon_ipc;
2098 tconInfoFree(tcon, netfs_trace_tcon_ref_free_ipc);
2464 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
2466 struct TCP_Server_Info *server = tcon->ses->server;
2468 if (tcon->status == TID_EXITING)
2471 if (tcon->origin_fullpath) {
2474 tcon->origin_fullpath))
2477 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) {
2480 if (tcon->seal != ctx->seal)
2482 if (tcon->snapshot_time != ctx->snapshot_time)
2484 if (tcon->handle_timeout != ctx->handle_timeout)
2486 if (tcon->no_lease != ctx->no_lease)
2488 if (tcon->nodelete != ctx->nodelete)
2496 struct cifs_tcon *tcon;
2499 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
2500 spin_lock(&tcon->tc_lock);
2501 if (!match_tcon(tcon, ctx)) {
2502 spin_unlock(&tcon->tc_lock);
2505 ++tcon->tc_count;
2506 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
2508 spin_unlock(&tcon->tc_lock);
2510 return tcon;
2517 cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
2523 * IPC tcon share the lifetime of their session and are
2526 if (tcon == NULL || tcon->ipc)
2529 ses = tcon->ses;
2530 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
2532 spin_lock(&tcon->tc_lock);
2533 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count - 1, trace);
2534 if (--tcon->tc_count > 0) {
2535 spin_unlock(&tcon->tc_lock);
2541 WARN_ON(tcon->tc_count < 0);
2543 list_del_init(&tcon->tcon_list);
2544 tcon->status = TID_EXITING;
2545 spin_unlock(&tcon->tc_lock);
2549 cancel_delayed_work_sync(&tcon->query_interfaces);
2551 cancel_delayed_work_sync(&tcon->dfs_cache_work);
2554 if (tcon->use_witness) {
2557 rc = cifs_swn_unregister(tcon);
2566 ses->server->ops->tree_disconnect(xid, tcon);
2569 cifs_fscache_release_super_cookie(tcon);
2570 tconInfoFree(tcon, netfs_trace_tcon_ref_free);
2575 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2579 * - tcon refcount is the number of mount points using the tcon.
2580 * - ses refcount is the number of tcon using the session.
2588 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2589 * its session refcount incremented (1 new tcon). This +1 was
2592 * b) an existing tcon with refcount+1 (add a mount point to it) and
2593 * identical ses refcount (no new tcon). Because of (1) we need to
2599 struct cifs_tcon *tcon;
2603 tcon = cifs_find_tcon(ses, ctx);
2604 if (tcon) {
2606 * tcon has refcount already incremented but we need to
2611 return tcon;
2624 tcon = tcon_info_alloc(!nohandlecache, netfs_trace_tcon_ref_new);
2625 if (tcon == NULL) {
2629 tcon->nohandlecache = nohandlecache;
2638 tcon->snapshot_time = ctx->snapshot_time;
2648 tcon->handle_timeout = ctx->handle_timeout;
2651 tcon->ses = ses;
2653 tcon->password = kstrdup(ctx->password, GFP_KERNEL);
2654 if (!tcon->password) {
2666 } else if (tcon->ses->server->capabilities &
2668 tcon->seal = true;
2678 tcon->posix_extensions = true;
2704 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon,
2707 cifs_dbg(FYI, "Tcon rc = %d\n", rc);
2711 tcon->use_persistent = false;
2721 tcon->use_persistent = true;
2728 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
2732 tcon->use_persistent = true;
2740 tcon->use_resilient = true;
2743 tcon->use_witness = false;
2746 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) {
2751 tcon->use_witness = true;
2753 rc = cifs_swn_register(tcon);
2772 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
2786 tcon->no_lease = ctx->no_lease;
2794 tcon->retry = ctx->retry;
2795 tcon->nocase = ctx->nocase;
2796 tcon->broken_sparse_sup = ctx->no_sparse;
2797 tcon->max_cached_dirs = ctx->max_cached_dirs;
2798 tcon->nodelete = ctx->nodelete;
2799 tcon->local_lease = ctx->local_lease;
2800 INIT_LIST_HEAD(&tcon->pending_opens);
2801 tcon->status = TID_GOOD;
2803 INIT_DELAYED_WORK(&tcon->query_interfaces,
2808 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
2812 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh);
2815 list_add(&tcon->tcon_list, &ses->tcon_list);
2818 return tcon;
2821 tconInfoFree(tcon, netfs_trace_tcon_ref_free_fail);
2893 struct cifs_tcon *tcon,
2904 if (tcon->origin_fullpath &&
2905 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source))
2924 struct cifs_tcon *tcon;
2944 tcon = tlink_tcon(tlink);
2945 ses = tcon->ses;
2953 spin_lock(&tcon->tc_lock);
2956 !match_tcon(tcon, ctx) ||
2957 !match_prepath(sb, tcon, mnt_data)) {
2964 spin_unlock(&tcon->tc_lock);
3252 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3260 * Perhaps we could add a backpointer to array of sb from tcon
3266 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3269 tcon->fsUnixInfo.Capability = 0;
3270 tcon->unix_ext = 0; /* Unix Extensions disabled */
3274 tcon->unix_ext = 1; /* Unix Extensions supported */
3276 if (!tcon->unix_ext) {
3281 if (!CIFSSMBQFSUnixInfo(xid, tcon)) {
3282 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3349 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
3417 if (mnt_ctx->tcon)
3418 cifs_put_tcon(mnt_ctx->tcon, netfs_trace_tcon_ref_put_mnt_ctx);
3424 mnt_ctx->tcon = NULL;
3472 mnt_ctx->tcon = NULL;
3482 struct cifs_tcon *tcon = NULL;
3494 /* search for existing tcon to this server share */
3495 tcon = cifs_get_tcon(mnt_ctx->ses, ctx);
3496 if (IS_ERR(tcon)) {
3497 rc = PTR_ERR(tcon);
3498 tcon = NULL;
3503 if (tcon->posix_extensions)
3508 if (cap_unix(tcon->ses)) {
3513 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx);
3514 spin_lock(&tcon->ses->server->srv_lock);
3515 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
3516 (le64_to_cpu(tcon->fsUnixInfo.Capability) &
3518 spin_unlock(&tcon->ses->server->srv_lock);
3522 spin_unlock(&tcon->ses->server->srv_lock);
3525 tcon->unix_ext = 0; /* server does not support them */
3528 if (!tcon->pipe && server->ops->qfs_tcon) {
3529 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);
3531 if (tcon->fsDevInfo.DeviceCharacteristics &
3547 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) {
3549 round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE);
3560 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
3561 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
3569 cifs_fscache_get_super_cookie(tcon);
3572 mnt_ctx->tcon = tcon;
3577 struct cifs_tcon *tcon)
3581 /* hang the tcon off of the superblock */
3587 tlink->tl_tcon = tcon;
3605 struct cifs_tcon *tcon,
3618 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, "");
3642 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3660 struct cifs_tcon *tcon = mnt_ctx->tcon;
3668 * cifs_build_path_to_root works only when we have a valid tcon
3670 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon,
3671 tcon->Flags & SMB_SHARE_IS_IN_DFS);
3677 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3683 rc = cifs_are_all_path_components_accessible(server, xid, tcon,
3684 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS);
3726 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3757 else if (WARN_ON(!mnt_ctx.tcon))
3769 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3788 const char *tree, struct cifs_tcon *tcon,
3861 tcon->tid = smb_buffer_response->Tid;
3876 tcon->ipc = true;
3877 tcon->pipe = true;
3887 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
3890 kfree(tcon->nativeFileSystem);
3891 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr,
3895 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem);
3900 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
3902 tcon->Flags = 0;
3903 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
3910 * need_reconnect when tcon was successful but needed to be
3913 if (tcon->need_reconnect && tcon->unix_ext) {
3914 cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name);
3915 tcon->need_reconnect = false;
3916 reset_cifs_unix_caps(xid, tcon, NULL, NULL);
4117 struct cifs_tcon *tcon = NULL;
4147 tcon = ERR_PTR(rc);
4158 tcon = (struct cifs_tcon *)ses;
4169 tcon = ERR_CAST(origin_fullpath);
4179 tcon = cifs_get_tcon(ses, ctx);
4180 if (IS_ERR(tcon)) {
4187 spin_lock(&tcon->tc_lock);
4188 tcon->origin_fullpath = origin_fullpath;
4189 spin_unlock(&tcon->tc_lock);
4191 queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work,
4198 reset_cifs_unix_caps(0, tcon, NULL, ctx);
4207 return tcon;
4269 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4273 * the master tcon for the mount.
4275 * First, search the rbtree for an existing tcon for this fsuid. If one
4405 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
4408 const struct smb_version_operations *ops = tcon->ses->server->ops;
4411 spin_lock(&tcon->tc_lock);
4413 /* if tcon is marked for needing reconnect, update state */
4414 if (tcon->need_reconnect)
4415 tcon->status = TID_NEED_TCON;
4417 if (tcon->status == TID_GOOD) {
4418 spin_unlock(&tcon->tc_lock);
4422 if (tcon->status != TID_NEW &&
4423 tcon->status != TID_NEED_TCON) {
4424 spin_unlock(&tcon->tc_lock);
4428 tcon->status = TID_IN_TCON;
4429 spin_unlock(&tcon->tc_lock);
4431 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
4433 spin_lock(&tcon->tc_lock);
4434 if (tcon->status == TID_IN_TCON)
4435 tcon->status = TID_NEED_TCON;
4436 spin_unlock(&tcon->tc_lock);
4438 spin_lock(&tcon->tc_lock);
4439 if (tcon->status == TID_IN_TCON)
4440 tcon->status = TID_GOOD;
4441 tcon->need_reconnect = false;
4442 spin_unlock(&tcon->tc_lock);