Lines Matching full:server
84 (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) in smb3_encryption_required()
87 (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) in smb3_encryption_required()
95 struct TCP_Server_Info *server) in smb2_hdr_assemble() argument
103 if (server) { in smb2_hdr_assemble()
105 if (server->dialect >= SMB30_PROT_ID) { in smb2_hdr_assemble()
111 if (SERVER_IS_CHAN(server)) in smb2_hdr_assemble()
113 cpu_to_le16(server->primary_server->channel_sequence_num); in smb2_hdr_assemble()
116 cpu_to_le16(server->channel_sequence_num); in smb2_hdr_assemble()
118 spin_lock(&server->req_lock); in smb2_hdr_assemble()
120 if (server->credits >= server->max_credits) in smb2_hdr_assemble()
124 min_t(int, server->max_credits - in smb2_hdr_assemble()
125 server->credits, 10)); in smb2_hdr_assemble()
126 spin_unlock(&server->req_lock); in smb2_hdr_assemble()
137 if (server && (server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) in smb2_hdr_assemble()
148 * to pass the path on the Open SMB prefixed by \\server\share. in smb2_hdr_assemble()
151 * illegal to send an empty path name (without \\server\share prefix) in smb2_hdr_assemble()
159 if (server && server->sign && !smb3_encryption_required(tcon)) in smb2_hdr_assemble()
168 struct TCP_Server_Info *server, in cifs_chan_skip_or_disable() argument
174 if (SERVER_IS_CHAN(server)) { in cifs_chan_skip_or_disable()
176 "server %s does not support multichannel anymore. Skip secondary channel\n", in cifs_chan_skip_or_disable()
177 ses->server->hostname); in cifs_chan_skip_or_disable()
180 chan_index = cifs_ses_get_chan_index(ses, server); in cifs_chan_skip_or_disable()
186 ses->chans[chan_index].server = NULL; in cifs_chan_skip_or_disable()
187 server->terminate = true; in cifs_chan_skip_or_disable()
191 * the above reference of server by channel in cifs_chan_skip_or_disable()
196 cifs_put_tcp_session(server, from_reconnect); in cifs_chan_skip_or_disable()
198 cifs_signal_cifsd_for_reconnect(server, false); in cifs_chan_skip_or_disable()
200 /* mark primary server as needing reconnect */ in cifs_chan_skip_or_disable()
201 pserver = server->primary_server; in cifs_chan_skip_or_disable()
208 "server does not support multichannel anymore. Disable all other channels\n"); in cifs_chan_skip_or_disable()
217 struct TCP_Server_Info *server, bool from_reconnect) in smb2_reconnect() argument
262 if (!ses->server || !server) in smb2_reconnect()
265 spin_lock(&server->srv_lock); in smb2_reconnect()
266 if (server->tcpStatus == CifsNeedReconnect) { in smb2_reconnect()
279 spin_unlock(&server->srv_lock); in smb2_reconnect()
284 /* if server is marked for termination, cifsd will cleanup */ in smb2_reconnect()
285 if (server->terminate) { in smb2_reconnect()
286 spin_unlock(&server->srv_lock); in smb2_reconnect()
289 spin_unlock(&server->srv_lock); in smb2_reconnect()
292 rc = cifs_wait_for_server_reconnect(server, tcon->retry); in smb2_reconnect()
297 if (!cifs_chan_needs_reconnect(ses, server) && !tcon->need_reconnect) { in smb2_reconnect()
312 spin_lock(&server->srv_lock); in smb2_reconnect()
313 if (server->tcpStatus == CifsExiting) { in smb2_reconnect()
314 spin_unlock(&server->srv_lock); in smb2_reconnect()
322 * and the server never sends an answer the socket will be closed in smb2_reconnect()
325 if (server->tcpStatus == CifsNeedReconnect) { in smb2_reconnect()
326 spin_unlock(&server->srv_lock); in smb2_reconnect()
335 spin_unlock(&server->srv_lock); in smb2_reconnect()
345 if (!cifs_chan_needs_reconnect(ses, server) && in smb2_reconnect()
359 rc = cifs_negotiate_protocol(0, ses, server); in smb2_reconnect()
362 * if server stopped supporting multichannel in smb2_reconnect()
366 !(server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { in smb2_reconnect()
367 rc = cifs_chan_skip_or_disable(ses, server, in smb2_reconnect()
375 rc = cifs_setup_session(0, ses, server, nls_codepage); in smb2_reconnect()
379 * could be enabled on the server e.g.) if an alternate in smb2_reconnect()
429 (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) && in smb2_reconnect()
430 server->ops->query_server_interfaces) { in smb2_reconnect()
434 * query server network interfaces, in case they change in smb2_reconnect()
437 rc = server->ops->query_server_interfaces(xid, tcon, false); in smb2_reconnect()
442 * some servers like Azure SMB server do not advertise in smb2_reconnect()
443 * that multichannel has been disabled with server in smb2_reconnect()
445 * treat this as server not supporting multichannel in smb2_reconnect()
448 rc = cifs_chan_skip_or_disable(ses, server, in smb2_reconnect()
452 cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", in smb2_reconnect()
457 !SERVER_IS_CHAN(server)) { in smb2_reconnect()
476 mod_delayed_work(cifsiod_wq, &server->reconnect, 0); in smb2_reconnect()
485 * BB Is flush done by server on drop of tcp session? Should we special in smb2_reconnect()
505 struct TCP_Server_Info *server, in fill_small_buf() argument
519 smb2_hdr_assemble(&spdu->hdr, smb2_command, tcon, server); in fill_small_buf()
531 struct TCP_Server_Info *server, in __smb2_plain_req_init() argument
549 fill_small_buf(smb2_command, tcon, server, in __smb2_plain_req_init()
563 struct TCP_Server_Info *server, in smb2_plain_req_init() argument
568 rc = smb2_reconnect(smb2_command, tcon, server, false); in smb2_plain_req_init()
572 return __smb2_plain_req_init(smb2_command, tcon, server, request_buf, in smb2_plain_req_init()
577 struct TCP_Server_Info *server, in smb2_ioctl_req_init() argument
582 return __smb2_plain_req_init(SMB2_IOCTL, tcon, server, in smb2_ioctl_req_init()
585 return smb2_plain_req_init(SMB2_IOCTL, tcon, server, in smb2_ioctl_req_init()
666 /* copy up to max of first 100 bytes of server name to NetName field */ in build_netname_ctxt()
698 struct TCP_Server_Info *server, unsigned int *total_len) in assemble_neg_contexts() argument
734 pserver = SERVER_IS_CHAN(server) ? server->primary_server : server; in assemble_neg_contexts()
752 if (server->compression.requested) { in assemble_neg_contexts()
784 pr_warn_once("server sent bad preauth context\n"); in decode_preauth_context()
787 pr_warn_once("server sent invalid SaltLength\n"); in decode_preauth_context()
796 static void decode_compress_ctx(struct TCP_Server_Info *server, in decode_compress_ctx() argument
802 server->compression.enabled = false; in decode_compress_ctx()
810 pr_warn_once("server sent bad compression cntxt\n"); in decode_compress_ctx()
827 server->compression.alg = alg; in decode_compress_ctx()
828 server->compression.enabled = true; in decode_compress_ctx()
831 static int decode_encrypt_ctx(struct TCP_Server_Info *server, in decode_encrypt_ctx() argument
843 pr_warn_once("server sent bad crypto ctxt len\n"); in decode_encrypt_ctx()
854 cifs_dbg(VFS, "Server does not support requested encryption type (AES256 GCM)\n"); in decode_encrypt_ctx()
859 * e.g. if server only supported AES256_CCM (very unlikely) in decode_encrypt_ctx()
860 * or server supported no encryption types or had all disabled. in decode_encrypt_ctx()
864 * seal not requested by client, since server is allowed to in decode_encrypt_ctx()
867 server->cipher_type = 0; in decode_encrypt_ctx()
868 server->capabilities &= ~SMB2_GLOBAL_CAP_ENCRYPTION; in decode_encrypt_ctx()
869 pr_warn_once("Server does not support requested encryption types\n"); in decode_encrypt_ctx()
874 /* server returned a cipher we didn't ask for */ in decode_encrypt_ctx()
878 server->cipher_type = ctxt->Ciphers[0]; in decode_encrypt_ctx()
879 server->capabilities |= SMB2_GLOBAL_CAP_ENCRYPTION; in decode_encrypt_ctx()
883 static void decode_signing_ctx(struct TCP_Server_Info *server, in decode_signing_ctx() argument
894 pr_warn_once("server sent bad signing negcontext\n"); in decode_signing_ctx()
906 server->signing_negotiated = true; in decode_signing_ctx()
907 server->signing_algorithm = le16_to_cpu(pctxt->SigningAlgorithms[0]); in decode_signing_ctx()
909 server->signing_algorithm); in decode_signing_ctx()
914 struct TCP_Server_Info *server, in smb311_decode_neg_context() argument
954 rc = decode_encrypt_ctx(server, in smb311_decode_neg_context()
957 decode_compress_ctx(server, in smb311_decode_neg_context()
960 server->posix_ext_supported = true; in smb311_decode_neg_context()
962 decode_signing_ctx(server, in smb311_decode_neg_context()
1049 struct TCP_Server_Info *server) in SMB2_negotiate() argument
1065 if (!server) { in SMB2_negotiate()
1066 WARN(1, "%s: server is NULL!\n", __func__); in SMB2_negotiate()
1070 rc = smb2_plain_req_init(SMB2_NEGOTIATE, NULL, server, in SMB2_negotiate()
1077 memset(server->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE); in SMB2_negotiate()
1080 if (strcmp(server->vals->version_string, in SMB2_negotiate()
1087 } else if (strcmp(server->vals->version_string, in SMB2_negotiate()
1097 req->Dialects[0] = cpu_to_le16(server->vals->protocol_id); in SMB2_negotiate()
1110 req->Capabilities = cpu_to_le32(server->vals->req_capabilities); in SMB2_negotiate()
1115 if (server->vals->protocol_id == SMB20_PROT_ID) in SMB2_negotiate()
1118 memcpy(req->ClientGUID, server->client_guid, in SMB2_negotiate()
1120 if ((server->vals->protocol_id == SMB311_PROT_ID) || in SMB2_negotiate()
1121 (strcmp(server->vals->version_string, in SMB2_negotiate()
1123 (strcmp(server->vals->version_string, in SMB2_negotiate()
1125 assemble_neg_contexts(req, server, &total_len); in SMB2_negotiate()
1134 rc = cifs_send_recv(xid, ses, server, in SMB2_negotiate()
1143 …cifs_server_dbg(VFS, "Dialect not supported by server. Consider specifying vers=1.0 or vers=2.0 o… in SMB2_negotiate()
1149 if (strcmp(server->vals->version_string, in SMB2_negotiate()
1161 server->ops = &smb311_operations; in SMB2_negotiate()
1162 server->vals = &smb311_values; in SMB2_negotiate()
1164 } else if (strcmp(server->vals->version_string, in SMB2_negotiate()
1172 server->ops = &smb21_operations; in SMB2_negotiate()
1173 server->vals = &smb21_values; in SMB2_negotiate()
1175 server->ops = &smb311_operations; in SMB2_negotiate()
1176 server->vals = &smb311_values; in SMB2_negotiate()
1179 server->vals->protocol_id) { in SMB2_negotiate()
1199 cifs_server_dbg(VFS, "Invalid dialect returned by server 0x%x\n", in SMB2_negotiate()
1205 server->dialect = le16_to_cpu(rsp->DialectRevision); in SMB2_negotiate()
1210 * server. in SMB2_negotiate()
1212 memcpy(server->preauth_sha_hash, ses->preauth_sha_hash, in SMB2_negotiate()
1216 server->negflavor = CIFS_NEGFLAVOR_EXTENDED; in SMB2_negotiate()
1218 server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), in SMB2_negotiate()
1220 server->max_read = le32_to_cpu(rsp->MaxReadSize); in SMB2_negotiate()
1221 server->max_write = le32_to_cpu(rsp->MaxWriteSize); in SMB2_negotiate()
1222 server->sec_mode = le16_to_cpu(rsp->SecurityMode); in SMB2_negotiate()
1223 if ((server->sec_mode & SMB2_SEC_MODE_FLAGS_ALL) != server->sec_mode) in SMB2_negotiate()
1224 cifs_dbg(FYI, "Server returned unexpected security mode 0x%x\n", in SMB2_negotiate()
1225 server->sec_mode); in SMB2_negotiate()
1226 server->capabilities = le32_to_cpu(rsp->Capabilities); in SMB2_negotiate()
1228 server->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES; in SMB2_negotiate()
1234 if (server->dialect == SMB30_PROT_ID && (server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) in SMB2_negotiate()
1235 server->cipher_type = SMB2_ENCRYPTION_AES128_CCM; in SMB2_negotiate()
1244 * We just found a server which sets blob length to zero expecting raw. in SMB2_negotiate()
1248 server->sec_ntlmssp = true; in SMB2_negotiate()
1251 rc = cifs_enable_signing(server, ses->sign); in SMB2_negotiate()
1255 rc = decode_negTokenInit(security_blob, blob_length, server); in SMB2_negotiate()
1264 rc = smb311_decode_neg_context(rsp, server, in SMB2_negotiate()
1270 if (server->cipher_type && !rc) { in SMB2_negotiate()
1271 if (!SERVER_IS_CHAN(server)) { in SMB2_negotiate()
1272 rc = smb3_crypto_aead_allocate(server); in SMB2_negotiate()
1274 /* For channels, just reuse the primary server crypto secmech. */ in SMB2_negotiate()
1275 server->secmech.enc = server->primary_server->secmech.enc; in SMB2_negotiate()
1276 server->secmech.dec = server->primary_server->secmech.dec; in SMB2_negotiate()
1291 struct TCP_Server_Info *server = tcon->ses->server; in smb3_validate_negotiate() local
1296 if (server->dialect == SMB311_PROT_ID) in smb3_validate_negotiate()
1315 cifs_tcon_dbg(VFS, "Unexpected null user (anonymous) auth flag sent by server\n"); in smb3_validate_negotiate()
1322 cpu_to_le32(server->vals->req_capabilities); in smb3_validate_negotiate()
1326 memcpy(pneg_inbuf->Guid, server->client_guid, in smb3_validate_negotiate()
1339 if (strcmp(server->vals->version_string, in smb3_validate_negotiate()
1348 } else if (strcmp(server->vals->version_string, in smb3_validate_negotiate()
1360 cpu_to_le16(server->vals->protocol_id); in smb3_validate_negotiate()
1373 * Old Windows versions or Netapp SMB server can return in smb3_validate_negotiate()
1376 cifs_tcon_dbg(VFS, "Server does not support validate negotiate\n"); in smb3_validate_negotiate()
1397 if (pneg_rsp->Dialect != cpu_to_le16(server->dialect)) in smb3_validate_negotiate()
1400 if (pneg_rsp->SecurityMode != cpu_to_le16(server->sec_mode)) in smb3_validate_negotiate()
1403 /* do not validate server guid because not saved at negprot time yet */ in smb3_validate_negotiate()
1406 SMB2_LARGE_FILES) != server->capabilities) in smb3_validate_negotiate()
1424 smb2_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested) in smb2_select_sectype() argument
1433 if (server->sec_ntlmssp && in smb2_select_sectype()
1436 if ((server->sec_kerberos || server->sec_mskerberos) && in smb2_select_sectype()
1448 struct TCP_Server_Info *server; member
1470 struct TCP_Server_Info *server = sess_data->server; in SMB2_sess_alloc_buffer() local
1475 rc = smb2_plain_req_init(SMB2_SESSION_SETUP, NULL, server, in SMB2_sess_alloc_buffer()
1505 if (server->credits >= server->max_credits) in SMB2_sess_alloc_buffer()
1509 min_t(int, server->max_credits - in SMB2_sess_alloc_buffer()
1510 server->credits, 130)); in SMB2_sess_alloc_buffer()
1513 if (server->sign) in SMB2_sess_alloc_buffer()
1572 sess_data->server, in SMB2_sess_sendreceive()
1581 trace_smb3_key_expired(sess_data->server->hostname, in SMB2_sess_sendreceive()
1583 sess_data->server->conn_id, in SMB2_sess_sendreceive()
1584 &sess_data->server->dstaddr, rc); in SMB2_sess_sendreceive()
1598 struct TCP_Server_Info *server = sess_data->server; in SMB2_sess_establish_session() local
1600 cifs_server_lock(server); in SMB2_sess_establish_session()
1601 if (server->ops->generate_signingkey) { in SMB2_sess_establish_session()
1602 rc = server->ops->generate_signingkey(ses, server); in SMB2_sess_establish_session()
1606 cifs_server_unlock(server); in SMB2_sess_establish_session()
1610 if (!server->session_estab) { in SMB2_sess_establish_session()
1611 server->sequence_number = 0x2; in SMB2_sess_establish_session()
1612 server->session_estab = true; in SMB2_sess_establish_session()
1614 cifs_server_unlock(server); in SMB2_sess_establish_session()
1626 struct TCP_Server_Info *server = sess_data->server; in SMB2_auth_kerberos() local
1636 spnego_key = cifs_get_spnego_key(ses, server); in SMB2_auth_kerberos()
1721 struct TCP_Server_Info *server = sess_data->server; in SMB2_sess_auth_rawntlmssp_negotiate() local
1744 &blob_length, ses, server, in SMB2_sess_auth_rawntlmssp_negotiate()
1813 struct TCP_Server_Info *server = sess_data->server; in SMB2_sess_auth_rawntlmssp_authenticate() local
1829 ses, server, in SMB2_sess_auth_rawntlmssp_authenticate()
1863 if (ses->server->dialect < SMB30_PROT_ID) { in SMB2_sess_auth_rawntlmssp_authenticate()
1891 struct TCP_Server_Info *server = sess_data->server; in SMB2_select_sec() local
1893 type = smb2_select_sectype(server, ses->sectype); in SMB2_select_sec()
1917 struct TCP_Server_Info *server, in SMB2_sess_setup() argument
1925 if (!server) { in SMB2_sess_setup()
1926 WARN(1, "%s: server is NULL!\n", __func__); in SMB2_sess_setup()
1936 sess_data->server = server; in SMB2_sess_setup()
1946 * Initialize the session hash with the server one. in SMB2_sess_setup()
1948 memcpy(ses->preauth_sha_hash, server->preauth_sha_hash, in SMB2_sess_setup()
1968 struct TCP_Server_Info *server; in SMB2_logoff() local
1977 if (ses && (ses->server)) in SMB2_logoff()
1978 server = ses->server; in SMB2_logoff()
1990 rc = smb2_plain_req_init(SMB2_LOGOFF, NULL, ses->server, in SMB2_logoff()
2000 else if (server->sign) in SMB2_logoff()
2012 rc = cifs_send_recv(xid, ses, ses->server, in SMB2_logoff()
2029 #define MAX_SHARENAME_LENGTH (255 /* server */ + 80 /* share */ + 1 /* NULL */)
2054 struct TCP_Server_Info *server = cifs_pick_channel(ses); in SMB2_tcon() local
2058 if (!server || !tree) in SMB2_tcon()
2075 rc = smb2_plain_req_init(SMB2_TREE_CONNECT, tcon, server, in SMB2_tcon()
2100 if ((server->dialect == SMB311_PROT_ID) && in SMB2_tcon()
2112 if (server->credits >= server->max_credits) in SMB2_tcon()
2116 min_t(int, server->max_credits - in SMB2_tcon()
2117 server->credits, 64)); in SMB2_tcon()
2119 rc = cifs_send_recv(xid, ses, server, in SMB2_tcon()
2159 !(server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) in SMB2_tcon()
2163 if (server->ops->validate_negotiate) in SMB2_tcon()
2164 rc = server->ops->validate_negotiate(xid, tcon); in SMB2_tcon()
2167 server->nosharesock = true; in SMB2_tcon()
2187 struct TCP_Server_Info *server = cifs_pick_channel(ses); in SMB2_tdis() local
2196 if (!ses || !(ses->server)) in SMB2_tdis()
2210 rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, server, in SMB2_tdis()
2228 rc = cifs_send_recv(xid, ses, server, in SMB2_tdis()
2334 int smb2_parse_contexts(struct TCP_Server_Info *server, in smb2_parse_contexts() argument
2380 *oplock = server->ops->parse_lease_buf(cc, epoch, in smb2_parse_contexts()
2414 add_lease_context(struct TCP_Server_Info *server, in add_lease_context() argument
2421 iov[num].iov_base = server->ops->create_lease_buf(lease_key, *oplock); in add_lease_context()
2424 iov[num].iov_len = server->vals->create_lease_size; in add_lease_context()
2448 * NB: Handle timeout defaults to 0, which allows server to choose in create_durable_v2_buf()
2846 struct TCP_Server_Info *server; in smb311_posix_mkdir() local
2853 server = cifs_pick_channel(ses); in smb311_posix_mkdir()
2862 if (!ses || !server) { in smb311_posix_mkdir()
2868 rc = smb2_plain_req_init(SMB2_CREATE, tcon, server, in smb311_posix_mkdir()
2959 smb2_set_replay(server, &rqst); in smb311_posix_mkdir()
2962 rc = cifs_send_recv(xid, ses, server, in smb311_posix_mkdir()
3007 SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_open_init() argument
3021 rc = smb2_plain_req_init(SMB2_CREATE, tcon, server, in SMB2_open_init()
3082 if ((!server->oplocks) || (tcon->no_lease)) in SMB2_open_init()
3085 if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || in SMB2_open_init()
3088 else if (!(server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) && in SMB2_open_init()
3092 rc = add_lease_context(server, req, iov, &n_iov, in SMB2_open_init()
3199 struct TCP_Server_Info *server; in SMB2_open() local
3210 server = cifs_pick_channel(ses); in SMB2_open()
3214 if (!ses || !server) in SMB2_open()
3225 rc = SMB2_open_init(tcon, server, in SMB2_open()
3234 smb2_set_replay(server, &rqst); in SMB2_open()
3236 rc = cifs_send_recv(xid, ses, server, in SMB2_open()
3252 pr_warn_once("server share %s deleted\n", in SMB2_open()
3284 rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch, in SMB2_open()
3298 SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_ioctl_init() argument
3310 rc = smb2_ioctl_req_init(opcode, tcon, server, in SMB2_ioctl_init()
3370 * ioctls it may be useful to allow server to send more. No point in SMB2_ioctl_init()
3371 * limiting what the server can send as long as fits in one credit in SMB2_ioctl_init()
3421 struct TCP_Server_Info *server; in SMB2_ioctl() local
3439 server = cifs_pick_channel(ses); in SMB2_ioctl()
3441 if (!server) in SMB2_ioctl()
3461 rc = SMB2_ioctl_init(tcon, server, in SMB2_ioctl()
3468 smb2_set_replay(server, &rqst); in SMB2_ioctl()
3470 rc = cifs_send_recv(xid, ses, server, in SMB2_ioctl()
3513 goto ioctl_exit; /* server returned no data */ in SMB2_ioctl()
3574 SMB2_close_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_close_init() argument
3583 rc = smb2_plain_req_init(SMB2_CLOSE, tcon, server, in SMB2_close_init()
3615 struct TCP_Server_Info *server; in __SMB2_close() local
3628 server = cifs_pick_channel(ses); in __SMB2_close()
3632 if (!ses || !server) in __SMB2_close()
3643 /* check if need to ask server to return timestamps in close response */ in __SMB2_close()
3648 rc = SMB2_close_init(tcon, server, in __SMB2_close()
3655 smb2_set_replay(server, &rqst); in __SMB2_close()
3657 rc = cifs_send_recv(xid, ses, server, in __SMB2_close()
3729 cifs_dbg(VFS, "Invalid server response, bad offset to data\n"); in smb2_validate_iov()
3761 SMB2_query_info_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_query_info_init() argument
3777 rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, server, in SMB2_query_info_init()
3822 struct TCP_Server_Info *server; in query_info() local
3836 server = cifs_pick_channel(ses); in query_info()
3838 if (!server) in query_info()
3849 rc = SMB2_query_info_init(tcon, server, in query_info()
3860 smb2_set_replay(server, &rqst); in query_info()
3862 rc = cifs_send_recv(xid, ses, server, in query_info()
3971 struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_notify_init() argument
3980 rc = smb2_plain_req_init(SMB2_CHANGE_NOTIFY, tcon, server, in SMB2_notify_init()
4009 struct TCP_Server_Info *server; in SMB2_change_notify() local
4022 server = cifs_pick_channel(ses); in SMB2_change_notify()
4025 if (!ses || !server) in SMB2_change_notify()
4039 rc = SMB2_notify_init(xid, &rqst, tcon, server, in SMB2_change_notify()
4049 smb2_set_replay(server, &rqst); in SMB2_change_notify()
4051 rc = cifs_send_recv(xid, ses, server, in SMB2_change_notify()
4097 * rather in the fact that the server sent one and that server->lstrp
4105 struct TCP_Server_Info *server = mid->callback_data; in smb2_echo_callback() local
4112 credits.instance = server->reconnect_instance; in smb2_echo_callback()
4116 add_credits(server, &credits, CIFS_ECHO_OP); in smb2_echo_callback()
4121 struct TCP_Server_Info *server = container_of(work, in smb2_reconnect_server() local
4134 if (!server->srv_count) { in smb2_reconnect_server()
4138 server->srv_count++; in smb2_reconnect_server()
4141 /* If server is a channel, select the primary channel */ in smb2_reconnect_server()
4142 pserver = SERVER_IS_CHAN(server) ? server->primary_server : server; in smb2_reconnect_server()
4147 /* if the server is marked for termination, drop the ref count here */ in smb2_reconnect_server()
4148 if (server->terminate) { in smb2_reconnect_server()
4149 cifs_put_tcp_session(server, true); in smb2_reconnect_server()
4193 if (!tcon_selected && cifs_chan_needs_reconnect(ses, server)) { in smb2_reconnect_server()
4203 rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon, server, true); in smb2_reconnect_server()
4236 rc = smb2_reconnect(SMB2_INTERNAL_CMD, tcon, server, true); in smb2_reconnect_server()
4247 queue_delayed_work(cifsiod_wq, &server->reconnect, 2 * HZ); in smb2_reconnect_server()
4251 cifs_put_tcp_session(server, true); in smb2_reconnect_server()
4255 SMB2_echo(struct TCP_Server_Info *server) in SMB2_echo() argument
4264 cifs_dbg(FYI, "In echo request for conn_id %lld\n", server->conn_id); in SMB2_echo()
4266 spin_lock(&server->srv_lock); in SMB2_echo()
4267 if (server->ops->need_neg && in SMB2_echo()
4268 server->ops->need_neg(server)) { in SMB2_echo()
4269 spin_unlock(&server->srv_lock); in SMB2_echo()
4271 mod_delayed_work(cifsiod_wq, &server->reconnect, 0); in SMB2_echo()
4274 spin_unlock(&server->srv_lock); in SMB2_echo()
4276 rc = smb2_plain_req_init(SMB2_ECHO, NULL, server, in SMB2_echo()
4286 rc = cifs_call_async(server, &rqst, NULL, smb2_echo_callback, NULL, in SMB2_echo()
4287 server, CIFS_ECHO_OP, NULL); in SMB2_echo()
4304 struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_flush_init() argument
4312 rc = smb2_plain_req_init(SMB2_FLUSH, tcon, server, in SMB2_flush_init()
4334 struct TCP_Server_Info *server; in SMB2_flush() local
4343 server = cifs_pick_channel(ses); in SMB2_flush()
4346 if (!ses || !(ses->server)) in SMB2_flush()
4357 rc = SMB2_flush_init(xid, &rqst, tcon, server, in SMB2_flush()
4365 smb2_set_replay(server, &rqst); in SMB2_flush()
4367 rc = cifs_send_recv(xid, ses, server, in SMB2_flush()
4392 struct TCP_Server_Info *server = io_parms->server; in smb3_use_rdma_offload() local
4396 if (!server || !tcon) in smb3_use_rdma_offload()
4400 if (!server->rdma || !server->smbd_conn) in smb3_use_rdma_offload()
4404 if (server->sign) in smb3_use_rdma_offload()
4412 if (io_parms->length < server->smbd_conn->rdma_readwrite_threshold) in smb3_use_rdma_offload()
4431 struct TCP_Server_Info *server = io_parms->server; in smb2_new_read_req() local
4433 rc = smb2_plain_req_init(SMB2_READ, io_parms->tcon, server, in smb2_new_read_req()
4438 if (server == NULL) in smb2_new_read_req()
4466 bool need_invalidate = server->dialect == SMB30_PROT_ID; in smb2_new_read_req()
4468 rdata->mr = smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter, in smb2_new_read_req()
4530 struct TCP_Server_Info *server = rdata->server; in smb2_readv_callback() local
4547 WARN_ONCE(rdata->server != mid->server, in smb2_readv_callback()
4548 "rdata server %p != mid server %p", in smb2_readv_callback()
4549 rdata->server, mid->server); in smb2_readv_callback()
4558 credits.instance = server->reconnect_instance; in smb2_readv_callback()
4560 if (server->sign && !mid->decrypted) { in smb2_readv_callback()
4564 rc = smb2_verify_signature(&rqst, server); in smb2_readv_callback()
4577 if (server->sign && rdata->got_bytes) in smb2_readv_callback()
4586 credits.instance = server->reconnect_instance; in smb2_readv_callback()
4633 server->credits, server->in_flight, in smb2_readv_callback()
4642 server->credits, server->in_flight, in smb2_readv_callback()
4644 add_credits(server, &credits, 0); in smb2_readv_callback()
4658 struct TCP_Server_Info *server; in smb2_async_readv() local
4666 if (!rdata->server) in smb2_async_readv()
4667 rdata->server = cifs_pick_channel(tcon->ses); in smb2_async_readv()
4670 io_parms.server = server = rdata->server; in smb2_async_readv()
4696 if (server->credits >= server->max_credits) in smb2_async_readv()
4700 min_t(int, server->max_credits - in smb2_async_readv()
4701 server->credits, credit_request)); in smb2_async_readv()
4703 rc = adjust_credits(server, rdata, cifs_trace_rw_credits_call_readv_adjust); in smb2_async_readv()
4710 rc = cifs_call_async(server, &rqst, in smb2_async_readv()
4744 if (!io_parms->server) in SMB2_read()
4745 io_parms->server = cifs_pick_channel(io_parms->tcon->ses); in SMB2_read()
4762 rc = cifs_send_recv(xid, ses, io_parms->server, in SMB2_read()
4821 struct TCP_Server_Info *server = wdata->server; in smb2_writev_callback() local
4834 WARN_ONCE(wdata->server != mid->server, in smb2_writev_callback()
4835 "wdata server %p != mid server %p", in smb2_writev_callback()
4836 wdata->server, mid->server); in smb2_writev_callback()
4841 credits.instance = server->reconnect_instance; in smb2_writev_callback()
4842 result = smb2_check_receive(mid, server, 0); in smb2_writev_callback()
4849 * by the server is greater than bytes requested by the in smb2_writev_callback()
4867 credits.instance = server->reconnect_instance; in smb2_writev_callback()
4906 server->credits, server->in_flight, in smb2_writev_callback()
4913 server->credits, server->in_flight, in smb2_writev_callback()
4915 add_credits(server, &credits, 0); in smb2_writev_callback()
4926 struct TCP_Server_Info *server = wdata->server; in smb2_async_writev() local
4940 .server = server, in smb2_async_writev()
4949 rc = smb2_plain_req_init(SMB2_WRITE, tcon, server, in smb2_async_writev()
4989 * If we want to do a server RDMA read, fill in and append in smb2_async_writev()
4994 bool need_invalidate = server->dialect == SMB30_PROT_ID; in smb2_async_writev()
4996 wdata->mr = smbd_register_mr(server->smbd_conn, &wdata->subreq.io_iter, in smb2_async_writev()
5029 smb2_set_replay(server, &rqst); in smb2_async_writev()
5038 if (server->credits >= server->max_credits) in smb2_async_writev()
5042 min_t(int, server->max_credits - in smb2_async_writev()
5043 server->credits, credit_request)); in smb2_async_writev()
5045 rc = adjust_credits(server, wdata, cifs_trace_rw_credits_call_writev_adjust); in smb2_async_writev()
5056 rc = cifs_call_async(server, &rqst, NULL, smb2_writev_callback, NULL, in smb2_async_writev()
5079 server->credits, server->in_flight, in smb2_async_writev()
5082 add_credits_and_wake_if(wdata->server, &wdata->credits, 0); in smb2_async_writev()
5105 struct TCP_Server_Info *server; in SMB2_write() local
5112 if (!io_parms->server) in SMB2_write()
5113 io_parms->server = cifs_pick_channel(io_parms->tcon->ses); in SMB2_write()
5114 server = io_parms->server; in SMB2_write()
5115 if (server == NULL) in SMB2_write()
5121 rc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, server, in SMB2_write()
5155 smb2_set_replay(server, &rqst); in SMB2_write()
5157 rc = cifs_send_recv(xid, io_parms->tcon->ses, server, in SMB2_write()
5338 struct TCP_Server_Info *server, in SMB2_query_directory_init() argument
5353 rc = smb2_plain_req_init(SMB2_QUERY_DIRECTORY, tcon, server, in SMB2_query_directory_init()
5392 output_size = min_t(unsigned int, output_size, server->maxBuf); in SMB2_query_directory_init()
5503 struct TCP_Server_Info *server; in SMB2_query_directory() local
5510 server = cifs_pick_channel(ses); in SMB2_query_directory()
5512 if (!ses || !(ses->server)) in SMB2_query_directory()
5523 rc = SMB2_query_directory_init(xid, tcon, server, in SMB2_query_directory()
5531 smb2_set_replay(server, &rqst); in SMB2_query_directory()
5533 rc = cifs_send_recv(xid, ses, server, in SMB2_query_directory()
5576 SMB2_set_info_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, in SMB2_set_info_init() argument
5587 rc = smb2_plain_req_init(SMB2_SET_INFO, tcon, server, in SMB2_set_info_init()
5638 struct TCP_Server_Info *server; in send_set_info() local
5645 server = cifs_pick_channel(ses); in send_set_info()
5647 if (!ses || !server) in send_set_info()
5664 rc = SMB2_set_info_init(tcon, server, in send_set_info()
5674 smb2_set_replay(server, &rqst); in send_set_info()
5676 rc = cifs_send_recv(xid, ses, server, in send_set_info()
5747 struct TCP_Server_Info *server; in SMB2_oplock_break() local
5758 server = cifs_pick_channel(ses); in SMB2_oplock_break()
5761 rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, server, in SMB2_oplock_break()
5784 smb2_set_replay(server, &rqst); in SMB2_oplock_break()
5786 rc = cifs_send_recv(xid, ses, server, in SMB2_oplock_break()
5834 struct TCP_Server_Info *server, in build_qfs_info_req() argument
5844 if ((tcon->ses == NULL) || server == NULL) in build_qfs_info_req()
5847 rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, server, in build_qfs_info_req()
5883 struct TCP_Server_Info *server; in SMB311_posix_qfs_info() local
5891 server = cifs_pick_channel(ses); in SMB311_posix_qfs_info()
5893 rc = build_qfs_info_req(&iov, tcon, server, in SMB311_posix_qfs_info()
5908 smb2_set_replay(server, &rqst); in SMB311_posix_qfs_info()
5910 rc = cifs_send_recv(xid, ses, server, in SMB311_posix_qfs_info()
5948 struct TCP_Server_Info *server; in SMB2_QFS_info() local
5956 server = cifs_pick_channel(ses); in SMB2_QFS_info()
5958 rc = build_qfs_info_req(&iov, tcon, server, in SMB2_QFS_info()
5973 smb2_set_replay(server, &rqst); in SMB2_QFS_info()
5975 rc = cifs_send_recv(xid, ses, server, in SMB2_QFS_info()
6013 struct TCP_Server_Info *server; in SMB2_QFS_attr() local
6021 server = cifs_pick_channel(ses); in SMB2_QFS_attr()
6040 rc = build_qfs_info_req(&iov, tcon, server, in SMB2_QFS_attr()
6054 smb2_set_replay(server, &rqst); in SMB2_QFS_attr()
6056 rc = cifs_send_recv(xid, ses, server, in SMB2_QFS_attr()
6115 struct TCP_Server_Info *server; in smb2_lockv() local
6121 server = cifs_pick_channel(tcon->ses); in smb2_lockv()
6125 rc = smb2_plain_req_init(SMB2_LOCK, tcon, server, in smb2_lockv()
6153 smb2_set_replay(server, &rqst); in smb2_lockv()
6155 rc = cifs_send_recv(xid, tcon->ses, server, in smb2_lockv()
6205 struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses); in SMB2_lease_break() local
6208 rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, server, in SMB2_lease_break()
6232 rc = cifs_send_recv(xid, ses, server, in SMB2_lease_break()