aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/connect.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6c4332f8da6c..f2259db075c4 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1362,45 +1362,43 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName)
1362{ 1362{
1363 struct list_head *tmp; 1363 struct list_head *tmp;
1364 struct cifsTconInfo *tcon; 1364 struct cifsTconInfo *tcon;
1365 __be32 old_ip;
1365 1366
1366 read_lock(&GlobalSMBSeslock); 1367 read_lock(&GlobalSMBSeslock);
1368
1367 list_for_each(tmp, &GlobalTreeConnectionList) { 1369 list_for_each(tmp, &GlobalTreeConnectionList) {
1368 cFYI(1, ("Next tcon")); 1370 cFYI(1, ("Next tcon"));
1369 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 1371 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
1370 if (tcon->ses) { 1372 if (!tcon->ses || !tcon->ses->server)
1371 if (tcon->ses->server) { 1373 continue;
1372 cFYI(1, 1374
1373 ("old ip addr: %x == new ip %x ?", 1375 old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr;
1374 tcon->ses->server->addr.sockAddr.sin_addr. 1376 cFYI(1, ("old ip addr: %x == new ip %x ?",
1375 s_addr, new_target_ip_addr)); 1377 old_ip, new_target_ip_addr));
1376 if (tcon->ses->server->addr.sockAddr.sin_addr. 1378
1377 s_addr == new_target_ip_addr) { 1379 if (old_ip != new_target_ip_addr)
1378 /* BB lock tcon, server and tcp session and increment use count here? */ 1380 continue;
1379 /* found a match on the TCP session */ 1381
1380 /* BB check if reconnection needed */ 1382 /* BB lock tcon, server, tcp session and increment use count? */
1381 cFYI(1, 1383 /* found a match on the TCP session */
1382 ("IP match, old UNC: %s new: %s", 1384 /* BB check if reconnection needed */
1383 tcon->treeName, uncName)); 1385 cFYI(1, ("IP match, old UNC: %s new: %s",
1384 if (strncmp 1386 tcon->treeName, uncName));
1385 (tcon->treeName, uncName, 1387
1386 MAX_TREE_SIZE) == 0) { 1388 if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE))
1387 cFYI(1, 1389 continue;
1388 ("and old usr: %s new: %s", 1390
1389 tcon->treeName, uncName)); 1391 cFYI(1, ("and old usr: %s new: %s",
1390 if (strncmp 1392 tcon->treeName, uncName));
1391 (tcon->ses->userName, 1393
1392 userName, 1394 if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE))
1393 MAX_USERNAME_SIZE) == 0) { 1395 continue;
1394 read_unlock(&GlobalSMBSeslock); 1396
1395 /* matched smb session 1397 /* matched smb session (user name) */
1396 (user name */ 1398 read_unlock(&GlobalSMBSeslock);
1397 return tcon; 1399 return tcon;
1398 }
1399 }
1400 }
1401 }
1402 }
1403 } 1400 }
1401
1404 read_unlock(&GlobalSMBSeslock); 1402 read_unlock(&GlobalSMBSeslock);
1405 return NULL; 1403 return NULL;
1406} 1404}