Commit b3773b19 authored by Steve French's avatar Steve French

SMB3: rename macro CIFS_SERVER_IS_CHAN to avoid confusion

Since older dialects such as CIFS do not support multichannel
the macro CIFS_SERVER_IS_CHAN can be confusing (it requires SMB 3
or later) so shorten its name to "SERVER_IS_CHAN"
Suggested-by: default avatarTom Talpey <tom@talpey.com>
Acked-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 09ee7a3b
...@@ -331,7 +331,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -331,7 +331,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
/* channel info will be printed as a part of sessions below */ /* channel info will be printed as a part of sessions below */
if (CIFS_SERVER_IS_CHAN(server)) if (SERVER_IS_CHAN(server))
continue; continue;
c++; c++;
......
...@@ -745,7 +745,7 @@ struct TCP_Server_Info { ...@@ -745,7 +745,7 @@ struct TCP_Server_Info {
* primary_server holds the ref-counted * primary_server holds the ref-counted
* pointer to primary channel connection for the session. * pointer to primary channel connection for the session.
*/ */
#define CIFS_SERVER_IS_CHAN(server) (!!(server)->primary_server) #define SERVER_IS_CHAN(server) (!!(server)->primary_server)
struct TCP_Server_Info *primary_server; struct TCP_Server_Info *primary_server;
__u16 channel_sequence_num; /* incremented on primary channel on each chan reconnect */ __u16 channel_sequence_num; /* incremented on primary channel on each chan reconnect */
......
...@@ -154,7 +154,7 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, ...@@ -154,7 +154,7 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
int i; int i;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
spin_lock(&pserver->srv_lock); spin_lock(&pserver->srv_lock);
if (!all_channels) { if (!all_channels) {
...@@ -202,7 +202,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, ...@@ -202,7 +202,7 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
cifs_dbg(FYI, "%s: marking necessary sessions and tcons for reconnect\n", __func__); cifs_dbg(FYI, "%s: marking necessary sessions and tcons for reconnect\n", __func__);
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
...@@ -1551,7 +1551,7 @@ cifs_find_tcp_session(struct smb3_fs_context *ctx) ...@@ -1551,7 +1551,7 @@ cifs_find_tcp_session(struct smb3_fs_context *ctx)
* Skip ses channels since they're only handled in lower layers * Skip ses channels since they're only handled in lower layers
* (e.g. cifs_send_recv). * (e.g. cifs_send_recv).
*/ */
if (CIFS_SERVER_IS_CHAN(server) || if (SERVER_IS_CHAN(server) ||
!match_server(server, ctx, false)) { !match_server(server, ctx, false)) {
spin_unlock(&server->srv_lock); spin_unlock(&server->srv_lock);
continue; continue;
...@@ -1587,7 +1587,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) ...@@ -1587,7 +1587,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
spin_unlock(&cifs_tcp_ses_lock); spin_unlock(&cifs_tcp_ses_lock);
/* For secondary channels, we pick up ref-count on the primary server */ /* For secondary channels, we pick up ref-count on the primary server */
if (CIFS_SERVER_IS_CHAN(server)) if (SERVER_IS_CHAN(server))
cifs_put_tcp_session(server->primary_server, from_reconnect); cifs_put_tcp_session(server->primary_server, from_reconnect);
cancel_delayed_work_sync(&server->echo); cancel_delayed_work_sync(&server->echo);
...@@ -1793,7 +1793,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, ...@@ -1793,7 +1793,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
out_err: out_err:
if (tcp_ses) { if (tcp_ses) {
if (CIFS_SERVER_IS_CHAN(tcp_ses)) if (SERVER_IS_CHAN(tcp_ses))
cifs_put_tcp_session(tcp_ses->primary_server, false); cifs_put_tcp_session(tcp_ses->primary_server, false);
kfree(tcp_ses->hostname); kfree(tcp_ses->hostname);
kfree(tcp_ses->leaf_fullpath); kfree(tcp_ses->leaf_fullpath);
...@@ -3814,7 +3814,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, ...@@ -3814,7 +3814,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
struct nls_table *nls_info) struct nls_table *nls_info)
{ {
int rc = -ENOSYS; int rc = -ENOSYS;
struct TCP_Server_Info *pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; struct TCP_Server_Info *pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&pserver->dstaddr; struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&pserver->dstaddr;
struct sockaddr_in *addr = (struct sockaddr_in *)&pserver->dstaddr; struct sockaddr_in *addr = (struct sockaddr_in *)&pserver->dstaddr;
bool is_binding = false; bool is_binding = false;
......
...@@ -476,7 +476,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) ...@@ -476,7 +476,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
return false; return false;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(srv) ? srv->primary_server : srv; pserver = SERVER_IS_CHAN(srv) ? srv->primary_server : srv;
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
......
...@@ -323,12 +323,12 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) ...@@ -323,12 +323,12 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
ses->chans[chan_index].iface = iface; ses->chans[chan_index].iface = iface;
/* No iface is found. if secondary chan, drop connection */ /* No iface is found. if secondary chan, drop connection */
if (!iface && CIFS_SERVER_IS_CHAN(server)) if (!iface && SERVER_IS_CHAN(server))
ses->chans[chan_index].server = NULL; ses->chans[chan_index].server = NULL;
spin_unlock(&ses->chan_lock); spin_unlock(&ses->chan_lock);
if (!iface && CIFS_SERVER_IS_CHAN(server)) if (!iface && SERVER_IS_CHAN(server))
cifs_put_tcp_session(server, false); cifs_put_tcp_session(server, false);
return rc; return rc;
......
...@@ -145,7 +145,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server) ...@@ -145,7 +145,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server)
__u64 mid; __u64 mid;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
/* /*
* Add function to do table lookup of StructureSize by command * Add function to do table lookup of StructureSize by command
...@@ -623,7 +623,7 @@ smb2_is_valid_lease_break(char *buffer, struct TCP_Server_Info *server) ...@@ -623,7 +623,7 @@ smb2_is_valid_lease_break(char *buffer, struct TCP_Server_Info *server)
cifs_dbg(FYI, "Checking for lease break\n"); cifs_dbg(FYI, "Checking for lease break\n");
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
...@@ -698,7 +698,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) ...@@ -698,7 +698,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
cifs_dbg(FYI, "oplock level 0x%x\n", rsp->OplockLevel); cifs_dbg(FYI, "oplock level 0x%x\n", rsp->OplockLevel);
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
......
...@@ -178,7 +178,7 @@ smb2_set_credits(struct TCP_Server_Info *server, const int val) ...@@ -178,7 +178,7 @@ smb2_set_credits(struct TCP_Server_Info *server, const int val)
* ChannelSequence updated for all channels in primary channel so that consistent * ChannelSequence updated for all channels in primary channel so that consistent
* across SMB3 requests sent on any channel. See MS-SMB2 3.2.4.1 and 3.2.7.1 * across SMB3 requests sent on any channel. See MS-SMB2 3.2.4.1 and 3.2.7.1
*/ */
if (CIFS_SERVER_IS_CHAN(server)) if (SERVER_IS_CHAN(server))
server->primary_server->channel_sequence_num++; server->primary_server->channel_sequence_num++;
else else
server->channel_sequence_num++; server->channel_sequence_num++;
...@@ -2406,7 +2406,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server) ...@@ -2406,7 +2406,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
return false; return false;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
...@@ -4282,7 +4282,7 @@ smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key) ...@@ -4282,7 +4282,7 @@ smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key)
u8 *ses_enc_key; u8 *ses_enc_key;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
......
...@@ -96,7 +96,7 @@ smb2_hdr_assemble(struct smb2_hdr *shdr, __le16 smb2_cmd, ...@@ -96,7 +96,7 @@ smb2_hdr_assemble(struct smb2_hdr *shdr, __le16 smb2_cmd,
/* After reconnect SMB3 must set ChannelSequence on subsequent reqs */ /* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
smb3_hdr = (struct smb3_hdr_req *)shdr; smb3_hdr = (struct smb3_hdr_req *)shdr;
/* if primary channel is not set yet, use default channel for chan sequence num */ /* if primary channel is not set yet, use default channel for chan sequence num */
if (CIFS_SERVER_IS_CHAN(server)) if (SERVER_IS_CHAN(server))
smb3_hdr->ChannelSequence = smb3_hdr->ChannelSequence =
cpu_to_le16(server->primary_server->channel_sequence_num); cpu_to_le16(server->primary_server->channel_sequence_num);
else else
...@@ -564,7 +564,7 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, ...@@ -564,7 +564,7 @@ assemble_neg_contexts(struct smb2_negotiate_req *req,
* secondary channels don't have the hostname field populated * secondary channels don't have the hostname field populated
* use the hostname field in the primary channel instead * use the hostname field in the primary channel instead
*/ */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
cifs_server_lock(pserver); cifs_server_lock(pserver);
hostname = pserver->hostname; hostname = pserver->hostname;
if (hostname && (hostname[0] != 0)) { if (hostname && (hostname[0] != 0)) {
...@@ -3796,7 +3796,7 @@ void smb2_reconnect_server(struct work_struct *work) ...@@ -3796,7 +3796,7 @@ void smb2_reconnect_server(struct work_struct *work)
bool resched = false; bool resched = false;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
/* Prevent simultaneous reconnects that can corrupt tcon->rlist list */ /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */
mutex_lock(&pserver->reconnect_mutex); mutex_lock(&pserver->reconnect_mutex);
......
...@@ -86,7 +86,7 @@ int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key) ...@@ -86,7 +86,7 @@ int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key)
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
if (ses->Suid == ses_id) if (ses->Suid == ses_id)
...@@ -149,7 +149,7 @@ smb2_find_smb_ses_unlocked(struct TCP_Server_Info *server, __u64 ses_id) ...@@ -149,7 +149,7 @@ smb2_find_smb_ses_unlocked(struct TCP_Server_Info *server, __u64 ses_id)
struct cifs_ses *ses; struct cifs_ses *ses;
/* If server is a channel, select the primary channel */ /* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
if (ses->Suid != ses_id) if (ses->Suid != ses_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment