Lines Matching refs:ses

75 	if (!tcon || !tcon->ses)
77 if ((tcon->ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) ||
81 (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION))
137 if (tcon->ses)
138 shdr->SessionId = cpu_to_le64(tcon->ses->Suid);
161 cifs_chan_skip_or_disable(struct cifs_ses *ses,
171 ses->server->hostname);
173 spin_lock(&ses->chan_lock);
174 chan_index = cifs_ses_get_chan_index(ses, server);
176 spin_unlock(&ses->chan_lock);
180 ses->chans[chan_index].server = NULL;
182 spin_unlock(&ses->chan_lock);
203 cifs_disable_secondary_channels(ses);
215 struct cifs_ses *ses;
247 ses = tcon->ses;
248 if (!ses)
250 spin_lock(&ses->ses_lock);
251 if (ses->ses_status == SES_EXITING) {
252 spin_unlock(&ses->ses_lock);
255 spin_unlock(&ses->ses_lock);
256 if (!ses->server || !server)
290 spin_lock(&ses->chan_lock);
291 if (!cifs_chan_needs_reconnect(ses, server) && !tcon->need_reconnect) {
292 spin_unlock(&ses->chan_lock);
295 spin_unlock(&ses->chan_lock);
297 tcon->ses->chans_need_reconnect,
300 mutex_lock(&ses->session_mutex);
309 mutex_unlock(&ses->session_mutex);
321 mutex_unlock(&ses->session_mutex);
331 nls_codepage = ses->local_nls;
337 spin_lock(&ses->ses_lock);
338 spin_lock(&ses->chan_lock);
339 if (!cifs_chan_needs_reconnect(ses, server) &&
340 ses->ses_status == SES_GOOD) {
341 spin_unlock(&ses->chan_lock);
342 spin_unlock(&ses->ses_lock);
347 mutex_unlock(&ses->session_mutex);
350 spin_unlock(&ses->chan_lock);
351 spin_unlock(&ses->ses_lock);
353 rc = cifs_negotiate_protocol(0, ses, server);
359 if (ses->chan_count > 1 &&
361 rc = cifs_chan_skip_or_disable(ses, server,
364 mutex_unlock(&ses->session_mutex);
369 rc = cifs_setup_session(0, ses, server, nls_codepage);
371 mutex_unlock(&ses->session_mutex);
375 mutex_unlock(&ses->session_mutex);
379 mutex_unlock(&ses->session_mutex);
385 mutex_unlock(&ses->session_mutex);
397 mutex_unlock(&ses->session_mutex);
402 spin_lock(&ses->ses_lock);
403 if (ses->flags & CIFS_SES_FLAG_SCALE_CHANNELS) {
404 spin_unlock(&ses->ses_lock);
405 mutex_unlock(&ses->session_mutex);
408 ses->flags |= CIFS_SES_FLAG_SCALE_CHANNELS;
409 spin_unlock(&ses->ses_lock);
413 mutex_unlock(&ses->session_mutex);
422 if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
430 rc = cifs_chan_skip_or_disable(ses, server,
437 if (ses->chan_max > ses->chan_count &&
438 ses->iface_count &&
440 if (ses->chan_count == 1) {
446 cifs_try_adding_channels(ses);
449 mutex_unlock(&ses->session_mutex);
453 spin_lock(&ses->ses_lock);
454 ses->flags &= ~CIFS_SES_FLAG_SCALE_CHANNELS;
455 spin_unlock(&ses->ses_lock);
1020 struct cifs_ses *ses,
1050 memset(ses->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);
1075 if (ses->sign)
1083 if (ses->chan_max > 1)
1106 rc = cifs_send_recv(xid, ses, server,
1184 memcpy(server->preauth_sha_hash, ses->preauth_sha_hash,
1214 * ses->sectype = RawNTLMSSP;
1223 rc = cifs_enable_signing(server, ses->sign);
1253 struct TCP_Server_Info *server = tcon->ses->server;
1268 if (tcon->ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
1271 if (tcon->ses->user_name == NULL) {
1276 if (tcon->ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
1285 if (tcon->ses->chan_max > 1)
1291 if (tcon->ses->sign)
1409 struct cifs_ses *ses;
1431 struct cifs_ses *ses = sess_data->ses;
1443 spin_lock(&ses->ses_lock);
1444 is_binding = (ses->ses_status == SES_GOOD);
1445 spin_unlock(&ses->ses_lock);
1448 req->hdr.SessionId = cpu_to_le64(ses->Suid);
1452 cifs_dbg(FYI, "Binding to sess id: %llx\n", ses->Suid);
1533 rc = cifs_send_recv(sess_data->xid, sess_data->ses,
1540 sess_data->ses->expired_pwd = false;
1542 sess_data->ses->expired_pwd = true;
1553 struct cifs_ses *ses = sess_data->ses;
1558 rc = server->ops->generate_signingkey(ses, server);
1581 struct cifs_ses *ses = sess_data->ses;
1592 spnego_key = cifs_get_spnego_key(ses, server);
1613 spin_lock(&ses->ses_lock);
1614 is_binding = (ses->ses_status == SES_GOOD);
1615 spin_unlock(&ses->ses_lock);
1619 kfree_sensitive(ses->auth_key.response);
1620 ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len,
1622 if (!ses->auth_key.response) {
1628 ses->auth_key.len = msg->sesskey_len;
1641 ses->Suid = le64_to_cpu(rsp->hdr.SessionId);
1642 ses->session_flags = le16_to_cpu(rsp->SessionFlags);
1650 kfree_sensitive(ses->auth_key.response);
1651 ses->auth_key.response = NULL;
1652 ses->auth_key.len = 0;
1676 struct cifs_ses *ses = sess_data->ses;
1688 ses->ntlmssp = kmalloc(sizeof(struct ntlmssp_auth), GFP_KERNEL);
1689 if (!ses->ntlmssp) {
1693 ses->ntlmssp->sesskey_per_smbsess = true;
1700 &blob_length, ses, server,
1733 le16_to_cpu(rsp->SecurityBufferLength), ses);
1739 spin_lock(&ses->ses_lock);
1740 is_binding = (ses->ses_status == SES_GOOD);
1741 spin_unlock(&ses->ses_lock);
1743 /* keep existing ses id and flags if binding */
1745 ses->Suid = le64_to_cpu(rsp->hdr.SessionId);
1746 ses->session_flags = le16_to_cpu(rsp->SessionFlags);
1758 kfree_sensitive(ses->ntlmssp);
1759 ses->ntlmssp = NULL;
1768 struct cifs_ses *ses = sess_data->ses;
1782 req->hdr.SessionId = cpu_to_le64(ses->Suid);
1785 ses, server,
1807 spin_lock(&ses->ses_lock);
1808 is_binding = (ses->ses_status == SES_GOOD);
1809 spin_unlock(&ses->ses_lock);
1811 /* keep existing ses id and flags if binding */
1813 ses->Suid = le64_to_cpu(rsp->hdr.SessionId);
1814 ses->session_flags = le16_to_cpu(rsp->SessionFlags);
1819 if (ses->server->dialect < SMB30_PROT_ID) {
1825 cifs_dbg(VFS, "Session Id %*ph\n", (int)sizeof(ses->Suid),
1826 &ses->Suid);
1828 SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response);
1830 SMB3_SIGN_KEY_SIZE, ses->auth_key.response);
1836 kfree_sensitive(ses->ntlmssp);
1837 ses->ntlmssp = NULL;
1846 struct cifs_ses *ses = sess_data->ses;
1849 type = smb2_select_sectype(server, ses->sectype);
1872 SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
1891 sess_data->ses = ses;
1895 sess_data->previous_session = ses->Suid;
1904 memcpy(ses->preauth_sha_hash, server->preauth_sha_hash,
1910 if ((ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST) && (ses->sign))
1919 SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
1931 cifs_dbg(FYI, "disconnect session %p\n", ses);
1933 if (ses && (ses->server))
1934 server = ses->server;
1939 spin_lock(&ses->chan_lock);
1940 if (CIFS_ALL_CHANS_NEED_RECONNECT(ses)) {
1941 spin_unlock(&ses->chan_lock);
1944 spin_unlock(&ses->chan_lock);
1946 rc = smb2_plain_req_init(SMB2_LOGOFF, NULL, ses->server,
1952 req->hdr.SessionId = cpu_to_le64(ses->Suid);
1954 if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
1968 rc = cifs_send_recv(xid, ses, ses->server,
1996 SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
2013 server = ses->server;
2061 !(ses->session_flags &
2063 ((ses->user_name != NULL) || (ses->sectype == Kerberos)))
2078 rc = cifs_send_recv(xid, ses, server,
2082 trace_smb3_tcon(xid, tcon->tid, ses->Suid, tree, rc);
2145 struct cifs_ses *ses = tcon->ses;
2154 if (!ses || !(ses->server))
2157 trace_smb3_tdis_enter(xid, tcon->tid, ses->Suid, tcon->tree_name);
2158 spin_lock(&ses->chan_lock);
2160 (CIFS_ALL_CHANS_NEED_RECONNECT(tcon->ses))) {
2161 spin_unlock(&ses->chan_lock);
2164 spin_unlock(&ses->chan_lock);
2168 rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, ses->server,
2186 rc = cifs_send_recv(xid, ses, ses->server,
2191 trace_smb3_tdis_err(xid, tcon->tid, ses->Suid, rc);
2193 trace_smb3_tdis_done(xid, tcon->tid, ses->Suid);
2774 struct cifs_ses *ses = tcon->ses;
2788 struct TCP_Server_Info *server = cifs_pick_channel(ses);
2797 if (!ses || !server) {
2890 trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE,
2893 rc = cifs_send_recv(xid, ses, server,
2897 trace_smb3_posix_mkdir_err(xid, tcon->tid, ses->Suid,
2915 trace_smb3_posix_mkdir_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
3123 struct cifs_ses *ses = tcon->ses;
3124 struct TCP_Server_Info *server = cifs_pick_channel(ses);
3132 if (!ses || !server)
3148 trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path,
3151 rc = cifs_send_recv(xid, ses, server,
3164 trace_smb3_open_err(xid, tcon->tid, ses->Suid,
3175 trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
3321 struct cifs_ses *ses;
3341 ses = tcon->ses;
3342 if (!ses)
3345 server = cifs_pick_channel(ses);
3363 rc = cifs_send_recv(xid, ses, server,
3370 ses->Suid, 0, opcode, rc);
3502 struct cifs_ses *ses = tcon->ses;
3503 struct TCP_Server_Info *server = cifs_pick_channel(ses);
3513 if (!ses || !server)
3528 trace_smb3_close_enter(xid, persistent_fid, tcon->tid, ses->Suid);
3535 rc = cifs_send_recv(xid, ses, server,
3541 trace_smb3_close_err(xid, persistent_fid, tcon->tid, ses->Suid,
3546 ses->Suid);
3694 struct cifs_ses *ses = tcon->ses;
3701 if (!ses)
3703 server = cifs_pick_channel(ses);
3723 ses->Suid, info_class, (__u32)info_type);
3725 rc = cifs_send_recv(xid, ses, server,
3732 ses->Suid, info_class, (__u32)info_type, rc);
3737 ses->Suid, info_class, (__u32)info_type);
3866 struct cifs_ses *ses = tcon->ses;
3867 struct TCP_Server_Info *server = cifs_pick_channel(ses);
3877 if (!ses || !server)
3897 trace_smb3_notify_enter(xid, persistent_fid, tcon->tid, ses->Suid,
3899 rc = cifs_send_recv(xid, ses, server,
3904 trace_smb3_notify_err(xid, persistent_fid, tcon->tid, ses->Suid,
3908 ses->Suid, (u8)watch_tree, completion_filter);
3967 struct cifs_ses *ses, *ses2;
4002 list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
4003 spin_lock(&ses->ses_lock);
4004 if (ses->ses_status == SES_EXITING) {
4005 spin_unlock(&ses->ses_lock);
4008 spin_unlock(&ses->ses_lock);
4012 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
4023 if (ses->tcon_ipc && ses->tcon_ipc->need_reconnect) {
4024 list_add_tail(&ses->tcon_ipc->rlist, &tmp_list);
4026 cifs_smb_ses_inc_refcount(ses);
4033 spin_lock(&ses->chan_lock);
4034 if (!tcon_selected && cifs_chan_needs_reconnect(ses, server)) {
4035 list_add_tail(&ses->rlist, &tmp_ses_list);
4037 cifs_smb_ses_inc_refcount(ses);
4039 spin_unlock(&ses->chan_lock);
4051 cifs_put_smb_ses(tcon->ses);
4063 list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
4064 list_del_init(&ses->rlist);
4065 cifs_put_smb_ses(ses);
4075 list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
4076 tcon->ses = ses;
4080 list_del_init(&ses->rlist);
4081 cifs_put_smb_ses(ses);
4171 struct cifs_ses *ses = tcon->ses;
4175 struct TCP_Server_Info *server = cifs_pick_channel(ses);
4181 if (!ses || !(ses->server))
4197 trace_smb3_flush_enter(xid, persistent_fid, tcon->tid, ses->Suid);
4198 rc = cifs_send_recv(xid, ses, server,
4203 trace_smb3_flush_err(xid, persistent_fid, tcon->tid, ses->Suid,
4207 ses->Suid);
4281 io_parms->tcon->tid, io_parms->tcon->ses->Suid,
4415 tcon->tid, tcon->ses->Suid, rdata->offset,
4420 tcon->tid, tcon->ses->Suid,
4447 rdata->server = cifs_pick_channel(tcon->ses);
4498 io_parms.tcon->ses->Suid,
4519 struct cifs_ses *ses = io_parms->tcon->ses;
4522 io_parms->server = cifs_pick_channel(io_parms->tcon->ses);
4539 rc = cifs_send_recv(xid, ses, io_parms->server,
4549 io_parms->tcon->tid, ses->Suid,
4554 ses->Suid, io_parms->offset, 0);
4561 io_parms->tcon->tid, ses->Suid,
4658 tcon->tid, tcon->ses->Suid, wdata->offset,
4666 tcon->tid, tcon->ses->Suid,
4692 server = wdata->server = cifs_pick_channel(tcon->ses);
4733 io_parms->tcon->ses->Suid,
4817 io_parms->tcon->ses->Suid,
4856 io_parms->server = cifs_pick_channel(io_parms->tcon->ses);
4883 io_parms->tcon->tid, io_parms->tcon->ses->Suid,
4894 rc = cifs_send_recv(xid, io_parms->tcon->ses, server,
4903 io_parms->tcon->ses->Suid,
4912 io_parms->tcon->ses->Suid,
5136 tcon->ses->Suid, index, output_size);
5234 struct cifs_ses *ses = tcon->ses;
5235 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5238 if (!ses || !(ses->server))
5256 rc = cifs_send_recv(xid, ses, server,
5264 tcon->tid, tcon->ses->Suid, index, 0);
5269 tcon->ses->Suid, index, 0, rc);
5279 tcon->ses->Suid, index, 0, rc);
5285 tcon->ses->Suid, index, srch_inf->entries_in_buffer);
5355 struct cifs_ses *ses = tcon->ses;
5356 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5359 if (!ses || !server)
5386 rc = cifs_send_recv(xid, ses, server,
5395 ses->Suid, info_class, (__u32)info_type, rc);
5416 trace_smb3_set_eof(xid, persistent_fid, tcon->tid, tcon->ses->Suid, le64_to_cpu(*eof));
5451 struct cifs_ses *ses = tcon->ses;
5452 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5482 rc = cifs_send_recv(xid, ses, server,
5537 if ((tcon->ses == NULL) || server == NULL)
5575 struct cifs_ses *ses = tcon->ses;
5576 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5594 rc = cifs_send_recv(xid, ses, server,
5626 struct cifs_ses *ses = tcon->ses;
5627 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5645 rc = cifs_send_recv(xid, ses, server,
5677 struct cifs_ses *ses = tcon->ses;
5678 struct TCP_Server_Info *server = cifs_pick_channel(ses);
5712 rc = cifs_send_recv(xid, ses, server,
5766 struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
5797 rc = cifs_send_recv(xid, tcon->ses, server,
5805 tcon->ses->Suid, rc);
5835 struct cifs_ses *ses = tcon->ses;
5843 struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
5870 rc = cifs_send_recv(xid, ses, server,
5879 ses->Suid, *please_key_low, *please_key_high, rc);
5883 ses->Suid, *please_key_low, *please_key_high);