diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 44130e052e0b..a3dc0d7cafc3 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1368,7 +1368,6 @@ cifs_find_tcp_session(struct sockaddr *addr) | |||
1368 | list_for_each(tmp, &cifs_tcp_ses_list) { | 1368 | list_for_each(tmp, &cifs_tcp_ses_list) { |
1369 | server = list_entry(tmp, struct TCP_Server_Info, | 1369 | server = list_entry(tmp, struct TCP_Server_Info, |
1370 | tcp_ses_list); | 1370 | tcp_ses_list); |
1371 | |||
1372 | /* | 1371 | /* |
1373 | * the demux thread can exit on its own while still in CifsNew | 1372 | * the demux thread can exit on its own while still in CifsNew |
1374 | * so don't accept any sockets in that state. Since the | 1373 | * so don't accept any sockets in that state. Since the |
@@ -1389,6 +1388,7 @@ cifs_find_tcp_session(struct sockaddr *addr) | |||
1389 | 1388 | ||
1390 | ++server->srv_count; | 1389 | ++server->srv_count; |
1391 | write_unlock(&cifs_tcp_ses_lock); | 1390 | write_unlock(&cifs_tcp_ses_lock); |
1391 | cFYI(1, ("Existing tcp session with server found")); | ||
1392 | return server; | 1392 | return server; |
1393 | } | 1393 | } |
1394 | write_unlock(&cifs_tcp_ses_lock); | 1394 | write_unlock(&cifs_tcp_ses_lock); |
@@ -2076,9 +2076,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | srvTcp = cifs_find_tcp_session(&addr); | 2078 | srvTcp = cifs_find_tcp_session(&addr); |
2079 | if (srvTcp) { | 2079 | if (!srvTcp) { /* create socket */ |
2080 | cFYI(1, ("Existing tcp session with server found")); | ||
2081 | } else { /* create socket */ | ||
2082 | if (addr.sa_family == AF_INET6) { | 2080 | if (addr.sa_family == AF_INET6) { |
2083 | cFYI(1, ("attempting ipv6 connect")); | 2081 | cFYI(1, ("attempting ipv6 connect")); |
2084 | /* BB should we allow ipv6 on port 139? */ | 2082 | /* BB should we allow ipv6 on port 139? */ |
@@ -2292,45 +2290,41 @@ mount_fail_check: | |||
2292 | cifs_put_smb_ses(pSesInfo); | 2290 | cifs_put_smb_ses(pSesInfo); |
2293 | else | 2291 | else |
2294 | cifs_put_tcp_session(srvTcp); | 2292 | cifs_put_tcp_session(srvTcp); |
2295 | } else { | 2293 | goto out; |
2296 | atomic_inc(&tcon->useCount); | 2294 | } |
2297 | cifs_sb->tcon = tcon; | 2295 | atomic_inc(&tcon->useCount); |
2298 | tcon->ses = pSesInfo; | 2296 | cifs_sb->tcon = tcon; |
2299 | 2297 | tcon->ses = pSesInfo; | |
2300 | /* do not care if following two calls succeed - informational */ | ||
2301 | if (!tcon->ipc) { | ||
2302 | CIFSSMBQFSDeviceInfo(xid, tcon); | ||
2303 | CIFSSMBQFSAttributeInfo(xid, tcon); | ||
2304 | } | ||
2305 | |||
2306 | /* tell server which Unix caps we support */ | ||
2307 | if (tcon->ses->capabilities & CAP_UNIX) | ||
2308 | /* reset of caps checks mount to see if unix extensions | ||
2309 | disabled for just this mount */ | ||
2310 | reset_cifs_unix_caps(xid, tcon, sb, &volume_info); | ||
2311 | else | ||
2312 | tcon->unix_ext = 0; /* server does not support them */ | ||
2313 | |||
2314 | /* convert forward to back slashes in prepath here if needed */ | ||
2315 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) == 0) | ||
2316 | convert_delimiter(cifs_sb->prepath, | ||
2317 | CIFS_DIR_SEP(cifs_sb)); | ||
2318 | 2298 | ||
2319 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { | 2299 | /* do not care if following two calls succeed - informational */ |
2320 | cifs_sb->rsize = 1024 * 127; | 2300 | if (!tcon->ipc) { |
2321 | cFYI(DBG2, | 2301 | CIFSSMBQFSDeviceInfo(xid, tcon); |
2322 | ("no very large read support, rsize now 127K")); | 2302 | CIFSSMBQFSAttributeInfo(xid, tcon); |
2323 | } | ||
2324 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) | ||
2325 | cifs_sb->wsize = min(cifs_sb->wsize, | ||
2326 | (tcon->ses->server->maxBuf - | ||
2327 | MAX_CIFS_HDR_SIZE)); | ||
2328 | if (!(tcon->ses->capabilities & CAP_LARGE_READ_X)) | ||
2329 | cifs_sb->rsize = min(cifs_sb->rsize, | ||
2330 | (tcon->ses->server->maxBuf - | ||
2331 | MAX_CIFS_HDR_SIZE)); | ||
2332 | } | 2303 | } |
2333 | 2304 | ||
2305 | /* tell server which Unix caps we support */ | ||
2306 | if (tcon->ses->capabilities & CAP_UNIX) | ||
2307 | /* reset of caps checks mount to see if unix extensions | ||
2308 | disabled for just this mount */ | ||
2309 | reset_cifs_unix_caps(xid, tcon, sb, &volume_info); | ||
2310 | else | ||
2311 | tcon->unix_ext = 0; /* server does not support them */ | ||
2312 | |||
2313 | /* convert forward to back slashes in prepath here if needed */ | ||
2314 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) == 0) | ||
2315 | convert_delimiter(cifs_sb->prepath, CIFS_DIR_SEP(cifs_sb)); | ||
2316 | |||
2317 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { | ||
2318 | cifs_sb->rsize = 1024 * 127; | ||
2319 | cFYI(DBG2, ("no very large read support, rsize now 127K")); | ||
2320 | } | ||
2321 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) | ||
2322 | cifs_sb->wsize = min(cifs_sb->wsize, | ||
2323 | (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); | ||
2324 | if (!(tcon->ses->capabilities & CAP_LARGE_READ_X)) | ||
2325 | cifs_sb->rsize = min(cifs_sb->rsize, | ||
2326 | (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); | ||
2327 | |||
2334 | /* volume_info.password is freed above when existing session found | 2328 | /* volume_info.password is freed above when existing session found |
2335 | (in which case it is not needed anymore) but when new sesion is created | 2329 | (in which case it is not needed anymore) but when new sesion is created |
2336 | the password ptr is put in the new session structure (in which case the | 2330 | the password ptr is put in the new session structure (in which case the |