Skip to content

Commit

Permalink
cifs: remove unneeded address argument from cifs_find_tcp_session and…
Browse files Browse the repository at this point in the history
… match_server

Now that the smb_vol contains the destination sockaddr, there's no need
to pass it in separately.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
Jeff Layton authored and Steve French committed Dec 5, 2012
1 parent 1cc9bd6 commit 9fa114f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,9 +1992,10 @@ match_security(struct TCP_Server_Info *server, struct smb_vol *vol)
return true;
}

static int match_server(struct TCP_Server_Info *server, struct sockaddr *addr,
struct smb_vol *vol)
static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)
{
struct sockaddr *addr = (struct sockaddr *)&vol->dstaddr;

if ((server->vals != vol->vals) || (server->ops != vol->ops))
return 0;

Expand All @@ -2015,13 +2016,13 @@ static int match_server(struct TCP_Server_Info *server, struct sockaddr *addr,
}

static struct TCP_Server_Info *
cifs_find_tcp_session(struct sockaddr *addr, struct smb_vol *vol)
cifs_find_tcp_session(struct smb_vol *vol)
{
struct TCP_Server_Info *server;

spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
if (!match_server(server, addr, vol))
if (!match_server(server, vol))
continue;

++server->srv_count;
Expand Down Expand Up @@ -2071,13 +2072,12 @@ static struct TCP_Server_Info *
cifs_get_tcp_session(struct smb_vol *volume_info)
{
struct TCP_Server_Info *tcp_ses = NULL;
struct sockaddr *dstaddr = (struct sockaddr *)&volume_info->dstaddr;
int rc;

cFYI(1, "UNC: %s", volume_info->UNC);

/* see if we already have a matching tcp_ses */
tcp_ses = cifs_find_tcp_session(dstaddr, volume_info);
tcp_ses = cifs_find_tcp_session(volume_info);
if (tcp_ses)
return tcp_ses;

Expand Down Expand Up @@ -2122,19 +2122,18 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);

memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
sizeof(tcp_ses->srcaddr));
memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr,
sizeof(tcp_ses->dstaddr));
/*
* at this point we are the only ones with the pointer
* to the struct since the kernel thread not created yet
* no need to spinlock this init of tcpStatus or srv_count
*/
tcp_ses->tcpStatus = CifsNew;
memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
sizeof(tcp_ses->srcaddr));
++tcp_ses->srv_count;

memcpy(&tcp_ses->dstaddr, dstaddr, sizeof(tcp_ses->dstaddr));

rc = ip_connect(tcp_ses);
if (rc < 0) {
cERROR(1, "Error connecting to socket. Aborting operation");
Expand Down Expand Up @@ -2693,7 +2692,6 @@ cifs_match_super(struct super_block *sb, void *data)
struct cifs_ses *ses;
struct cifs_tcon *tcon;
struct tcon_link *tlink;
struct sockaddr *dstaddr;
int rc = 0;

spin_lock(&cifs_tcp_ses_lock);
Expand All @@ -2708,9 +2706,8 @@ cifs_match_super(struct super_block *sb, void *data)
tcp_srv = ses->server;

volume_info = mnt_data->vol;
dstaddr = (struct sockaddr *)&volume_info->dstaddr;

if (!match_server(tcp_srv, dstaddr, volume_info) ||
if (!match_server(tcp_srv, volume_info) ||
!match_session(ses, volume_info) ||
!match_tcon(tcon, volume_info->UNC)) {
rc = 0;
Expand Down

0 comments on commit 9fa114f

Please sign in to comment.