Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339472
b: refs/heads/master
c: 9fa114f
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Dec 5, 2012
1 parent 6366492 commit cfb3c9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cc9bd68617f2a92dcd6e4398288341d16cfb5c1
refs/heads/master: 9fa114f74feb140ac93e5983428c8f9312ffd6c2
25 changes: 11 additions & 14 deletions trunk/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 cfb3c9b

Please sign in to comment.