Lines Matching refs:tcon

122 	struct cifs_tcon *tcon = container_of(work,
129 rc = SMB3_request_interfaces(0, tcon, false);
138 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
204 struct cifs_tcon *tcon;
257 /* If all channels need reconnect, then tcon needs reconnect */
268 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
269 tcon->need_reconnect = true;
270 spin_lock(&tcon->tc_lock);
271 tcon->status = TID_NEED_RECON;
272 spin_unlock(&tcon->tc_lock);
274 cancel_delayed_work(&tcon->query_interfaces);
371 * the smb session (and tcon) for reconnect as well. This value
533 * process waiting for reconnect will know it needs to re-establish session and tcon
1890 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1896 * tcon_ipc. The IPC tcon has the same lifetime as the session.
1902 struct cifs_tcon *tcon;
1922 tcon = tcon_info_alloc(false);
1923 if (tcon == NULL)
1931 tcon->ses = ses;
1932 tcon->ipc = true;
1933 tcon->seal = seal;
1934 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls);
1939 tconInfoFree(tcon);
1943 cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid);
1945 spin_lock(&tcon->tc_lock);
1946 tcon->status = TID_GOOD;
1947 spin_unlock(&tcon->tc_lock);
1948 ses->tcon_ipc = tcon;
1954 * cifs_free_ipc - helper to release the session IPC tcon
1968 struct cifs_tcon *tcon = ses->tcon_ipc;
1970 if (tcon == NULL)
1973 tconInfoFree(tcon);
2387 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
2389 struct TCP_Server_Info *server = tcon->ses->server;
2391 if (tcon->status == TID_EXITING)
2394 if (tcon->origin_fullpath) {
2397 tcon->origin_fullpath))
2400 strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) {
2403 if (tcon->seal != ctx->seal)
2405 if (tcon->snapshot_time != ctx->snapshot_time)
2407 if (tcon->handle_timeout != ctx->handle_timeout)
2409 if (tcon->no_lease != ctx->no_lease)
2411 if (tcon->nodelete != ctx->nodelete)
2419 struct cifs_tcon *tcon;
2422 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
2423 spin_lock(&tcon->tc_lock);
2424 if (!match_tcon(tcon, ctx)) {
2425 spin_unlock(&tcon->tc_lock);
2428 ++tcon->tc_count;
2429 spin_unlock(&tcon->tc_lock);
2431 return tcon;
2438 cifs_put_tcon(struct cifs_tcon *tcon)
2444 * IPC tcon share the lifetime of their session and are
2447 if (tcon == NULL || tcon->ipc)
2450 ses = tcon->ses;
2451 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
2453 spin_lock(&tcon->tc_lock);
2454 if (--tcon->tc_count > 0) {
2455 spin_unlock(&tcon->tc_lock);
2461 WARN_ON(tcon->tc_count < 0);
2463 list_del_init(&tcon->tcon_list);
2464 tcon->status = TID_EXITING;
2465 spin_unlock(&tcon->tc_lock);
2469 cancel_delayed_work_sync(&tcon->query_interfaces);
2471 cancel_delayed_work_sync(&tcon->dfs_cache_work);
2474 if (tcon->use_witness) {
2477 rc = cifs_swn_unregister(tcon);
2486 ses->server->ops->tree_disconnect(xid, tcon);
2489 cifs_fscache_release_super_cookie(tcon);
2490 tconInfoFree(tcon);
2495 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2499 * - tcon refcount is the number of mount points using the tcon.
2500 * - ses refcount is the number of tcon using the session.
2508 * a) a new tcon already allocated with refcount=1 (1 mount point) and
2509 * its session refcount incremented (1 new tcon). This +1 was
2512 * b) an existing tcon with refcount+1 (add a mount point to it) and
2513 * identical ses refcount (no new tcon). Because of (1) we need to
2519 struct cifs_tcon *tcon;
2523 tcon = cifs_find_tcon(ses, ctx);
2524 if (tcon) {
2526 * tcon has refcount already incremented but we need to
2531 return tcon;
2544 tcon = tcon_info_alloc(!nohandlecache);
2545 if (tcon == NULL) {
2549 tcon->nohandlecache = nohandlecache;
2558 tcon->snapshot_time = ctx->snapshot_time;
2568 tcon->handle_timeout = ctx->handle_timeout;
2571 tcon->ses = ses;
2573 tcon->password = kstrdup(ctx->password, GFP_KERNEL);
2574 if (!tcon->password) {
2586 } else if (tcon->ses->server->capabilities &
2588 tcon->seal = true;
2598 tcon->posix_extensions = true;
2617 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon,
2624 tcon->use_persistent = false;
2634 tcon->use_persistent = true;
2641 } else if ((tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
2645 tcon->use_persistent = true;
2653 tcon->use_resilient = true;
2656 tcon->use_witness = false;
2659 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER) {
2664 tcon->use_witness = true;
2666 rc = cifs_swn_register(tcon);
2685 if (tcon->share_flags & SMB2_SHAREFLAG_NO_CACHING) {
2699 tcon->no_lease = ctx->no_lease;
2707 tcon->retry = ctx->retry;
2708 tcon->nocase = ctx->nocase;
2709 tcon->broken_sparse_sup = ctx->no_sparse;
2710 tcon->max_cached_dirs = ctx->max_cached_dirs;
2711 tcon->nodelete = ctx->nodelete;
2712 tcon->local_lease = ctx->local_lease;
2713 INIT_LIST_HEAD(&tcon->pending_opens);
2714 tcon->status = TID_GOOD;
2716 INIT_DELAYED_WORK(&tcon->query_interfaces,
2721 queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
2725 INIT_DELAYED_WORK(&tcon->dfs_cache_work, dfs_cache_refresh);
2728 list_add(&tcon->tcon_list, &ses->tcon_list);
2731 return tcon;
2734 tconInfoFree(tcon);
2805 struct cifs_tcon *tcon,
2816 if (tcon->origin_fullpath &&
2817 dfs_src_pathname_equal(tcon->origin_fullpath, ctx->source))
2836 struct cifs_tcon *tcon;
2856 tcon = tlink_tcon(tlink);
2857 ses = tcon->ses;
2865 spin_lock(&tcon->tc_lock);
2868 !match_tcon(tcon, ctx) ||
2869 !match_prepath(sb, tcon, mnt_data)) {
2876 spin_unlock(&tcon->tc_lock);
3144 void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3152 * Perhaps we could add a backpointer to array of sb from tcon
3158 __u64 saved_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3161 tcon->fsUnixInfo.Capability = 0;
3162 tcon->unix_ext = 0; /* Unix Extensions disabled */
3166 tcon->unix_ext = 1; /* Unix Extensions supported */
3168 if (!tcon->unix_ext) {
3173 if (!CIFSSMBQFSUnixInfo(xid, tcon)) {
3174 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3240 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
3308 if (mnt_ctx->tcon)
3309 cifs_put_tcon(mnt_ctx->tcon);
3360 mnt_ctx->tcon = NULL;
3370 struct cifs_tcon *tcon = NULL;
3382 /* search for existing tcon to this server share */
3383 tcon = cifs_get_tcon(mnt_ctx->ses, ctx);
3384 if (IS_ERR(tcon)) {
3385 rc = PTR_ERR(tcon);
3386 tcon = NULL;
3391 if (tcon->posix_extensions)
3396 if (cap_unix(tcon->ses)) {
3401 reset_cifs_unix_caps(mnt_ctx->xid, tcon, cifs_sb, ctx);
3402 spin_lock(&tcon->ses->server->srv_lock);
3403 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) &&
3404 (le64_to_cpu(tcon->fsUnixInfo.Capability) &
3406 spin_unlock(&tcon->ses->server->srv_lock);
3410 spin_unlock(&tcon->ses->server->srv_lock);
3413 tcon->unix_ext = 0; /* server does not support them */
3416 if (!tcon->pipe && server->ops->qfs_tcon) {
3417 server->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);
3419 if (tcon->fsDevInfo.DeviceCharacteristics &
3435 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) {
3437 round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE);
3448 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
3449 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
3457 cifs_fscache_get_super_cookie(tcon);
3460 mnt_ctx->tcon = tcon;
3465 struct cifs_tcon *tcon)
3469 /* hang the tcon off of the superblock */
3475 tlink->tl_tcon = tcon;
3493 struct cifs_tcon *tcon,
3506 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, "");
3530 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3548 struct cifs_tcon *tcon = mnt_ctx->tcon;
3556 * cifs_build_path_to_root works only when we have a valid tcon
3558 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon,
3559 tcon->Flags & SMB_SHARE_IS_IN_DFS);
3565 rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
3571 rc = cifs_are_all_path_components_accessible(server, xid, tcon,
3572 cifs_sb, full_path, tcon->Flags & SMB_SHARE_IS_IN_DFS);
3616 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3648 rc = mount_setup_tlink(cifs_sb, mnt_ctx.ses, mnt_ctx.tcon);
3666 const char *tree, struct cifs_tcon *tcon,
3739 tcon->tid = smb_buffer_response->Tid;
3754 tcon->ipc = true;
3755 tcon->pipe = true;
3765 strscpy(tcon->tree_name, tree, sizeof(tcon->tree_name));
3768 kfree(tcon->nativeFileSystem);
3769 tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr,
3773 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem);
3778 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
3780 tcon->Flags = 0;
3781 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
3981 struct cifs_tcon *tcon = NULL;
4009 tcon = ERR_PTR(rc);
4020 tcon = (struct cifs_tcon *)ses;
4025 tcon = cifs_get_tcon(ses, ctx);
4026 if (IS_ERR(tcon)) {
4033 reset_cifs_unix_caps(0, tcon, NULL, ctx);
4041 return tcon;
4092 * Find or construct an appropriate tcon given a cifs_sb and the fsuid of the
4096 * the master tcon for the mount.
4098 * First, search the rbtree for an existing tcon for this fsuid. If one
4228 int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
4231 const struct smb_version_operations *ops = tcon->ses->server->ops;
4234 spin_lock(&tcon->tc_lock);
4236 /* if tcon is marked for needing reconnect, update state */
4237 if (tcon->need_reconnect)
4238 tcon->status = TID_NEED_TCON;
4240 if (tcon->status == TID_GOOD) {
4241 spin_unlock(&tcon->tc_lock);
4245 if (tcon->status != TID_NEW &&
4246 tcon->status != TID_NEED_TCON) {
4247 spin_unlock(&tcon->tc_lock);
4251 tcon->status = TID_IN_TCON;
4252 spin_unlock(&tcon->tc_lock);
4254 rc = ops->tree_connect(xid, tcon->ses, tcon->tree_name, tcon, nlsc);
4256 spin_lock(&tcon->tc_lock);
4257 if (tcon->status == TID_IN_TCON)
4258 tcon->status = TID_NEED_TCON;
4259 spin_unlock(&tcon->tc_lock);
4261 spin_lock(&tcon->tc_lock);
4262 if (tcon->status == TID_IN_TCON)
4263 tcon->status = TID_GOOD;
4264 tcon->need_reconnect = false;
4265 spin_unlock(&tcon->tc_lock);