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_sensitive(buf_to_free->auth_key.response); in sesInfoFree()
105 spin_lock(&buf_to_free->iface_lock); in sesInfoFree()
106 list_for_each_entry_safe(iface, niface, &buf_to_free->iface_list, in sesInfoFree()
108 kref_put(&iface->refcount, release_iface); in sesInfoFree()
109 spin_unlock(&buf_to_free->iface_lock); in sesInfoFree()
124 ret_buf->cfids = init_cached_dirs(); in tcon_info_alloc()
125 if (!ret_buf->cfids) { in tcon_info_alloc()
130 /* else ret_buf->cfids is already set to NULL above */ in tcon_info_alloc()
133 ret_buf->status = TID_NEW; in tcon_info_alloc()
134 ret_buf->debug_id = atomic_inc_return(&tcon_debug_id); in tcon_info_alloc()
135 ret_buf->tc_count = 1; in tcon_info_alloc()
136 spin_lock_init(&ret_buf->tc_lock); in tcon_info_alloc()
137 INIT_LIST_HEAD(&ret_buf->openFileList); in tcon_info_alloc()
138 INIT_LIST_HEAD(&ret_buf->tcon_list); in tcon_info_alloc()
139 spin_lock_init(&ret_buf->open_file_lock); in tcon_info_alloc()
140 spin_lock_init(&ret_buf->stat_lock); in tcon_info_alloc()
141 atomic_set(&ret_buf->num_local_opens, 0); in tcon_info_alloc()
142 atomic_set(&ret_buf->num_remote_opens, 0); in tcon_info_alloc()
143 ret_buf->stats_from_time = ktime_get_real_seconds(); in tcon_info_alloc()
145 mutex_init(&ret_buf->fscache_lock); in tcon_info_alloc()
147 trace_smb3_tcon_ref(ret_buf->debug_id, ret_buf->tc_count, trace); in tcon_info_alloc()
149 INIT_LIST_HEAD(&ret_buf->dfs_ses_list); in tcon_info_alloc()
156 tconInfoFree(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) in tconInfoFree() argument
158 if (tcon == NULL) { in tconInfoFree()
162 trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, trace); in tconInfoFree()
163 free_cached_dirs(tcon->cfids); in tconInfoFree()
165 kfree(tcon->nativeFileSystem); in tconInfoFree()
166 kfree_sensitive(tcon->password); in tconInfoFree()
167 kfree(tcon->origin_fullpath); in tconInfoFree()
168 kfree(tcon); in tconInfoFree()
176 * SMB2 header is bigger than CIFS one - no problems to clean some in cifs_buf_get()
182 * We could use negotiated size instead of max_msgsize - in cifs_buf_get()
218 /* We could use negotiated size instead of max_msgsize - in cifs_small_buf_get()
267 buffer->smb_buf_length = cpu_to_be32( in header_assemble()
268 (2 * word_count) + sizeof(struct smb_hdr) - in header_assemble()
272 buffer->Protocol[0] = 0xFF; in header_assemble()
273 buffer->Protocol[1] = 'S'; in header_assemble()
274 buffer->Protocol[2] = 'M'; in header_assemble()
275 buffer->Protocol[3] = 'B'; in header_assemble()
276 buffer->Command = smb_command; in header_assemble()
277 buffer->Flags = 0x00; /* case sensitive */ in header_assemble()
278 buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; in header_assemble()
279 buffer->Pid = cpu_to_le16((__u16)current->tgid); in header_assemble()
280 buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16)); in header_assemble()
282 buffer->Tid = treeCon->tid; in header_assemble()
283 if (treeCon->ses) { in header_assemble()
284 if (treeCon->ses->capabilities & CAP_UNICODE) in header_assemble()
285 buffer->Flags2 |= SMBFLG2_UNICODE; in header_assemble()
286 if (treeCon->ses->capabilities & CAP_STATUS32) in header_assemble()
287 buffer->Flags2 |= SMBFLG2_ERR_STATUS; in header_assemble()
290 buffer->Uid = treeCon->ses->Suid; in header_assemble()
291 if (treeCon->ses->server) in header_assemble()
292 buffer->Mid = get_next_mid(treeCon->ses->server); in header_assemble()
294 if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) in header_assemble()
295 buffer->Flags2 |= SMBFLG2_DFS; in header_assemble()
296 if (treeCon->nocase) in header_assemble()
297 buffer->Flags |= SMBFLG_CASELESS; in header_assemble()
298 if ((treeCon->ses) && (treeCon->ses->server)) in header_assemble()
299 if (treeCon->ses->server->sign) in header_assemble()
300 buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; in header_assemble()
304 buffer->WordCount = (char) word_count; in header_assemble()
312 if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) { in check_smb_hdr()
314 *(unsigned int *)smb->Protocol); in check_smb_hdr()
319 if (smb->Flags & SMBFLG_RESPONSE) in check_smb_hdr()
323 if (smb->Command == SMB_COM_LOCKING_ANDX) in check_smb_hdr()
335 __u32 rfclen = be32_to_cpu(smb->smb_buf_length); in checkSMB()
342 if ((total_read >= sizeof(struct smb_hdr) - 1) in checkSMB()
343 && (smb->Status.CifsError != 0)) { in checkSMB()
345 smb->WordCount = 0; in checkSMB()
349 (smb->WordCount == 0)) { in checkSMB()
368 return -EIO; in checkSMB()
369 } else if (total_read < sizeof(*smb) + 2 * smb->WordCount) { in checkSMB()
371 __func__, smb->WordCount); in checkSMB()
372 return -EIO; in checkSMB()
377 return -EIO; in checkSMB()
383 return -EIO; in checkSMB()
400 return -EIO; in checkSMB()
413 return -EIO; in checkSMB()
426 struct cifs_tcon *tcon; in is_valid_oplock_break() local
431 if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && in is_valid_oplock_break()
432 (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { in is_valid_oplock_break()
437 size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length); in is_valid_oplock_break()
440 data_offset = le32_to_cpu(pSMBr->DataOffset); in is_valid_oplock_break()
443 len - sizeof(struct file_notify_information)) { in is_valid_oplock_break()
449 ((char *)&pSMBr->hdr.Protocol + data_offset); in is_valid_oplock_break()
451 pnotify->FileName, pnotify->Action); in is_valid_oplock_break()
456 if (pSMBr->hdr.Status.CifsError) { in is_valid_oplock_break()
458 pSMBr->hdr.Status.CifsError); in is_valid_oplock_break()
463 if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) in is_valid_oplock_break()
465 if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { in is_valid_oplock_break()
467 break - harmless race between close request and oplock in is_valid_oplock_break()
471 le32_to_cpu(pSMB->hdr.Status.CifsError)) { in is_valid_oplock_break()
475 le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { in is_valid_oplock_break()
481 if (pSMB->hdr.WordCount != 8) in is_valid_oplock_break()
485 pSMB->LockType, pSMB->OplockLevel); in is_valid_oplock_break()
486 if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) in is_valid_oplock_break()
489 /* If server is a channel, select the primary channel */ in is_valid_oplock_break()
490 pserver = SERVER_IS_CHAN(srv) ? srv->primary_server : srv; in is_valid_oplock_break()
492 /* look up tcon based on tid & uid */ in is_valid_oplock_break()
494 list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { in is_valid_oplock_break()
497 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { in is_valid_oplock_break()
498 if (tcon->tid != buf->Tid) in is_valid_oplock_break()
501 cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks); in is_valid_oplock_break()
502 spin_lock(&tcon->open_file_lock); in is_valid_oplock_break()
503 list_for_each_entry(netfile, &tcon->openFileList, tlist) { in is_valid_oplock_break()
504 if (pSMB->Fid != netfile->fid.netfid) in is_valid_oplock_break()
508 pCifsInode = CIFS_I(d_inode(netfile->dentry)); in is_valid_oplock_break()
511 &pCifsInode->flags); in is_valid_oplock_break()
513 netfile->oplock_epoch = 0; in is_valid_oplock_break()
514 netfile->oplock_level = pSMB->OplockLevel; in is_valid_oplock_break()
515 netfile->oplock_break_cancelled = false; in is_valid_oplock_break()
518 spin_unlock(&tcon->open_file_lock); in is_valid_oplock_break()
522 spin_unlock(&tcon->open_file_lock); in is_valid_oplock_break()
529 cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); in is_valid_oplock_break()
546 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { in cifs_autodisable_serverino()
547 struct cifs_tcon *tcon = NULL; in cifs_autodisable_serverino() local
549 if (cifs_sb->master_tlink) in cifs_autodisable_serverino()
550 tcon = cifs_sb_master_tcon(cifs_sb); in cifs_autodisable_serverino()
552 cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; in cifs_autodisable_serverino()
553 cifs_sb->mnt_cifs_serverino_autodisabled = true; in cifs_autodisable_serverino()
555 tcon ? tcon->tree_name : "new server"); in cifs_autodisable_serverino()
567 cinode->oplock = CIFS_CACHE_WRITE_FLG | CIFS_CACHE_READ_FLG; in cifs_set_oplock_level()
569 &cinode->netfs.inode); in cifs_set_oplock_level()
571 cinode->oplock = CIFS_CACHE_READ_FLG; in cifs_set_oplock_level()
573 &cinode->netfs.inode); in cifs_set_oplock_level()
575 cinode->oplock = 0; in cifs_set_oplock_level()
587 rc = wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK, in cifs_get_writer()
592 spin_lock(&cinode->writers_lock); in cifs_get_writer()
593 if (!cinode->writers) in cifs_get_writer()
594 set_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_get_writer()
595 cinode->writers++; in cifs_get_writer()
597 if (test_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags)) { in cifs_get_writer()
598 cinode->writers--; in cifs_get_writer()
599 if (cinode->writers == 0) { in cifs_get_writer()
600 clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_get_writer()
601 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); in cifs_get_writer()
603 spin_unlock(&cinode->writers_lock); in cifs_get_writer()
606 spin_unlock(&cinode->writers_lock); in cifs_get_writer()
612 spin_lock(&cinode->writers_lock); in cifs_put_writer()
613 cinode->writers--; in cifs_put_writer()
614 if (cinode->writers == 0) { in cifs_put_writer()
615 clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); in cifs_put_writer()
616 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); in cifs_put_writer()
618 spin_unlock(&cinode->writers_lock); in cifs_put_writer()
622 * cifs_queue_oplock_break - queue the oplock break handler for cfile
628 * Assumes the tcon->open_file_lock is held.
629 * Assumes cfile->file_info_lock is NOT held.
641 queue_work(cifsoplockd_wq, &cfile->oplock_break); in cifs_queue_oplock_break()
646 clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); in cifs_done_oplock_break()
647 wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK); in cifs_done_oplock_break()
653 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) { in backup_cred()
654 if (uid_eq(cifs_sb->ctx->backupuid, current_fsuid())) in backup_cred()
657 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) { in backup_cred()
658 if (in_group_p(cifs_sb->ctx->backupgid)) in backup_cred()
668 spin_lock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_del_pending_open()
669 list_del(&open->olist); in cifs_del_pending_open()
670 spin_unlock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_del_pending_open()
677 memcpy(open->lease_key, fid->lease_key, SMB2_LEASE_KEY_SIZE); in cifs_add_pending_open_locked()
678 open->oplock = CIFS_OPLOCK_NO_CHANGE; in cifs_add_pending_open_locked()
679 open->tlink = tlink; in cifs_add_pending_open_locked()
680 fid->pending_open = open; in cifs_add_pending_open_locked()
681 list_add_tail(&open->olist, &tlink_tcon(tlink)->pending_opens); in cifs_add_pending_open_locked()
688 spin_lock(&tlink_tcon(tlink)->open_file_lock); in cifs_add_pending_open()
690 spin_unlock(&tlink_tcon(open->tlink)->open_file_lock); in cifs_add_pending_open()
703 list_for_each_entry(dclose, &CIFS_I(d_inode(cfile->dentry))->deferred_closes, dlist) { in cifs_is_deferred_close()
704 if ((dclose->netfid == cfile->fid.netfid) && in cifs_is_deferred_close()
705 (dclose->persistent_fid == cfile->fid.persistent_fid) && in cifs_is_deferred_close()
706 (dclose->volatile_fid == cfile->fid.volatile_fid)) { in cifs_is_deferred_close()
729 dclose->tlink = cfile->tlink; in cifs_add_deferred_close()
730 dclose->netfid = cfile->fid.netfid; in cifs_add_deferred_close()
731 dclose->persistent_fid = cfile->fid.persistent_fid; in cifs_add_deferred_close()
732 dclose->volatile_fid = cfile->fid.volatile_fid; in cifs_add_deferred_close()
733 list_add_tail(&dclose->dlist, &CIFS_I(d_inode(cfile->dentry))->deferred_closes); in cifs_add_deferred_close()
748 list_del(&dclose->dlist); in cifs_del_deferred_close()
762 spin_lock(&cifs_inode->open_file_lock); in cifs_close_deferred_file()
763 list_for_each_entry(cfile, &cifs_inode->openFileList, flist) { in cifs_close_deferred_file()
764 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_deferred_file()
765 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_deferred_file()
766 spin_lock(&cifs_inode->deferred_lock); in cifs_close_deferred_file()
768 spin_unlock(&cifs_inode->deferred_lock); in cifs_close_deferred_file()
773 tmp_list->cfile = cfile; in cifs_close_deferred_file()
774 list_add_tail(&tmp_list->list, &file_head); in cifs_close_deferred_file()
778 spin_unlock(&cifs_inode->open_file_lock); in cifs_close_deferred_file()
781 _cifsFileInfo_put(tmp_list->cfile, false, false); in cifs_close_deferred_file()
782 list_del(&tmp_list->list); in cifs_close_deferred_file()
788 cifs_close_all_deferred_files(struct cifs_tcon *tcon) in cifs_close_all_deferred_files() argument
794 spin_lock(&tcon->open_file_lock); in cifs_close_all_deferred_files()
795 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_close_all_deferred_files()
796 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_all_deferred_files()
797 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_all_deferred_files()
798 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_all_deferred_files()
800 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_all_deferred_files()
805 tmp_list->cfile = cfile; in cifs_close_all_deferred_files()
806 list_add_tail(&tmp_list->list, &file_head); in cifs_close_all_deferred_files()
810 spin_unlock(&tcon->open_file_lock); in cifs_close_all_deferred_files()
813 _cifsFileInfo_put(tmp_list->cfile, true, false); in cifs_close_all_deferred_files()
814 list_del(&tmp_list->list); in cifs_close_all_deferred_files()
819 cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path) in cifs_close_deferred_file_under_dentry() argument
828 spin_lock(&tcon->open_file_lock); in cifs_close_deferred_file_under_dentry()
829 list_for_each_entry(cfile, &tcon->openFileList, tlist) { in cifs_close_deferred_file_under_dentry()
830 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_close_deferred_file_under_dentry()
832 if (delayed_work_pending(&cfile->deferred)) { in cifs_close_deferred_file_under_dentry()
833 if (cancel_delayed_work(&cfile->deferred)) { in cifs_close_deferred_file_under_dentry()
834 spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_deferred_file_under_dentry()
836 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock); in cifs_close_deferred_file_under_dentry()
841 tmp_list->cfile = cfile; in cifs_close_deferred_file_under_dentry()
842 list_add_tail(&tmp_list->list, &file_head); in cifs_close_deferred_file_under_dentry()
847 spin_unlock(&tcon->open_file_lock); in cifs_close_deferred_file_under_dentry()
850 _cifsFileInfo_put(tmp_list->cfile, true, false); in cifs_close_deferred_file_under_dentry()
851 list_del(&tmp_list->list); in cifs_close_deferred_file_under_dentry()
870 spin_lock(&cinode->open_file_lock); in cifs_mark_open_handles_for_deleted_file()
877 if (inode->i_nlink > 1) { in cifs_mark_open_handles_for_deleted_file()
878 list_for_each_entry(cfile, &cinode->openFileList, flist) { in cifs_mark_open_handles_for_deleted_file()
879 full_path = build_path_from_dentry(cfile->dentry, page); in cifs_mark_open_handles_for_deleted_file()
881 cfile->status_file_deleted = true; in cifs_mark_open_handles_for_deleted_file()
884 list_for_each_entry(cfile, &cinode->openFileList, flist) in cifs_mark_open_handles_for_deleted_file()
885 cfile->status_file_deleted = true; in cifs_mark_open_handles_for_deleted_file()
887 spin_unlock(&cinode->open_file_lock); in cifs_mark_open_handles_for_deleted_file()
894 * - on success - 0
895 * - on failure - errno
908 *num_of_nodes = le16_to_cpu(rsp->NumberOfReferrals); in parse_dfs_referrals()
913 rc = -EINVAL; in parse_dfs_referrals()
917 ref = (struct dfs_referral_level_3 *) &(rsp->referrals); in parse_dfs_referrals()
918 if (ref->VersionNumber != cpu_to_le16(3)) { in parse_dfs_referrals()
920 le16_to_cpu(ref->VersionNumber)); in parse_dfs_referrals()
921 rc = -EINVAL; in parse_dfs_referrals()
929 *num_of_nodes, le32_to_cpu(rsp->DFSFlags)); in parse_dfs_referrals()
934 rc = -ENOMEM; in parse_dfs_referrals()
944 node->flags = le32_to_cpu(rsp->DFSFlags); in parse_dfs_referrals()
949 rc = -ENOMEM; in parse_dfs_referrals()
954 node->path_consumed = cifs_utf16_bytes(tmp, in parse_dfs_referrals()
955 le16_to_cpu(rsp->PathConsumed), in parse_dfs_referrals()
959 node->path_consumed = le16_to_cpu(rsp->PathConsumed); in parse_dfs_referrals()
961 node->server_type = le16_to_cpu(ref->ServerType); in parse_dfs_referrals()
962 node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags); in parse_dfs_referrals()
965 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset); in parse_dfs_referrals()
966 max_len = data_end - temp; in parse_dfs_referrals()
967 node->path_name = cifs_strndup_from_utf16(temp, max_len, in parse_dfs_referrals()
969 if (!node->path_name) { in parse_dfs_referrals()
970 rc = -ENOMEM; in parse_dfs_referrals()
975 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset); in parse_dfs_referrals()
976 max_len = data_end - temp; in parse_dfs_referrals()
977 node->node_name = cifs_strndup_from_utf16(temp, max_len, in parse_dfs_referrals()
979 if (!node->node_name) { in parse_dfs_referrals()
980 rc = -ENOMEM; in parse_dfs_referrals()
984 node->ttl = le32_to_cpu(ref->TimeToLive); in parse_dfs_referrals()
999 * cifs_alloc_hash - allocate hash and hash context together
1027 return -ENOMEM; in cifs_alloc_hash()
1030 (*sdesc)->tfm = alg; in cifs_alloc_hash()
1035 * cifs_free_hash - free hash and hash context together
1046 if ((*sdesc)->tfm) { in cifs_free_hash()
1047 crypto_free_shash((*sdesc)->tfm); in cifs_free_hash()
1048 (*sdesc)->tfm = NULL; in cifs_free_hash()
1069 *len = end - unc; in extract_unc_hostname()
1073 * copy_path_name - copy src path to dst, possibly truncating
1085 * will truncate and strlen(dst) will be PATH_MAX-1 in copy_path_name()
1089 name_len = PATH_MAX-1; in copy_path_name()
1105 struct cifs_tcon *t1 = sd->data, *t2; in tcon_super_cb()
1107 if (sd->sb) in tcon_super_cb()
1113 spin_lock(&t2->tc_lock); in tcon_super_cb()
1114 if ((t1->ses == t2->ses || in tcon_super_cb()
1115 t1->ses->dfs_root_ses == t2->ses->dfs_root_ses) && in tcon_super_cb()
1116 t1->ses->server == t2->ses->server && in tcon_super_cb()
1117 t2->origin_fullpath && in tcon_super_cb()
1118 dfs_src_pathname_equal(t2->origin_fullpath, t1->origin_fullpath)) in tcon_super_cb()
1119 sd->sb = sb; in tcon_super_cb()
1120 spin_unlock(&t2->tc_lock); in tcon_super_cb()
1147 return ERR_PTR(-EINVAL); in __cifs_get_super()
1156 struct super_block *cifs_get_dfs_tcon_super(struct cifs_tcon *tcon) in cifs_get_dfs_tcon_super() argument
1158 spin_lock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1159 if (!tcon->origin_fullpath) { in cifs_get_dfs_tcon_super()
1160 spin_unlock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1161 return ERR_PTR(-ENOENT); in cifs_get_dfs_tcon_super()
1163 spin_unlock(&tcon->tc_lock); in cifs_get_dfs_tcon_super()
1164 return __cifs_get_super(tcon_super_cb, tcon); in cifs_get_dfs_tcon_super()
1185 return -ENOMEM; in match_target_ip()
1197 spin_lock(&server->srv_lock); in match_target_ip()
1198 *result = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, (struct sockaddr *)&ss); in match_target_ip()
1199 spin_unlock(&server->srv_lock); in match_target_ip()
1208 kfree(cifs_sb->prepath); in cifs_update_super_prepath()
1209 cifs_sb->prepath = NULL; in cifs_update_super_prepath()
1212 cifs_sb->prepath = cifs_sanitize_prepath(prefix, GFP_ATOMIC); in cifs_update_super_prepath()
1213 if (IS_ERR(cifs_sb->prepath)) { in cifs_update_super_prepath()
1214 rc = PTR_ERR(cifs_sb->prepath); in cifs_update_super_prepath()
1215 cifs_sb->prepath = NULL; in cifs_update_super_prepath()
1218 if (cifs_sb->prepath) in cifs_update_super_prepath()
1219 convert_delimiter(cifs_sb->prepath, CIFS_DIR_SEP(cifs_sb)); in cifs_update_super_prepath()
1222 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; in cifs_update_super_prepath()
1230 * non-ASCII unicode symbols.
1233 struct cifs_tcon *tcon, in cifs_inval_name_dfs_link_error() argument
1238 struct TCP_Server_Info *server = tcon->ses->server; in cifs_inval_name_dfs_link_error()
1239 struct cifs_ses *ses = tcon->ses; in cifs_inval_name_dfs_link_error()
1247 * Fast path - skip check when @full_path doesn't have a prefix path to in cifs_inval_name_dfs_link_error()
1248 * look up or tcon is not DFS. in cifs_inval_name_dfs_link_error()
1251 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) || in cifs_inval_name_dfs_link_error()
1252 !is_tcon_dfs(tcon)) in cifs_inval_name_dfs_link_error()
1255 spin_lock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1256 if (!server->leaf_fullpath) { in cifs_inval_name_dfs_link_error()
1257 spin_unlock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1260 spin_unlock(&server->srv_lock); in cifs_inval_name_dfs_link_error()
1263 * Slow path - tcon is DFS and @full_path has prefix path, so attempt in cifs_inval_name_dfs_link_error()
1266 len = strnlen(tcon->tree_name, MAX_TREE_SIZE + 1) + strlen(full_path) + 1; in cifs_inval_name_dfs_link_error()
1269 return -ENOMEM; in cifs_inval_name_dfs_link_error()
1271 scnprintf(path, len, "%s%s", tcon->tree_name, full_path); in cifs_inval_name_dfs_link_error()
1272 ref_path = dfs_cache_canonical_path(path + 1, cifs_sb->local_nls, in cifs_inval_name_dfs_link_error()
1277 if (PTR_ERR(ref_path) != -EINVAL) in cifs_inval_name_dfs_link_error()
1290 if (ses->server->ops->get_dfs_refer && in cifs_inval_name_dfs_link_error()
1291 !ses->server->ops->get_dfs_refer(xid, ses, ref_path, &refs, in cifs_inval_name_dfs_link_error()
1292 &num_refs, cifs_sb->local_nls, in cifs_inval_name_dfs_link_error()
1307 spin_lock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1308 if (server->tcpStatus != CifsNeedReconnect) { in cifs_wait_for_server_reconnect()
1309 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1312 timeout *= server->nr_targets; in cifs_wait_for_server_reconnect()
1313 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1317 * reconnect -- should be greater than cifs socket timeout which is 7 in cifs_wait_for_server_reconnect()
1321 * process is killed or server comes back on-line. in cifs_wait_for_server_reconnect()
1324 rc = wait_event_interruptible_timeout(server->response_q, in cifs_wait_for_server_reconnect()
1325 (server->tcpStatus != CifsNeedReconnect), in cifs_wait_for_server_reconnect()
1330 return -ERESTARTSYS; in cifs_wait_for_server_reconnect()
1334 spin_lock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1335 if (server->tcpStatus != CifsNeedReconnect) { in cifs_wait_for_server_reconnect()
1336 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1339 spin_unlock(&server->srv_lock); in cifs_wait_for_server_reconnect()
1343 return -EHOSTDOWN; in cifs_wait_for_server_reconnect()