Lines Matching +full:tcon +full:- +full:channel
1 // SPDX-License-Identifier: LGPL-2.1
60 GlobalTotalActiveXid--; in _free_xid()
72 spin_lock_init(&ret_buf->ses_lock); in sesInfoAlloc()
73 ret_buf->ses_status = SES_NEW; in sesInfoAlloc()
74 ++ret_buf->ses_count; in sesInfoAlloc()
75 INIT_LIST_HEAD(&ret_buf->smb_ses_list); in sesInfoAlloc()
76 INIT_LIST_HEAD(&ret_buf->tcon_list); in sesInfoAlloc()
77 mutex_init(&ret_buf->session_mutex); in sesInfoAlloc()
78 spin_lock_init(&ret_buf->iface_lock); in sesInfoAlloc()
79 INIT_LIST_HEAD(&ret_buf->iface_list); in sesInfoAlloc()
80 spin_lock_init(&ret_buf->chan_lock); in sesInfoAlloc()
95 unload_nls(buf_to_free->local_nls); in sesInfoFree()
97 kfree(buf_to_free->serverOS); in sesInfoFree()
98 kfree(buf_to_free->serverDomain); in sesInfoFree()
99 kfree(buf_to_free->serverNOS); in sesInfoFree()
100 kfree_sensitive(buf_to_free->password); in sesInfoFree()
101 kfree_sensitive(buf_to_free->password2); in sesInfoFree()
102 kfree(buf_to_free->user_name); in sesInfoFree()
103 kfree(buf_to_free->domainName); in sesInfoFree()
104 kfree(buf_to_free->dns_dom); in sesInfoFree()
105 kfree_sensitive(buf_to_free->auth_key.response); in sesInfoFree()
106 spin_lock(&buf_to_free->iface_lock); in sesInfoFree()
107 list_for_each_entry_safe(iface, niface, &buf_to_free->iface_list, in sesInfoFree()
109 kref_put(&iface->refcount, release_iface); in sesInfoFree()
110 spin_unlock(&buf_to_free->iface_lock); in sesInfoFree()
125 ret_buf->cfids = init_cached_dirs(); in tcon_info_alloc()
126 if (!ret_buf->cfids) { in tcon_info_alloc()
131 /* else ret_buf->cfids is already set to NULL above */ in tcon_info_alloc()
134 ret_buf->status = TID_NEW; in tcon_info_alloc()
135 ret_buf->debug_id = atomic_inc_return(&tcon_debug_id); in tcon_info_alloc()
136 ret_buf->tc_count = 1; in tcon_info_alloc()
137 spin_lock_init(&ret_buf->tc_lock); in tcon_info_alloc()
138 INIT_LIST_HEAD(&ret_buf->openFileList); in tcon_info_alloc()
139 INIT_LIST_HEAD(&ret_buf->tcon_list); in tcon_info_alloc()
140 spin_lock_init(&ret_buf->open_file_lock); in tcon_info_alloc()
141 spin_lock_init(&ret_buf->stat_lock); in tcon_info_alloc()
142 atomic_set(&ret_buf->num_local_opens, 0); in tcon_info_alloc()
143 atomic_set(&ret_buf->num_remote_opens, 0); in tcon_info_alloc()
144 ret_buf->stats_from_time = ktime_get_real_seconds(); in tcon_info_alloc()
146 mutex_init(&ret_buf->fscache_lock); in tcon_info_alloc()
148 trace_smb3_tcon_ref(ret_buf->debug_id, ret_buf->tc_count, trace); in tcon_info_alloc()
150 INIT_LIST_HEAD(&ret_buf->dfs_ses_list); in tcon_info_alloc()
157 tconInfoFree(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in tconInfoFree() argument
159 if (tcon == NULL) { in tconInfoFree()
163 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, trace); in tconInfoFree()
164 free_cached_dirs(tcon->cfids); in tconInfoFree()
166 kfree(tcon->nativeFileSystem); in tconInfoFree()
167 kfree_sensitive(tcon->password); in tconInfoFree()
168 kfree(tcon->origin_fullpath); in tconInfoFree()
169 kfree(tcon); in tconInfoFree()
177 * SMB2 header is bigger than CIFS one - no problems to clean some in cifs_buf_get()
183 * We could use negotiated size instead of max_msgsize - in cifs_buf_get()
219 /* We could use negotiated size instead of max_msgsize - in cifs_small_buf_get()
268 buffer->smb_buf_length = cpu_to_be32( in header_assemble()
269 (2 * word_count) + sizeof(struct smb_hdr) - in header_assemble()
273 buffer->Protocol[0] = 0xFF; in header_assemble()
274 buffer->Protocol[1] = 'S'; in header_assemble()
275 buffer->Protocol[2] = 'M'; in header_assemble()
276 buffer->Protocol[3] = 'B'; in header_assemble()
277 buffer->Command = smb_command; in header_assemble()
278 buffer->Flags = 0x00; /* case sensitive */ in header_assemble()
279 buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; in header_assemble()
280 buffer->Pid = cpu_to_le16((__u16)current->tgid); in header_assemble()
281 buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16)); in header_assemble()
283 buffer->Tid = treeCon->tid; in header_assemble()
284 if (treeCon->ses) { in header_assemble()
285 if (treeCon->ses->capabilities & CAP_UNICODE) in header_assemble()
286 buffer->Flags2 |= SMBFLG2_UNICODE; in header_assemble()
287 if (treeCon->ses->capabilities & CAP_STATUS32) in header_assemble()
288 buffer->Flags2 |= SMBFLG2_ERR_STATUS; in header_assemble()
291 buffer->Uid = treeCon->ses->Suid; in header_assemble()
292 if (treeCon->ses->server) in header_assemble()
293 buffer->Mid = get_next_mid(treeCon->ses->server); in header_assemble()
295 if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) in header_assemble()
296 buffer->Flags2 |= SMBFLG2_DFS; in header_assemble()
297 if (treeCon->nocase) in header_assemble()
298 buffer->Flags |= SMBFLG_CASELESS; in header_assemble()
299 if ((treeCon->ses) && (treeCon->ses->server)) in header_assemble()
300 if (treeCon->ses->server->sign) in header_assemble()
301 buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; in header_assemble()
305 buffer->WordCount = (char) word_count; in header_assemble()
313 if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) { in check_smb_hdr()
315 *(unsigned int *)smb->Protocol); in check_smb_hdr()
320 if (smb->Flags & SMBFLG_RESPONSE) in check_smb_hdr()
324 if (smb->Command == SMB_COM_LOCKING_ANDX) in check_smb_hdr()
336 __u32 rfclen = be32_to_cpu(smb->smb_buf_length); in checkSMB()
343 if ((total_read >= sizeof(struct smb_hdr) - 1) in checkSMB()
344 && (smb->Status.CifsError != 0)) { in checkSMB()
346 smb->WordCount = 0; in checkSMB()
350 (smb->WordCount == 0)) { in checkSMB()
369 return -EIO; in checkSMB()
370 } else if (total_read < sizeof(*smb) + 2 * smb->WordCount) { in checkSMB()
372 __func__, smb->WordCount); in checkSMB()
373 return -EIO; in checkSMB()
378 return -EIO; in checkSMB()
384 return -EIO; in checkSMB()
401 return -EIO; in checkSMB()
414 return -EIO; in checkSMB()
427 struct cifs_tcon *tcon; in is_valid_oplock_break() local
432 if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && in is_valid_oplock_break()
433 (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { in is_valid_oplock_break()
438 size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length); in is_valid_oplock_break()
441 data_offset = le32_to_cpu(pSMBr->DataOffset); in is_valid_oplock_break()
444 len - sizeof(struct file_notify_information)) { in is_valid_oplock_break()
450 ((char *)&pSMBr->hdr.Protocol + data_offset); in is_valid_oplock_break()
452 pnotify->FileName, pnotify->Action); in is_valid_oplock_break()
457 if (pSMBr->hdr.Status.CifsError) { in is_valid_oplock_break()
459 pSMBr->hdr.Status.CifsError); in is_valid_oplock_break()
464 if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) in is_valid_oplock_break()
466 if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { in is_valid_oplock_break()
468 break - harmless race between close request and oplock in is_valid_oplock_break()
472 le32_to_cpu(pSMB->hdr.Status.CifsError)) { in is_valid_oplock_break()
476 le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { in is_valid_oplock_break()
482 if (pSMB->hdr.WordCount != 8) in is_valid_oplock_break()
486 pSMB->LockType, pSMB->OplockLevel); in is_valid_oplock_break()
487 if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) in is_valid_oplock_break()
490 /* If server is a channel, select the primary channel */ in is_valid_oplock_break()
491 pserver = SERVER_IS_CHAN(srv) ? srv->primary_server : srv; in is_valid_oplock_break()
493 /* look up tcon based on tid & uid */ in is_valid_oplock_break()
495 list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { in is_valid_oplock_break()
498 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in is_valid_oplock_break()
499 if (tcon->tid != buf->Tid) in is_valid_oplock_break()
502 cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks); in is_valid_oplock_break()
503 spin_lock(&tcon->open_file_lock); in is_valid_oplock_break()
504 list_for_each_entry(netfile, &tcon->openFileList, tlist) { in is_valid_oplock_break()
505 if (pSMB->Fid != netfile->fid.netfid) in is_valid_oplock_break()
509 pCifsInode = CIFS_I(d_inode(netfile->dentry)); in is_valid_oplock_break()
512 &pCifsInode->flags); in is_valid_oplock_break()
514 netfile->oplock_epoch = 0; in is_valid_oplock_break()
515 netfile->oplock_level = pSMB->OplockLevel; in is_valid_oplock_break()
516 netfile->oplock_break_cancelled = false; in is_valid_oplock_break()
519 spin_unlock(&tcon->open_file_lock); in is_valid_oplock_break()
523 spin_unlock(&tcon->open_file_lock); in is_valid_oplock_break()
530 cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); in is_valid_oplock_break()
547 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { in cifs_autodisable_serverino()
548 struct cifs_tcon *tcon = NULL; in cifs_autodisable_serverino() local
550 if (cifs_sb->master_tlink) in cifs_autodisable_serverino()
551 tcon = cifs_sb_master_tcon(cifs_sb); in cifs_autodisable_serverino()
553 cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; in cifs_autodisable_serverino()
554 cifs_sb->mnt_cifs_serverino_autodisabled = true; in cifs_autodisable_serverino()
556 tcon ? tcon->tree_name : "new server"); in cifs_autodisable_serverino()
568 cinode->oplock = CIFS_CACHE_WRITE_FLG | CIFS_CACHE_READ_FLG; in cifs_set_oplock_level()
570 &cinode->netfs.inode); in cifs_set_oplock_level()
572 cinode->oplock = CIFS_CACHE_READ_FLG; in cifs_set_oplock_level()
574 &cinode->netfs.inode); in cifs_set_oplock_level()
576 cinode->oplock = 0; in cifs_set_oplock_level()
588 rc = wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK, in cifs_get_writer()
593 spin_lock(&cinode->writers_lock); in cifs_get_writer()
594 if (!cinode->writers) in cifs_get_writer()
595 set_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_get_writer()
596 cinode->writers++; in cifs_get_writer()
598 if (test_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags)) { in cifs_get_writer()
599 cinode->writers--; in cifs_get_writer()
600 if (cinode->writers == 0) { in cifs_get_writer()
601 clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_get_writer()
602 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); in cifs_get_writer()
604 spin_unlock(&cinode->writers_lock); in cifs_get_writer()
607 spin_unlock(&cinode->writers_lock); in cifs_get_writer()
613 spin_lock(&cinode->writers_lock); in cifs_put_writer()
614 cinode->writers--; in cifs_put_writer()
615 if (cinode->writers == 0) { in cifs_put_writer()
616 clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_put_writer()
617 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); in cifs_put_writer()
619 spin_unlock(&cinode->writers_lock); in cifs_put_writer()
623 * cifs_queue_oplock_break - queue the oplock break handler for cfile
629 * Assumes the tcon->open_file_lock is held.
630 * Assumes cfile->file_info_lock is NOT held.
642 queue_work(cifsoplockd_wq, &cfile->oplock_break); in cifs_queue_oplock_break()
647 clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); in cifs_done_oplock_break()
648 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK); in cifs_done_oplock_break()
654 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) { in backup_cred()
655 if (uid_eq(cifs_sb->ctx->backupuid, current_fsuid())) in backup_cred()
658 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) { in backup_cred()
659 if (in_group_p(cifs_sb->ctx->backupgid)) in backup_cred()
669 spin_lock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_del_pending_open()
670 list_del(&open->olist); in cifs_del_pending_open()
671 spin_unlock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_del_pending_open()
678 memcpy(open->lease_key, fid->lease_key, SMB2_LEASE_KEY_SIZE); in cifs_add_pending_open_locked()
679 open->oplock = CIFS_OPLOCK_NO_CHANGE; in cifs_add_pending_open_locked()
680 open->tlink = tlink; in cifs_add_pending_open_locked()
681 fid->pending_open = open; in cifs_add_pending_open_locked()
682 list_add_tail(&open->olist, &tlink_tcon(tlink)->pending_opens); in cifs_add_pending_open_locked()
689 spin_lock(&tlink_tcon(tlink)->open_file_lock); in cifs_add_pending_open()
691 spin_unlock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_add_pending_open()
704 list_for_each_entry(dclose, &CIFS_I(d_inode(cfile->dentry))->deferred_closes, dlist) { in cifs_is_deferred_close()
705 if ((dclose->netfid == cfile->fid.netfid) && in cifs_is_deferred_close()
706 (dclose->persistent_fid == cfile->fid.persistent_fid) && in cifs_is_deferred_close()
707 (dclose->volatile_fid == cfile->fid.volatile_fid)) { in cifs_is_deferred_close()
730 dclose->tlink = cfile->tlink; in cifs_add_deferred_close()
731 dclose->netfid = cfile->fid.netfid; in cifs_add_deferred_close()
732 dclose->persistent_fid = cfile->fid.persistent_fid; in cifs_add_deferred_close()
733 dclose->volatile_fid = cfile->fid.volatile_fid; in cifs_add_deferred_close()
734 list_add_tail(&dclose->dlist, &CIFS_I(d_inode(cfile->dentry))->deferred_closes); in cifs_add_deferred_close()
749 list_del(&dclose->dlist); in cifs_del_deferred_close()
763 spin_lock(&cifs_inode->open_file_lock); in cifs_close_deferred_file()
764 list_for_each_entry(cfile, &cifs_inode->openFileList, flist) { in cifs_close_deferred_file()
765 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_deferred_file()
766 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_deferred_file()
767 spin_lock(&cifs_inode->deferred_lock); in cifs_close_deferred_file()
769 spin_unlock(&cifs_inode->deferred_lock); in cifs_close_deferred_file()
774 tmp_list->cfile = cfile; in cifs_close_deferred_file()
775 list_add_tail(&tmp_list->list, &file_head); in cifs_close_deferred_file()
779 spin_unlock(&cifs_inode->open_file_lock); in cifs_close_deferred_file()
782 _cifsFileInfo_put(tmp_list->cfile, false, false); in cifs_close_deferred_file()
783 list_del(&tmp_list->list); in cifs_close_deferred_file()
789 cifs_close_all_deferred_files(struct cifs_tcon *tcon) in cifs_close_all_deferred_files() argument
795 spin_lock(&tcon->open_file_lock); in cifs_close_all_deferred_files()
796 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_close_all_deferred_files()
797 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_all_deferred_files()
798 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_all_deferred_files()
799 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_all_deferred_files()
801 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_all_deferred_files()
806 tmp_list->cfile = cfile; in cifs_close_all_deferred_files()
807 list_add_tail(&tmp_list->list, &file_head); in cifs_close_all_deferred_files()
811 spin_unlock(&tcon->open_file_lock); in cifs_close_all_deferred_files()
814 _cifsFileInfo_put(tmp_list->cfile, true, false); in cifs_close_all_deferred_files()
815 list_del(&tmp_list->list); in cifs_close_all_deferred_files()
820 cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path) in cifs_close_deferred_file_under_dentry() argument
829 spin_lock(&tcon->open_file_lock); in cifs_close_deferred_file_under_dentry()
830 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_close_deferred_file_under_dentry()
831 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_close_deferred_file_under_dentry()
833 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_deferred_file_under_dentry()
834 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_deferred_file_under_dentry()
835 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_deferred_file_under_dentry()
837 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_deferred_file_under_dentry()
842 tmp_list->cfile = cfile; in cifs_close_deferred_file_under_dentry()
843 list_add_tail(&tmp_list->list, &file_head); in cifs_close_deferred_file_under_dentry()
848 spin_unlock(&tcon->open_file_lock); in cifs_close_deferred_file_under_dentry()
851 _cifsFileInfo_put(tmp_list->cfile, true, false); in cifs_close_deferred_file_under_dentry()
852 list_del(&tmp_list->list); in cifs_close_deferred_file_under_dentry()
871 spin_lock(&cinode->open_file_lock); in cifs_mark_open_handles_for_deleted_file()
878 if (inode->i_nlink > 1) { in cifs_mark_open_handles_for_deleted_file()
879 list_for_each_entry(cfile, &cinode->openFileList, flist) { in cifs_mark_open_handles_for_deleted_file()
880 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_mark_open_handles_for_deleted_file()
882 cfile->status_file_deleted = true; in cifs_mark_open_handles_for_deleted_file()
885 list_for_each_entry(cfile, &cinode->openFileList, flist) in cifs_mark_open_handles_for_deleted_file()
886 cfile->status_file_deleted = true; in cifs_mark_open_handles_for_deleted_file()
888 spin_unlock(&cinode->open_file_lock); in cifs_mark_open_handles_for_deleted_file()
895 * - on success - 0
896 * - on failure - errno
909 *num_of_nodes = le16_to_cpu(rsp->NumberOfReferrals); in parse_dfs_referrals()
914 rc = -ENOENT; in parse_dfs_referrals()
918 ref = (struct dfs_referral_level_3 *) &(rsp->referrals); in parse_dfs_referrals()
919 if (ref->VersionNumber != cpu_to_le16(3)) { in parse_dfs_referrals()
921 le16_to_cpu(ref->VersionNumber)); in parse_dfs_referrals()
922 rc = -EINVAL; in parse_dfs_referrals()
930 *num_of_nodes, le32_to_cpu(rsp->DFSFlags)); in parse_dfs_referrals()
935 rc = -ENOMEM; in parse_dfs_referrals()
945 node->flags = le32_to_cpu(rsp->DFSFlags); in parse_dfs_referrals()
950 rc = -ENOMEM; in parse_dfs_referrals()
955 node->path_consumed = cifs_utf16_bytes(tmp, in parse_dfs_referrals()
956 le16_to_cpu(rsp->PathConsumed), in parse_dfs_referrals()
960 node->path_consumed = le16_to_cpu(rsp->PathConsumed); in parse_dfs_referrals()
962 node->server_type = le16_to_cpu(ref->ServerType); in parse_dfs_referrals()
963 node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags); in parse_dfs_referrals()
966 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset); in parse_dfs_referrals()
967 max_len = data_end - temp; in parse_dfs_referrals()
968 node->path_name = cifs_strndup_from_utf16(temp, max_len, in parse_dfs_referrals()
970 if (!node->path_name) { in parse_dfs_referrals()
971 rc = -ENOMEM; in parse_dfs_referrals()
976 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset); in parse_dfs_referrals()
977 max_len = data_end - temp; in parse_dfs_referrals()
978 node->node_name = cifs_strndup_from_utf16(temp, max_len, in parse_dfs_referrals()
980 if (!node->node_name) { in parse_dfs_referrals()
981 rc = -ENOMEM; in parse_dfs_referrals()
985 node->ttl = le32_to_cpu(ref->TimeToLive); in parse_dfs_referrals()
1000 * cifs_alloc_hash - allocate hash and hash context together
1028 return -ENOMEM; in cifs_alloc_hash()
1031 (*sdesc)->tfm = alg; in cifs_alloc_hash()
1036 * cifs_free_hash - free hash and hash context together
1047 if ((*sdesc)->tfm) { in cifs_free_hash()
1048 crypto_free_shash((*sdesc)->tfm); in cifs_free_hash()
1049 (*sdesc)->tfm = NULL; in cifs_free_hash()
1070 *len = end - unc; in extract_unc_hostname()
1074 * copy_path_name - copy src path to dst, possibly truncating
1086 * will truncate and strlen(dst) will be PATH_MAX-1 in copy_path_name()
1090 name_len = PATH_MAX-1; in copy_path_name()
1106 struct cifs_tcon *t1 = sd->data, *t2; in tcon_super_cb()
1108 if (sd->sb) in tcon_super_cb()
1114 spin_lock(&t2->tc_lock); in tcon_super_cb()
1115 if ((t1->ses == t2->ses || in tcon_super_cb()
1116 t1->ses->dfs_root_ses == t2->ses->dfs_root_ses) && in tcon_super_cb()
1117 t1->ses->server == t2->ses->server && in tcon_super_cb()
1118 t2->origin_fullpath && in tcon_super_cb()
1119 dfs_src_pathname_equal(t2->origin_fullpath, t1->origin_fullpath)) in tcon_super_cb()
1120 sd->sb = sb; in tcon_super_cb()
1121 spin_unlock(&t2->tc_lock); in tcon_super_cb()
1148 return ERR_PTR(-EINVAL); in __cifs_get_super()
1157 struct super_block *cifs_get_dfs_tcon_super(struct cifs_tcon *tcon) in cifs_get_dfs_tcon_super() argument
1159 spin_lock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1160 if (!tcon->origin_fullpath) { in cifs_get_dfs_tcon_super()
1161 spin_unlock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1162 return ERR_PTR(-ENOENT); in cifs_get_dfs_tcon_super()
1164 spin_unlock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1165 return __cifs_get_super(tcon_super_cb, tcon); in cifs_get_dfs_tcon_super()
1185 rc = dns_resolve_name(server->dns_dom, host, hostlen, in match_target_ip()
1190 spin_lock(&server->srv_lock); in match_target_ip()
1191 *result = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, (struct sockaddr *)&ss); in match_target_ip()
1192 spin_unlock(&server->srv_lock); in match_target_ip()
1201 kfree(cifs_sb->prepath); in cifs_update_super_prepath()
1202 cifs_sb->prepath = NULL; in cifs_update_super_prepath()
1205 cifs_sb->prepath = cifs_sanitize_prepath(prefix, GFP_ATOMIC); in cifs_update_super_prepath()
1206 if (IS_ERR(cifs_sb->prepath)) { in cifs_update_super_prepath()
1207 rc = PTR_ERR(cifs_sb->prepath); in cifs_update_super_prepath()
1208 cifs_sb->prepath = NULL; in cifs_update_super_prepath()
1211 if (cifs_sb->prepath) in cifs_update_super_prepath()
1212 convert_delimiter(cifs_sb->prepath, CIFS_DIR_SEP(cifs_sb)); in cifs_update_super_prepath()
1215 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; in cifs_update_super_prepath()
1223 * non-ASCII unicode symbols.
1226 struct cifs_tcon *tcon, in cifs_inval_name_dfs_link_error() argument
1231 struct TCP_Server_Info *server = tcon->ses->server; in cifs_inval_name_dfs_link_error()
1232 struct cifs_ses *ses = tcon->ses; in cifs_inval_name_dfs_link_error()
1240 * Fast path - skip check when @full_path doesn't have a prefix path to in cifs_inval_name_dfs_link_error()
1241 * look up or tcon is not DFS. in cifs_inval_name_dfs_link_error()
1244 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) || in cifs_inval_name_dfs_link_error()
1245 !is_tcon_dfs(tcon)) in cifs_inval_name_dfs_link_error()
1248 spin_lock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1249 if (!server->leaf_fullpath) { in cifs_inval_name_dfs_link_error()
1250 spin_unlock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1253 spin_unlock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1256 * Slow path - tcon is DFS and @full_path has prefix path, so attempt in cifs_inval_name_dfs_link_error()
1259 len = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1) + strlen(full_path) + 1; in cifs_inval_name_dfs_link_error()
1262 return -ENOMEM; in cifs_inval_name_dfs_link_error()
1264 scnprintf(path, len, "%s%s", tcon->tree_name, full_path); in cifs_inval_name_dfs_link_error()
1265 ref_path = dfs_cache_canonical_path(path + 1, cifs_sb->local_nls, in cifs_inval_name_dfs_link_error()
1270 if (PTR_ERR(ref_path) != -EINVAL) in cifs_inval_name_dfs_link_error()
1283 if (ses->server->ops->get_dfs_refer && in cifs_inval_name_dfs_link_error()
1284 !ses->server->ops->get_dfs_refer(xid, ses, ref_path, &refs, in cifs_inval_name_dfs_link_error()
1285 &num_refs, cifs_sb->local_nls, in cifs_inval_name_dfs_link_error()
1300 spin_lock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1301 if (server->tcpStatus != CifsNeedReconnect) { in cifs_wait_for_server_reconnect()
1302 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1305 timeout *= server->nr_targets; in cifs_wait_for_server_reconnect()
1306 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1310 * reconnect -- should be greater than cifs socket timeout which is 7 in cifs_wait_for_server_reconnect()
1314 * process is killed or server comes back on-line. in cifs_wait_for_server_reconnect()
1317 rc = wait_event_interruptible_timeout(server->response_q, in cifs_wait_for_server_reconnect()
1318 (server->tcpStatus != CifsNeedReconnect), in cifs_wait_for_server_reconnect()
1323 return -ERESTARTSYS; in cifs_wait_for_server_reconnect()
1327 spin_lock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1328 if (server->tcpStatus != CifsNeedReconnect) { in cifs_wait_for_server_reconnect()
1329 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1332 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1336 return -EHOSTDOWN; in cifs_wait_for_server_reconnect()