aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-26 11:09:57 -0500
committerSteve French <smfrench@gmail.com>2012-12-05 14:27:30 -0500
commit9fa114f74feb140ac93e5983428c8f9312ffd6c2 (patch)
tree1f610de0857206e4c8f78f81b166dd901875a3fc /fs/cifs
parent1cc9bd68617f2a92dcd6e4398288341d16cfb5c1 (diff)
cifs: remove unneeded address argument from cifs_find_tcp_session and 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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 428d8a12b82..87fa16549f2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1992,9 +1992,10 @@ match_security(struct TCP_Server_Info *server, struct smb_vol *vol)
1992 return true; 1992 return true;
1993} 1993}
1994 1994
1995static int match_server(struct TCP_Server_Info *server, struct sockaddr *addr, 1995static int match_server(struct TCP_Server_Info *server, struct smb_vol *vol)
1996 struct smb_vol *vol)
1997{ 1996{
1997 struct sockaddr *addr = (struct sockaddr *)&vol->dstaddr;
1998
1998 if ((server->vals != vol->vals) || (server->ops != vol->ops)) 1999 if ((server->vals != vol->vals) || (server->ops != vol->ops))
1999 return 0; 2000 return 0;
2000 2001
@@ -2015,13 +2016,13 @@ static int match_server(struct TCP_Server_Info *server, struct sockaddr *addr,
2015} 2016}
2016 2017
2017static struct TCP_Server_Info * 2018static struct TCP_Server_Info *
2018cifs_find_tcp_session(struct sockaddr *addr, struct smb_vol *vol) 2019cifs_find_tcp_session(struct smb_vol *vol)
2019{ 2020{
2020 struct TCP_Server_Info *server; 2021 struct TCP_Server_Info *server;
2021 2022
2022 spin_lock(&cifs_tcp_ses_lock); 2023 spin_lock(&cifs_tcp_ses_lock);
2023 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { 2024 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
2024 if (!match_server(server, addr, vol)) 2025 if (!match_server(server, vol))
2025 continue; 2026 continue;
2026 2027
2027 ++server->srv_count; 2028 ++server->srv_count;
@@ -2071,13 +2072,12 @@ static struct TCP_Server_Info *
2071cifs_get_tcp_session(struct smb_vol *volume_info) 2072cifs_get_tcp_session(struct smb_vol *volume_info)
2072{ 2073{
2073 struct TCP_Server_Info *tcp_ses = NULL; 2074 struct TCP_Server_Info *tcp_ses = NULL;
2074 struct sockaddr *dstaddr = (struct sockaddr *)&volume_info->dstaddr;
2075 int rc; 2075 int rc;
2076 2076
2077 cFYI(1, "UNC: %s", volume_info->UNC); 2077 cFYI(1, "UNC: %s", volume_info->UNC);
2078 2078
2079 /* see if we already have a matching tcp_ses */ 2079 /* see if we already have a matching tcp_ses */
2080 tcp_ses = cifs_find_tcp_session(dstaddr, volume_info); 2080 tcp_ses = cifs_find_tcp_session(volume_info);
2081 if (tcp_ses) 2081 if (tcp_ses)
2082 return tcp_ses; 2082 return tcp_ses;
2083 2083
@@ -2122,19 +2122,18 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2122 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); 2122 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
2123 INIT_LIST_HEAD(&tcp_ses->smb_ses_list); 2123 INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
2124 INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); 2124 INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
2125 2125 memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
2126 sizeof(tcp_ses->srcaddr));
2127 memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr,
2128 sizeof(tcp_ses->dstaddr));
2126 /* 2129 /*
2127 * at this point we are the only ones with the pointer 2130 * at this point we are the only ones with the pointer
2128 * to the struct since the kernel thread not created yet 2131 * to the struct since the kernel thread not created yet
2129 * no need to spinlock this init of tcpStatus or srv_count 2132 * no need to spinlock this init of tcpStatus or srv_count
2130 */ 2133 */
2131 tcp_ses->tcpStatus = CifsNew; 2134 tcp_ses->tcpStatus = CifsNew;
2132 memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
2133 sizeof(tcp_ses->srcaddr));
2134 ++tcp_ses->srv_count; 2135 ++tcp_ses->srv_count;
2135 2136
2136 memcpy(&tcp_ses->dstaddr, dstaddr, sizeof(tcp_ses->dstaddr));
2137
2138 rc = ip_connect(tcp_ses); 2137 rc = ip_connect(tcp_ses);
2139 if (rc < 0) { 2138 if (rc < 0) {
2140 cERROR(1, "Error connecting to socket. Aborting operation"); 2139 cERROR(1, "Error connecting to socket. Aborting operation");
@@ -2693,7 +2692,6 @@ cifs_match_super(struct super_block *sb, void *data)
2693 struct cifs_ses *ses; 2692 struct cifs_ses *ses;
2694 struct cifs_tcon *tcon; 2693 struct cifs_tcon *tcon;
2695 struct tcon_link *tlink; 2694 struct tcon_link *tlink;
2696 struct sockaddr *dstaddr;
2697 int rc = 0; 2695 int rc = 0;
2698 2696
2699 spin_lock(&cifs_tcp_ses_lock); 2697 spin_lock(&cifs_tcp_ses_lock);
@@ -2708,9 +2706,8 @@ cifs_match_super(struct super_block *sb, void *data)
2708 tcp_srv = ses->server; 2706 tcp_srv = ses->server;
2709 2707
2710 volume_info = mnt_data->vol; 2708 volume_info = mnt_data->vol;
2711 dstaddr = (struct sockaddr *)&volume_info->dstaddr;
2712 2709
2713 if (!match_server(tcp_srv, dstaddr, volume_info) || 2710 if (!match_server(tcp_srv, volume_info) ||
2714 !match_session(ses, volume_info) || 2711 !match_session(ses, volume_info) ||
2715 !match_tcon(tcon, volume_info->UNC)) { 2712 !match_tcon(tcon, volume_info->UNC)) {
2716 rc = 0; 2713 rc = 0;