mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 1/2] cifs - find_unc cleanup
       [not found] <20080501154830.235254575@gmail.com>
@ 2008-05-01 15:48 ` Cyrill Gorcunov
  2008-05-06 22:06   ` Steve French
  2008-05-01 15:48 ` [patch 2/2] cifs - cifs_find_tcp_session cleanup Cyrill Gorcunov
  1 sibling, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov @ 2008-05-01 15:48 UTC (permalink / raw)
  To: Steve French, linux-kernel; +Cc: Cyrill Gorcunov

[-- Attachment #1: cifs-find-unc --]
[-- Type: text/plain, Size: 2563 bytes --]

This patch is to remove too indented code in find_unc

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/fs/cifs/connect.c
===================================================================
--- linux-2.6.git.orig/fs/cifs/connect.c	2008-05-01 18:21:38.000000000 +0400
+++ linux-2.6.git/fs/cifs/connect.c	2008-05-01 19:02:51.000000000 +0400
@@ -1362,45 +1362,43 @@ find_unc(__be32 new_target_ip_addr, char
 {
 	struct list_head *tmp;
 	struct cifsTconInfo *tcon;
+	__be32 old_ip;
 
 	read_lock(&GlobalSMBSeslock);
+
 	list_for_each(tmp, &GlobalTreeConnectionList) {
 		cFYI(1, ("Next tcon"));
 		tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
-		if (tcon->ses) {
-			if (tcon->ses->server) {
-				cFYI(1,
-				     ("old ip addr: %x == new ip %x ?",
-				      tcon->ses->server->addr.sockAddr.sin_addr.
-				      s_addr, new_target_ip_addr));
-				if (tcon->ses->server->addr.sockAddr.sin_addr.
-				    s_addr == new_target_ip_addr) {
-	/* BB lock tcon, server and tcp session and increment use count here? */
-					/* found a match on the TCP session */
-					/* BB check if reconnection needed */
-					cFYI(1,
-					      ("IP match, old UNC: %s new: %s",
-					      tcon->treeName, uncName));
-					if (strncmp
-					    (tcon->treeName, uncName,
-					     MAX_TREE_SIZE) == 0) {
-						cFYI(1,
-						     ("and old usr: %s new: %s",
-						      tcon->treeName, uncName));
-						if (strncmp
-						    (tcon->ses->userName,
-						     userName,
-						     MAX_USERNAME_SIZE) == 0) {
-							read_unlock(&GlobalSMBSeslock);
-							/* matched smb session
-							(user name */
-							return tcon;
-						}
-					}
-				}
-			}
-		}
+		if (!tcon->ses || !tcon->ses->server)
+			continue;
+
+		old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr;
+		cFYI(1, ("old ip addr: %x == new ip %x ?",
+			old_ip, new_target_ip_addr));
+
+		if (old_ip != new_target_ip_addr)
+			continue;
+
+		/* BB lock tcon, server and tcp session and increment use count here? */
+		/* found a match on the TCP session */
+		/* BB check if reconnection needed */
+		cFYI(1, ("IP match, old UNC: %s new: %s",
+			tcon->treeName, uncName));
+
+		if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE))
+			continue;
+
+		cFYI(1, ("and old usr: %s new: %s",
+			tcon->treeName, uncName));
+
+		if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE))
+			continue;
+
+		/* matched smb session (user name) */
+		read_unlock(&GlobalSMBSeslock);
+		return tcon;
 	}
+
 	read_unlock(&GlobalSMBSeslock);
 	return NULL;
 }

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 2/2] cifs - cifs_find_tcp_session cleanup
       [not found] <20080501154830.235254575@gmail.com>
  2008-05-01 15:48 ` [patch 1/2] cifs - find_unc cleanup Cyrill Gorcunov
@ 2008-05-01 15:48 ` Cyrill Gorcunov
  2008-05-06 22:07   ` Steve French
  1 sibling, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov @ 2008-05-01 15:48 UTC (permalink / raw)
  To: Steve French, linux-kernel; +Cc: Cyrill Gorcunov

[-- Attachment #1: cifs-cifs_find_tcp_session --]
[-- Type: text/plain, Size: 2538 bytes --]

This patch is to remove too indented code in cifs_find_tcp_session.
Also memcmp was used wrongly - we would have found the session
which IP6 addresses didn't match.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/fs/cifs/connect.c
===================================================================
--- linux-2.6.git.orig/fs/cifs/connect.c	2008-05-01 19:02:51.000000000 +0400
+++ linux-2.6.git/fs/cifs/connect.c	2008-05-01 19:36:54.000000000 +0400
@@ -1318,42 +1318,44 @@ cifs_parse_mount_options(char *options, 
 
 static struct cifsSesInfo *
 cifs_find_tcp_session(struct in_addr *target_ip_addr,
-		struct in6_addr *target_ip6_addr,
-		 char *userName, struct TCP_Server_Info **psrvTcp)
+		      struct in6_addr *target_ip6_addr,
+		      char *userName, struct TCP_Server_Info **psrvTcp)
 {
 	struct list_head *tmp;
 	struct cifsSesInfo *ses;
+
 	*psrvTcp = NULL;
-	read_lock(&GlobalSMBSeslock);
 
+	if (!target_ip_addr)
+		return NULL;
+
+	read_lock(&GlobalSMBSeslock);
 	list_for_each(tmp, &GlobalSMBSessionList) {
 		ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
-		if (ses->server) {
-			if ((target_ip_addr &&
-				(ses->server->addr.sockAddr.sin_addr.s_addr
-				  == target_ip_addr->s_addr)) || (target_ip6_addr
-				&& memcmp(&ses->server->addr.sockAddr6.sin6_addr,
-					target_ip6_addr, sizeof(*target_ip6_addr)))) {
-				/* BB lock server and tcp session and increment
-				      use count here?? */
-
-				/* found a match on the TCP session */
-				*psrvTcp = ses->server;
-
-				/* BB check if reconnection needed */
-				if (strncmp
-				    (ses->userName, userName,
-				     MAX_USERNAME_SIZE) == 0){
-					read_unlock(&GlobalSMBSeslock);
-					/* Found exact match on both TCP and
-					   SMB sessions */
-					return ses;
-				}
-			}
-		}
-		/* else tcp and smb sessions need reconnection */
+		if (!ses->server)
+			continue;
+
+		if (ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr ||
+		    memcmp(&ses->server->addr.sockAddr6.sin6_addr,
+			   target_ip6_addr, sizeof(*target_ip6_addr)))
+			continue;
+
+		/* BB lock server and tcp session and increment
+		   use count here?? */
+
+		/* found a match on the TCP session */
+		*psrvTcp = ses->server;
+
+		/* BB check if reconnection needed */
+		if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE))
+			continue;
+
+		/* Found exact match on both TCP and SMB sessions */
+		read_unlock(&GlobalSMBSeslock);
+		return ses;
 	}
 	read_unlock(&GlobalSMBSeslock);
+
 	return NULL;
 }
 

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] cifs - find_unc cleanup
  2008-05-01 15:48 ` [patch 1/2] cifs - find_unc cleanup Cyrill Gorcunov
@ 2008-05-06 22:06   ` Steve French
  0 siblings, 0 replies; 7+ messages in thread
From: Steve French @ 2008-05-06 22:06 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: linux-kernel

merged

On Thu, May 1, 2008 at 10:48 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> This patch is to remove too indented code in find_unc
>
>  Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
>  ---
>
>  Index: linux-2.6.git/fs/cifs/connect.c
>  ===================================================================
>  --- linux-2.6.git.orig/fs/cifs/connect.c        2008-05-01 18:21:38.000000000 +0400
>  +++ linux-2.6.git/fs/cifs/connect.c     2008-05-01 19:02:51.000000000 +0400
>  @@ -1362,45 +1362,43 @@ find_unc(__be32 new_target_ip_addr, char
>   {
>         struct list_head *tmp;
>         struct cifsTconInfo *tcon;
>  +       __be32 old_ip;
>
>         read_lock(&GlobalSMBSeslock);
>  +
>         list_for_each(tmp, &GlobalTreeConnectionList) {
>                 cFYI(1, ("Next tcon"));
>                 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
>  -               if (tcon->ses) {
>  -                       if (tcon->ses->server) {
>  -                               cFYI(1,
>  -                                    ("old ip addr: %x == new ip %x ?",
>  -                                     tcon->ses->server->addr.sockAddr.sin_addr.
>  -                                     s_addr, new_target_ip_addr));
>  -                               if (tcon->ses->server->addr.sockAddr.sin_addr.
>  -                                   s_addr == new_target_ip_addr) {
>  -       /* BB lock tcon, server and tcp session and increment use count here? */
>  -                                       /* found a match on the TCP session */
>  -                                       /* BB check if reconnection needed */
>  -                                       cFYI(1,
>  -                                             ("IP match, old UNC: %s new: %s",
>  -                                             tcon->treeName, uncName));
>  -                                       if (strncmp
>  -                                           (tcon->treeName, uncName,
>  -                                            MAX_TREE_SIZE) == 0) {
>  -                                               cFYI(1,
>  -                                                    ("and old usr: %s new: %s",
>  -                                                     tcon->treeName, uncName));
>  -                                               if (strncmp
>  -                                                   (tcon->ses->userName,
>  -                                                    userName,
>  -                                                    MAX_USERNAME_SIZE) == 0) {
>  -                                                       read_unlock(&GlobalSMBSeslock);
>  -                                                       /* matched smb session
>  -                                                       (user name */
>  -                                                       return tcon;
>  -                                               }
>  -                                       }
>  -                               }
>  -                       }
>  -               }
>  +               if (!tcon->ses || !tcon->ses->server)
>  +                       continue;
>  +
>  +               old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr;
>  +               cFYI(1, ("old ip addr: %x == new ip %x ?",
>  +                       old_ip, new_target_ip_addr));
>  +
>  +               if (old_ip != new_target_ip_addr)
>  +                       continue;
>  +
>  +               /* BB lock tcon, server and tcp session and increment use count here? */
>  +               /* found a match on the TCP session */
>  +               /* BB check if reconnection needed */
>  +               cFYI(1, ("IP match, old UNC: %s new: %s",
>  +                       tcon->treeName, uncName));
>  +
>  +               if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE))
>  +                       continue;
>  +
>  +               cFYI(1, ("and old usr: %s new: %s",
>  +                       tcon->treeName, uncName));
>  +
>  +               if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE))
>  +                       continue;
>  +
>  +               /* matched smb session (user name) */
>  +               read_unlock(&GlobalSMBSeslock);
>  +               return tcon;
>         }
>  +
>         read_unlock(&GlobalSMBSeslock);
>         return NULL;
>   }
>
>  --
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2/2] cifs - cifs_find_tcp_session cleanup
  2008-05-01 15:48 ` [patch 2/2] cifs - cifs_find_tcp_session cleanup Cyrill Gorcunov
@ 2008-05-06 22:07   ` Steve French
  2008-05-07  4:17     ` Cyrill Gorcunov
  2008-05-07  5:48     ` Cyrill Gorcunov
  0 siblings, 2 replies; 7+ messages in thread
From: Steve French @ 2008-05-06 22:07 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Steve French, linux-kernel

This looks like it would fail in the ipv6 case - because
target_ip_addr (the ipv4 address) would be null and it would exit
before checking.



On Thu, May 1, 2008 at 10:48 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> This patch is to remove too indented code in cifs_find_tcp_session.
>  Also memcmp was used wrongly - we would have found the session
>  which IP6 addresses didn't match.
>
>  Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
>  ---
>
>  Index: linux-2.6.git/fs/cifs/connect.c
>  ===================================================================
>  --- linux-2.6.git.orig/fs/cifs/connect.c        2008-05-01 19:02:51.000000000 +0400
>  +++ linux-2.6.git/fs/cifs/connect.c     2008-05-01 19:36:54.000000000 +0400
>  @@ -1318,42 +1318,44 @@ cifs_parse_mount_options(char *options,
>
>   static struct cifsSesInfo *
>   cifs_find_tcp_session(struct in_addr *target_ip_addr,
>  -               struct in6_addr *target_ip6_addr,
>  -                char *userName, struct TCP_Server_Info **psrvTcp)
>  +                     struct in6_addr *target_ip6_addr,
>  +                     char *userName, struct TCP_Server_Info **psrvTcp)
>   {
>         struct list_head *tmp;
>         struct cifsSesInfo *ses;
>  +
>         *psrvTcp = NULL;
>  -       read_lock(&GlobalSMBSeslock);
>
>  +       if (!target_ip_addr)
>  +               return NULL;
>  +
>  +       read_lock(&GlobalSMBSeslock);
>         list_for_each(tmp, &GlobalSMBSessionList) {
>                 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
>  -               if (ses->server) {
>  -                       if ((target_ip_addr &&
>  -                               (ses->server->addr.sockAddr.sin_addr.s_addr
>  -                                 == target_ip_addr->s_addr)) || (target_ip6_addr
>  -                               && memcmp(&ses->server->addr.sockAddr6.sin6_addr,
>  -                                       target_ip6_addr, sizeof(*target_ip6_addr)))) {
>  -                               /* BB lock server and tcp session and increment
>  -                                     use count here?? */
>  -
>  -                               /* found a match on the TCP session */
>  -                               *psrvTcp = ses->server;
>  -
>  -                               /* BB check if reconnection needed */
>  -                               if (strncmp
>  -                                   (ses->userName, userName,
>  -                                    MAX_USERNAME_SIZE) == 0){
>  -                                       read_unlock(&GlobalSMBSeslock);
>  -                                       /* Found exact match on both TCP and
>  -                                          SMB sessions */
>  -                                       return ses;
>  -                               }
>  -                       }
>  -               }
>  -               /* else tcp and smb sessions need reconnection */
>  +               if (!ses->server)
>  +                       continue;
>  +
>  +               if (ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr ||
>  +                   memcmp(&ses->server->addr.sockAddr6.sin6_addr,
>  +                          target_ip6_addr, sizeof(*target_ip6_addr)))
>  +                       continue;
>  +
>  +               /* BB lock server and tcp session and increment
>  +                  use count here?? */
>  +
>  +               /* found a match on the TCP session */
>  +               *psrvTcp = ses->server;
>  +
>  +               /* BB check if reconnection needed */
>  +               if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE))
>  +                       continue;
>  +
>  +               /* Found exact match on both TCP and SMB sessions */
>  +               read_unlock(&GlobalSMBSeslock);
>  +               return ses;
>         }
>         read_unlock(&GlobalSMBSeslock);
>  +
>         return NULL;
>   }
>
>
>  --
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2/2] cifs - cifs_find_tcp_session cleanup
  2008-05-06 22:07   ` Steve French
@ 2008-05-07  4:17     ` Cyrill Gorcunov
  2008-05-07  5:48     ` Cyrill Gorcunov
  1 sibling, 0 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2008-05-07  4:17 UTC (permalink / raw)
  To: Steve French; +Cc: Steve French, linux-kernel, Andrew Morton

On Wed, May 7, 2008 at 2:07 AM, Steve French <smfrench@gmail.com> wrote:
> This looks like it would fail in the ipv6 case - because
>  target_ip_addr (the ipv4 address) would be null and it would exit
>  before checking.
>
>
>
>
>
>  On Thu, May 1, 2008 at 10:48 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
>  > This patch is to remove too indented code in cifs_find_tcp_session.
>  >  Also memcmp was used wrongly - we would have found the session
>  >  which IP6 addresses didn't match.
>  >
>  >  Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
>  >  ---
>  >
>  >  Index: linux-2.6.git/fs/cifs/connect.c
>  >  ===================================================================
>  >  --- linux-2.6.git.orig/fs/cifs/connect.c        2008-05-01 19:02:51.000000000 +0400
>  >  +++ linux-2.6.git/fs/cifs/connect.c     2008-05-01 19:36:54.000000000 +0400
>  >  @@ -1318,42 +1318,44 @@ cifs_parse_mount_options(char *options,
>  >
>  >   static struct cifsSesInfo *
>  >   cifs_find_tcp_session(struct in_addr *target_ip_addr,
>  >  -               struct in6_addr *target_ip6_addr,
>  >  -                char *userName, struct TCP_Server_Info **psrvTcp)
>  >  +                     struct in6_addr *target_ip6_addr,
>  >  +                     char *userName, struct TCP_Server_Info **psrvTcp)
>  >   {
>  >         struct list_head *tmp;
>  >         struct cifsSesInfo *ses;
>  >  +
>  >         *psrvTcp = NULL;
>  >  -       read_lock(&GlobalSMBSeslock);
>  >
>  >  +       if (!target_ip_addr)
>  >  +               return NULL;
>  >  +
>  >  +       read_lock(&GlobalSMBSeslock);
>  >         list_for_each(tmp, &GlobalSMBSessionList) {
>  >                 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
>  >  -               if (ses->server) {
>  >  -                       if ((target_ip_addr &&
>  >  -                               (ses->server->addr.sockAddr.sin_addr.s_addr
>  >  -                                 == target_ip_addr->s_addr)) || (target_ip6_addr
>  >  -                               && memcmp(&ses->server->addr.sockAddr6.sin6_addr,
>  >  -                                       target_ip6_addr, sizeof(*target_ip6_addr)))) {
>  >  -                               /* BB lock server and tcp session and increment
>  >  -                                     use count here?? */
>  >  -
>  >  -                               /* found a match on the TCP session */
>  >  -                               *psrvTcp = ses->server;
>  >  -
>  >  -                               /* BB check if reconnection needed */
>  >  -                               if (strncmp
>  >  -                                   (ses->userName, userName,
>  >  -                                    MAX_USERNAME_SIZE) == 0){
>  >  -                                       read_unlock(&GlobalSMBSeslock);
>  >  -                                       /* Found exact match on both TCP and
>  >  -                                          SMB sessions */
>  >  -                                       return ses;
>  >  -                               }
>  >  -                       }
>  >  -               }
>  >  -               /* else tcp and smb sessions need reconnection */
>  >  +               if (!ses->server)
>  >  +                       continue;
>  >  +
>  >  +               if (ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr ||
>  >  +                   memcmp(&ses->server->addr.sockAddr6.sin6_addr,
>  >  +                          target_ip6_addr, sizeof(*target_ip6_addr)))
>  >  +                       continue;
>  >  +
>  >  +               /* BB lock server and tcp session and increment
>  >  +                  use count here?? */
>  >  +
>  >  +               /* found a match on the TCP session */
>  >  +               *psrvTcp = ses->server;
>  >  +
>  >  +               /* BB check if reconnection needed */
>  >  +               if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE))
>  >  +                       continue;
>  >  +
>  >  +               /* Found exact match on both TCP and SMB sessions */
>  >  +               read_unlock(&GlobalSMBSeslock);
>  >  +               return ses;
>  >         }
>  >         read_unlock(&GlobalSMBSeslock);
>  >  +
>  >         return NULL;
>  >   }
>  >
>  >
>  >  --
>  >
>
>
>
>  --
>  Thanks,
>
>  Steve
>

Ah, indeed! Thanks, Steve, I'm really sorry for this.
Will remake it.

Andrew, could you drop it from -mm please?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2/2] cifs - cifs_find_tcp_session cleanup
  2008-05-06 22:07   ` Steve French
  2008-05-07  4:17     ` Cyrill Gorcunov
@ 2008-05-07  5:48     ` Cyrill Gorcunov
  2008-05-09 18:55       ` Steve French
  1 sibling, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov @ 2008-05-07  5:48 UTC (permalink / raw)
  To: Steve French; +Cc: Steve French, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

On Wed, May 7, 2008 at 2:07 AM, Steve French <smfrench@gmail.com> wrote:
> This looks like it would fail in the ipv6 case - because
>  target_ip_addr (the ipv4 address) would be null and it would exit
>  before checking.
>

Steve, could you check an updated version, please

[-- Attachment #2: cifs-cifs_find_tcp_session-fix-cleanup-v2.patch --]
[-- Type: application/octet-stream, Size: 2465 bytes --]

---
From: Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [PATCH] cifs - cifs_find_tcp_session fix/cleanup v2

This patch cleans up cifs_find_tcp_session so it become
less indented. Also the error of skipping IPv6 matched
addresses fixed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

--- a/fs/cifs/connect.c	Sun May 04 00:51:10 2008
+++ a/fs/cifs/connect.c	Wed May 07 08:49:12 2008
@@ -1318,42 +1318,43 @@ cifs_parse_mount_options(char *options, 
 
 static struct cifsSesInfo *
 cifs_find_tcp_session(struct in_addr *target_ip_addr,
-		struct in6_addr *target_ip6_addr,
-		 char *userName, struct TCP_Server_Info **psrvTcp)
+		      struct in6_addr *target_ip6_addr,
+		      char *userName, struct TCP_Server_Info **psrvTcp)
 {
 	struct list_head *tmp;
 	struct cifsSesInfo *ses;
+
 	*psrvTcp = NULL;
-	read_lock(&GlobalSMBSeslock);
 
+	read_lock(&GlobalSMBSeslock);
 	list_for_each(tmp, &GlobalSMBSessionList) {
 		ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
-		if (ses->server) {
-			if ((target_ip_addr &&
-				(ses->server->addr.sockAddr.sin_addr.s_addr
-				  == target_ip_addr->s_addr)) || (target_ip6_addr
-				&& memcmp(&ses->server->addr.sockAddr6.sin6_addr,
-					target_ip6_addr, sizeof(*target_ip6_addr)))) {
-				/* BB lock server and tcp session and increment
-				      use count here?? */
-
-				/* found a match on the TCP session */
-				*psrvTcp = ses->server;
-
-				/* BB check if reconnection needed */
-				if (strncmp
-				    (ses->userName, userName,
-				     MAX_USERNAME_SIZE) == 0){
-					read_unlock(&GlobalSMBSeslock);
-					/* Found exact match on both TCP and
-					   SMB sessions */
-					return ses;
-				}
-			}
+		if (!ses->server)
+			continue;
+
+		if (target_ip_addr &&
+		    ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr)
+				continue;
+		else if (target_ip6_addr &&
+			 memcmp(&ses->server->addr.sockAddr6.sin6_addr,
+				target_ip6_addr, sizeof(*target_ip6_addr)))
+				continue;
+		/* BB lock server and tcp session and increment use count here?? */
+
+		/* found a match on the TCP session */
+		*psrvTcp = ses->server;
+
+		/* BB check if reconnection needed */
+		if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) {
+			read_unlock(&GlobalSMBSeslock);
+			/* Found exact match on both TCP and
+			   SMB sessions */
+			return ses;
 		}
 		/* else tcp and smb sessions need reconnection */
 	}
 	read_unlock(&GlobalSMBSeslock);
+
 	return NULL;
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 2/2] cifs - cifs_find_tcp_session cleanup
  2008-05-07  5:48     ` Cyrill Gorcunov
@ 2008-05-09 18:55       ` Steve French
  0 siblings, 0 replies; 7+ messages in thread
From: Steve French @ 2008-05-09 18:55 UTC (permalink / raw)
  To: lkml

reviewed and checked in.

On Wed, May 7, 2008 at 12:48 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
>
> On Wed, May 7, 2008 at 2:07 AM, Steve French <smfrench@gmail.com> wrote:
> > This looks like it would fail in the ipv6 case - because
> >  target_ip_addr (the ipv4 address) would be null and it would exit
> >  before checking.
> >
>
> Steve, could you check an updated version, please



--
Thanks,

Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-05-09 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20080501154830.235254575@gmail.com>
2008-05-01 15:48 ` [patch 1/2] cifs - find_unc cleanup Cyrill Gorcunov
2008-05-06 22:06   ` Steve French
2008-05-01 15:48 ` [patch 2/2] cifs - cifs_find_tcp_session cleanup Cyrill Gorcunov
2008-05-06 22:07   ` Steve French
2008-05-07  4:17     ` Cyrill Gorcunov
2008-05-07  5:48     ` Cyrill Gorcunov
2008-05-09 18:55       ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®