diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 232 |
1 files changed, 114 insertions, 118 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e17106730168..f428bf3bf1a9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -49,8 +49,6 @@ | |||
49 | #define CIFS_PORT 445 | 49 | #define CIFS_PORT 445 |
50 | #define RFC1001_PORT 139 | 50 | #define RFC1001_PORT 139 |
51 | 51 | ||
52 | static DECLARE_COMPLETION(cifsd_complete); | ||
53 | |||
54 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 52 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
55 | unsigned char *p24); | 53 | unsigned char *p24); |
56 | 54 | ||
@@ -71,23 +69,23 @@ struct smb_vol { | |||
71 | mode_t file_mode; | 69 | mode_t file_mode; |
72 | mode_t dir_mode; | 70 | mode_t dir_mode; |
73 | unsigned secFlg; | 71 | unsigned secFlg; |
74 | unsigned rw:1; | 72 | bool rw:1; |
75 | unsigned retry:1; | 73 | bool retry:1; |
76 | unsigned intr:1; | 74 | bool intr:1; |
77 | unsigned setuids:1; | 75 | bool setuids:1; |
78 | unsigned override_uid:1; | 76 | bool override_uid:1; |
79 | unsigned override_gid:1; | 77 | bool override_gid:1; |
80 | unsigned noperm:1; | 78 | bool noperm:1; |
81 | unsigned no_psx_acl:1; /* set if posix acl support should be disabled */ | 79 | bool no_psx_acl:1; /* set if posix acl support should be disabled */ |
82 | unsigned cifs_acl:1; | 80 | bool cifs_acl:1; |
83 | unsigned no_xattr:1; /* set if xattr (EA) support should be disabled*/ | 81 | bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ |
84 | unsigned server_ino:1; /* use inode numbers from server ie UniqueId */ | 82 | bool server_ino:1; /* use inode numbers from server ie UniqueId */ |
85 | unsigned direct_io:1; | 83 | bool direct_io:1; |
86 | unsigned remap:1; /* set to remap seven reserved chars in filenames */ | 84 | bool remap:1; /* set to remap seven reserved chars in filenames */ |
87 | unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ | 85 | bool posix_paths:1; /* unset to not ask for posix pathnames. */ |
88 | unsigned no_linux_ext:1; | 86 | bool no_linux_ext:1; |
89 | unsigned sfu_emul:1; | 87 | bool sfu_emul:1; |
90 | unsigned nullauth:1; /* attempt to authenticate with null user */ | 88 | bool nullauth:1; /* attempt to authenticate with null user */ |
91 | unsigned nocase; /* request case insensitive filenames */ | 89 | unsigned nocase; /* request case insensitive filenames */ |
92 | unsigned nobrl; /* disable sending byte range locks to srv */ | 90 | unsigned nobrl; /* disable sending byte range locks to srv */ |
93 | unsigned int rsize; | 91 | unsigned int rsize; |
@@ -345,18 +343,16 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
345 | struct task_struct *task_to_wake = NULL; | 343 | struct task_struct *task_to_wake = NULL; |
346 | struct mid_q_entry *mid_entry; | 344 | struct mid_q_entry *mid_entry; |
347 | char temp; | 345 | char temp; |
348 | int isLargeBuf = FALSE; | 346 | bool isLargeBuf = false; |
349 | int isMultiRsp; | 347 | bool isMultiRsp; |
350 | int reconnect; | 348 | int reconnect; |
351 | 349 | ||
352 | current->flags |= PF_MEMALLOC; | 350 | current->flags |= PF_MEMALLOC; |
353 | server->tsk = current; /* save process info to wake at shutdown */ | ||
354 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); | 351 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); |
355 | write_lock(&GlobalSMBSeslock); | 352 | write_lock(&GlobalSMBSeslock); |
356 | atomic_inc(&tcpSesAllocCount); | 353 | atomic_inc(&tcpSesAllocCount); |
357 | length = tcpSesAllocCount.counter; | 354 | length = tcpSesAllocCount.counter; |
358 | write_unlock(&GlobalSMBSeslock); | 355 | write_unlock(&GlobalSMBSeslock); |
359 | complete(&cifsd_complete); | ||
360 | if (length > 1) | 356 | if (length > 1) |
361 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, | 357 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, |
362 | GFP_KERNEL); | 358 | GFP_KERNEL); |
@@ -390,8 +386,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
390 | } else /* if existing small buf clear beginning */ | 386 | } else /* if existing small buf clear beginning */ |
391 | memset(smallbuf, 0, sizeof(struct smb_hdr)); | 387 | memset(smallbuf, 0, sizeof(struct smb_hdr)); |
392 | 388 | ||
393 | isLargeBuf = FALSE; | 389 | isLargeBuf = false; |
394 | isMultiRsp = FALSE; | 390 | isMultiRsp = false; |
395 | smb_buffer = smallbuf; | 391 | smb_buffer = smallbuf; |
396 | iov.iov_base = smb_buffer; | 392 | iov.iov_base = smb_buffer; |
397 | iov.iov_len = 4; | 393 | iov.iov_len = 4; |
@@ -517,7 +513,7 @@ incomplete_rcv: | |||
517 | reconnect = 0; | 513 | reconnect = 0; |
518 | 514 | ||
519 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { | 515 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { |
520 | isLargeBuf = TRUE; | 516 | isLargeBuf = true; |
521 | memcpy(bigbuf, smallbuf, 4); | 517 | memcpy(bigbuf, smallbuf, 4); |
522 | smb_buffer = bigbuf; | 518 | smb_buffer = bigbuf; |
523 | } | 519 | } |
@@ -582,16 +578,18 @@ incomplete_rcv: | |||
582 | (mid_entry->command == smb_buffer->Command)) { | 578 | (mid_entry->command == smb_buffer->Command)) { |
583 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { | 579 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { |
584 | /* We have a multipart transact2 resp */ | 580 | /* We have a multipart transact2 resp */ |
585 | isMultiRsp = TRUE; | 581 | isMultiRsp = true; |
586 | if (mid_entry->resp_buf) { | 582 | if (mid_entry->resp_buf) { |
587 | /* merge response - fix up 1st*/ | 583 | /* merge response - fix up 1st*/ |
588 | if (coalesce_t2(smb_buffer, | 584 | if (coalesce_t2(smb_buffer, |
589 | mid_entry->resp_buf)) { | 585 | mid_entry->resp_buf)) { |
590 | mid_entry->multiRsp = 1; | 586 | mid_entry->multiRsp = |
587 | true; | ||
591 | break; | 588 | break; |
592 | } else { | 589 | } else { |
593 | /* all parts received */ | 590 | /* all parts received */ |
594 | mid_entry->multiEnd = 1; | 591 | mid_entry->multiEnd = |
592 | true; | ||
595 | goto multi_t2_fnd; | 593 | goto multi_t2_fnd; |
596 | } | 594 | } |
597 | } else { | 595 | } else { |
@@ -603,17 +601,15 @@ incomplete_rcv: | |||
603 | /* Have first buffer */ | 601 | /* Have first buffer */ |
604 | mid_entry->resp_buf = | 602 | mid_entry->resp_buf = |
605 | smb_buffer; | 603 | smb_buffer; |
606 | mid_entry->largeBuf = 1; | 604 | mid_entry->largeBuf = |
605 | true; | ||
607 | bigbuf = NULL; | 606 | bigbuf = NULL; |
608 | } | 607 | } |
609 | } | 608 | } |
610 | break; | 609 | break; |
611 | } | 610 | } |
612 | mid_entry->resp_buf = smb_buffer; | 611 | mid_entry->resp_buf = smb_buffer; |
613 | if (isLargeBuf) | 612 | mid_entry->largeBuf = isLargeBuf; |
614 | mid_entry->largeBuf = 1; | ||
615 | else | ||
616 | mid_entry->largeBuf = 0; | ||
617 | multi_t2_fnd: | 613 | multi_t2_fnd: |
618 | task_to_wake = mid_entry->tsk; | 614 | task_to_wake = mid_entry->tsk; |
619 | mid_entry->midState = MID_RESPONSE_RECEIVED; | 615 | mid_entry->midState = MID_RESPONSE_RECEIVED; |
@@ -638,8 +634,8 @@ multi_t2_fnd: | |||
638 | smallbuf = NULL; | 634 | smallbuf = NULL; |
639 | } | 635 | } |
640 | wake_up_process(task_to_wake); | 636 | wake_up_process(task_to_wake); |
641 | } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE) | 637 | } else if (!is_valid_oplock_break(smb_buffer, server) && |
642 | && (isMultiRsp == FALSE)) { | 638 | !isMultiRsp) { |
643 | cERROR(1, ("No task to wake, unknown frame received! " | 639 | cERROR(1, ("No task to wake, unknown frame received! " |
644 | "NumMids %d", midCount.counter)); | 640 | "NumMids %d", midCount.counter)); |
645 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, | 641 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, |
@@ -654,10 +650,20 @@ multi_t2_fnd: | |||
654 | 650 | ||
655 | spin_lock(&GlobalMid_Lock); | 651 | spin_lock(&GlobalMid_Lock); |
656 | server->tcpStatus = CifsExiting; | 652 | server->tcpStatus = CifsExiting; |
657 | server->tsk = NULL; | 653 | spin_unlock(&GlobalMid_Lock); |
654 | |||
655 | /* don't exit until kthread_stop is called */ | ||
656 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
657 | while (!kthread_should_stop()) { | ||
658 | schedule(); | ||
659 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
660 | } | ||
661 | set_current_state(TASK_RUNNING); | ||
662 | |||
658 | /* check if we have blocked requests that need to free */ | 663 | /* check if we have blocked requests that need to free */ |
659 | /* Note that cifs_max_pending is normally 50, but | 664 | /* Note that cifs_max_pending is normally 50, but |
660 | can be set at module install time to as little as two */ | 665 | can be set at module install time to as little as two */ |
666 | spin_lock(&GlobalMid_Lock); | ||
661 | if (atomic_read(&server->inFlight) >= cifs_max_pending) | 667 | if (atomic_read(&server->inFlight) >= cifs_max_pending) |
662 | atomic_set(&server->inFlight, cifs_max_pending - 1); | 668 | atomic_set(&server->inFlight, cifs_max_pending - 1); |
663 | /* We do not want to set the max_pending too low or we | 669 | /* We do not want to set the max_pending too low or we |
@@ -825,7 +831,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
825 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); | 831 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); |
826 | 832 | ||
827 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ | 833 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ |
828 | vol->rw = TRUE; | 834 | vol->rw = true; |
829 | /* default is always to request posix paths. */ | 835 | /* default is always to request posix paths. */ |
830 | vol->posix_paths = 1; | 836 | vol->posix_paths = 1; |
831 | 837 | ||
@@ -1181,7 +1187,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1181 | } else if (strnicmp(data, "guest", 5) == 0) { | 1187 | } else if (strnicmp(data, "guest", 5) == 0) { |
1182 | /* ignore */ | 1188 | /* ignore */ |
1183 | } else if (strnicmp(data, "rw", 2) == 0) { | 1189 | } else if (strnicmp(data, "rw", 2) == 0) { |
1184 | vol->rw = TRUE; | 1190 | vol->rw = true; |
1185 | } else if ((strnicmp(data, "suid", 4) == 0) || | 1191 | } else if ((strnicmp(data, "suid", 4) == 0) || |
1186 | (strnicmp(data, "nosuid", 6) == 0) || | 1192 | (strnicmp(data, "nosuid", 6) == 0) || |
1187 | (strnicmp(data, "exec", 4) == 0) || | 1193 | (strnicmp(data, "exec", 4) == 0) || |
@@ -1197,7 +1203,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1197 | is ok to just ignore them */ | 1203 | is ok to just ignore them */ |
1198 | continue; | 1204 | continue; |
1199 | } else if (strnicmp(data, "ro", 2) == 0) { | 1205 | } else if (strnicmp(data, "ro", 2) == 0) { |
1200 | vol->rw = FALSE; | 1206 | vol->rw = false; |
1201 | } else if (strnicmp(data, "hard", 4) == 0) { | 1207 | } else if (strnicmp(data, "hard", 4) == 0) { |
1202 | vol->retry = 1; | 1208 | vol->retry = 1; |
1203 | } else if (strnicmp(data, "soft", 4) == 0) { | 1209 | } else if (strnicmp(data, "soft", 4) == 0) { |
@@ -1305,6 +1311,9 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1305 | "begin with // or \\\\ \n"); | 1311 | "begin with // or \\\\ \n"); |
1306 | return 1; | 1312 | return 1; |
1307 | } | 1313 | } |
1314 | value = strpbrk(vol->UNC+2, "/\\"); | ||
1315 | if (value) | ||
1316 | *value = '\\'; | ||
1308 | } else { | 1317 | } else { |
1309 | printk(KERN_WARNING "CIFS: UNC name too long\n"); | 1318 | printk(KERN_WARNING "CIFS: UNC name too long\n"); |
1310 | return 1; | 1319 | return 1; |
@@ -1318,42 +1327,43 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1318 | 1327 | ||
1319 | static struct cifsSesInfo * | 1328 | static struct cifsSesInfo * |
1320 | cifs_find_tcp_session(struct in_addr *target_ip_addr, | 1329 | cifs_find_tcp_session(struct in_addr *target_ip_addr, |
1321 | struct in6_addr *target_ip6_addr, | 1330 | struct in6_addr *target_ip6_addr, |
1322 | char *userName, struct TCP_Server_Info **psrvTcp) | 1331 | char *userName, struct TCP_Server_Info **psrvTcp) |
1323 | { | 1332 | { |
1324 | struct list_head *tmp; | 1333 | struct list_head *tmp; |
1325 | struct cifsSesInfo *ses; | 1334 | struct cifsSesInfo *ses; |
1335 | |||
1326 | *psrvTcp = NULL; | 1336 | *psrvTcp = NULL; |
1327 | read_lock(&GlobalSMBSeslock); | ||
1328 | 1337 | ||
1338 | read_lock(&GlobalSMBSeslock); | ||
1329 | list_for_each(tmp, &GlobalSMBSessionList) { | 1339 | list_for_each(tmp, &GlobalSMBSessionList) { |
1330 | ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); | 1340 | ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); |
1331 | if (ses->server) { | 1341 | if (!ses->server) |
1332 | if ((target_ip_addr && | 1342 | continue; |
1333 | (ses->server->addr.sockAddr.sin_addr.s_addr | 1343 | |
1334 | == target_ip_addr->s_addr)) || (target_ip6_addr | 1344 | if (target_ip_addr && |
1335 | && memcmp(&ses->server->addr.sockAddr6.sin6_addr, | 1345 | ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr) |
1336 | target_ip6_addr, sizeof(*target_ip6_addr)))) { | 1346 | continue; |
1337 | /* BB lock server and tcp session and increment | 1347 | else if (target_ip6_addr && |
1338 | use count here?? */ | 1348 | memcmp(&ses->server->addr.sockAddr6.sin6_addr, |
1339 | 1349 | target_ip6_addr, sizeof(*target_ip6_addr))) | |
1340 | /* found a match on the TCP session */ | 1350 | continue; |
1341 | *psrvTcp = ses->server; | 1351 | /* BB lock server and tcp session; increment use count here?? */ |
1342 | 1352 | ||
1343 | /* BB check if reconnection needed */ | 1353 | /* found a match on the TCP session */ |
1344 | if (strncmp | 1354 | *psrvTcp = ses->server; |
1345 | (ses->userName, userName, | 1355 | |
1346 | MAX_USERNAME_SIZE) == 0){ | 1356 | /* BB check if reconnection needed */ |
1347 | read_unlock(&GlobalSMBSeslock); | 1357 | if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) { |
1348 | /* Found exact match on both TCP and | 1358 | read_unlock(&GlobalSMBSeslock); |
1349 | SMB sessions */ | 1359 | /* Found exact match on both TCP and |
1350 | return ses; | 1360 | SMB sessions */ |
1351 | } | 1361 | return ses; |
1352 | } | ||
1353 | } | 1362 | } |
1354 | /* else tcp and smb sessions need reconnection */ | 1363 | /* else tcp and smb sessions need reconnection */ |
1355 | } | 1364 | } |
1356 | read_unlock(&GlobalSMBSeslock); | 1365 | read_unlock(&GlobalSMBSeslock); |
1366 | |||
1357 | return NULL; | 1367 | return NULL; |
1358 | } | 1368 | } |
1359 | 1369 | ||
@@ -1362,45 +1372,43 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) | |||
1362 | { | 1372 | { |
1363 | struct list_head *tmp; | 1373 | struct list_head *tmp; |
1364 | struct cifsTconInfo *tcon; | 1374 | struct cifsTconInfo *tcon; |
1375 | __be32 old_ip; | ||
1365 | 1376 | ||
1366 | read_lock(&GlobalSMBSeslock); | 1377 | read_lock(&GlobalSMBSeslock); |
1378 | |||
1367 | list_for_each(tmp, &GlobalTreeConnectionList) { | 1379 | list_for_each(tmp, &GlobalTreeConnectionList) { |
1368 | cFYI(1, ("Next tcon")); | 1380 | cFYI(1, ("Next tcon")); |
1369 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); | 1381 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
1370 | if (tcon->ses) { | 1382 | if (!tcon->ses || !tcon->ses->server) |
1371 | if (tcon->ses->server) { | 1383 | continue; |
1372 | cFYI(1, | 1384 | |
1373 | ("old ip addr: %x == new ip %x ?", | 1385 | old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr; |
1374 | tcon->ses->server->addr.sockAddr.sin_addr. | 1386 | cFYI(1, ("old ip addr: %x == new ip %x ?", |
1375 | s_addr, new_target_ip_addr)); | 1387 | old_ip, new_target_ip_addr)); |
1376 | if (tcon->ses->server->addr.sockAddr.sin_addr. | 1388 | |
1377 | s_addr == new_target_ip_addr) { | 1389 | if (old_ip != new_target_ip_addr) |
1378 | /* BB lock tcon, server and tcp session and increment use count here? */ | 1390 | continue; |
1379 | /* found a match on the TCP session */ | 1391 | |
1380 | /* BB check if reconnection needed */ | 1392 | /* BB lock tcon, server, tcp session and increment use count? */ |
1381 | cFYI(1, | 1393 | /* found a match on the TCP session */ |
1382 | ("IP match, old UNC: %s new: %s", | 1394 | /* BB check if reconnection needed */ |
1383 | tcon->treeName, uncName)); | 1395 | cFYI(1, ("IP match, old UNC: %s new: %s", |
1384 | if (strncmp | 1396 | tcon->treeName, uncName)); |
1385 | (tcon->treeName, uncName, | 1397 | |
1386 | MAX_TREE_SIZE) == 0) { | 1398 | if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE)) |
1387 | cFYI(1, | 1399 | continue; |
1388 | ("and old usr: %s new: %s", | 1400 | |
1389 | tcon->treeName, uncName)); | 1401 | cFYI(1, ("and old usr: %s new: %s", |
1390 | if (strncmp | 1402 | tcon->treeName, uncName)); |
1391 | (tcon->ses->userName, | 1403 | |
1392 | userName, | 1404 | if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE)) |
1393 | MAX_USERNAME_SIZE) == 0) { | 1405 | continue; |
1394 | read_unlock(&GlobalSMBSeslock); | 1406 | |
1395 | /* matched smb session | 1407 | /* matched smb session (user name) */ |
1396 | (user name */ | 1408 | read_unlock(&GlobalSMBSeslock); |
1397 | return tcon; | 1409 | return tcon; |
1398 | } | ||
1399 | } | ||
1400 | } | ||
1401 | } | ||
1402 | } | ||
1403 | } | 1410 | } |
1411 | |||
1404 | read_unlock(&GlobalSMBSeslock); | 1412 | read_unlock(&GlobalSMBSeslock); |
1405 | return NULL; | 1413 | return NULL; |
1406 | } | 1414 | } |
@@ -1982,7 +1990,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1982 | kfree(srvTcp->hostname); | 1990 | kfree(srvTcp->hostname); |
1983 | goto out; | 1991 | goto out; |
1984 | } | 1992 | } |
1985 | wait_for_completion(&cifsd_complete); | ||
1986 | rc = 0; | 1993 | rc = 0; |
1987 | memcpy(srvTcp->workstation_RFC1001_name, | 1994 | memcpy(srvTcp->workstation_RFC1001_name, |
1988 | volume_info.source_rfc1001_name, 16); | 1995 | volume_info.source_rfc1001_name, 16); |
@@ -2189,15 +2196,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2189 | srvTcp->tcpStatus = CifsExiting; | 2196 | srvTcp->tcpStatus = CifsExiting; |
2190 | spin_unlock(&GlobalMid_Lock); | 2197 | spin_unlock(&GlobalMid_Lock); |
2191 | if (srvTcp->tsk) { | 2198 | if (srvTcp->tsk) { |
2192 | struct task_struct *tsk; | ||
2193 | /* If we could verify that kthread_stop would | 2199 | /* If we could verify that kthread_stop would |
2194 | always wake up processes blocked in | 2200 | always wake up processes blocked in |
2195 | tcp in recv_mesg then we could remove the | 2201 | tcp in recv_mesg then we could remove the |
2196 | send_sig call */ | 2202 | send_sig call */ |
2197 | force_sig(SIGKILL, srvTcp->tsk); | 2203 | force_sig(SIGKILL, srvTcp->tsk); |
2198 | tsk = srvTcp->tsk; | 2204 | kthread_stop(srvTcp->tsk); |
2199 | if (tsk) | ||
2200 | kthread_stop(tsk); | ||
2201 | } | 2205 | } |
2202 | } | 2206 | } |
2203 | /* If find_unc succeeded then rc == 0 so we can not end */ | 2207 | /* If find_unc succeeded then rc == 0 so we can not end */ |
@@ -2213,23 +2217,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2213 | if ((temp_rc == -ESHUTDOWN) && | 2217 | if ((temp_rc == -ESHUTDOWN) && |
2214 | (pSesInfo->server) && | 2218 | (pSesInfo->server) && |
2215 | (pSesInfo->server->tsk)) { | 2219 | (pSesInfo->server->tsk)) { |
2216 | struct task_struct *tsk; | ||
2217 | force_sig(SIGKILL, | 2220 | force_sig(SIGKILL, |
2218 | pSesInfo->server->tsk); | 2221 | pSesInfo->server->tsk); |
2219 | tsk = pSesInfo->server->tsk; | 2222 | kthread_stop(pSesInfo->server->tsk); |
2220 | if (tsk) | ||
2221 | kthread_stop(tsk); | ||
2222 | } | 2223 | } |
2223 | } else { | 2224 | } else { |
2224 | cFYI(1, ("No session or bad tcon")); | 2225 | cFYI(1, ("No session or bad tcon")); |
2225 | if ((pSesInfo->server) && | 2226 | if ((pSesInfo->server) && |
2226 | (pSesInfo->server->tsk)) { | 2227 | (pSesInfo->server->tsk)) { |
2227 | struct task_struct *tsk; | ||
2228 | force_sig(SIGKILL, | 2228 | force_sig(SIGKILL, |
2229 | pSesInfo->server->tsk); | 2229 | pSesInfo->server->tsk); |
2230 | tsk = pSesInfo->server->tsk; | 2230 | kthread_stop(pSesInfo->server->tsk); |
2231 | if (tsk) | ||
2232 | kthread_stop(tsk); | ||
2233 | } | 2231 | } |
2234 | } | 2232 | } |
2235 | sesInfoFree(pSesInfo); | 2233 | sesInfoFree(pSesInfo); |
@@ -2602,7 +2600,7 @@ sesssetup_nomem: /* do not return an error on nomem for the info strings, | |||
2602 | 2600 | ||
2603 | static int | 2601 | static int |
2604 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | 2602 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, |
2605 | struct cifsSesInfo *ses, int *pNTLMv2_flag, | 2603 | struct cifsSesInfo *ses, bool *pNTLMv2_flag, |
2606 | const struct nls_table *nls_codepage) | 2604 | const struct nls_table *nls_codepage) |
2607 | { | 2605 | { |
2608 | struct smb_hdr *smb_buffer; | 2606 | struct smb_hdr *smb_buffer; |
@@ -2625,7 +2623,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2625 | if (ses == NULL) | 2623 | if (ses == NULL) |
2626 | return -EINVAL; | 2624 | return -EINVAL; |
2627 | domain = ses->domainName; | 2625 | domain = ses->domainName; |
2628 | *pNTLMv2_flag = FALSE; | 2626 | *pNTLMv2_flag = false; |
2629 | smb_buffer = cifs_buf_get(); | 2627 | smb_buffer = cifs_buf_get(); |
2630 | if (smb_buffer == NULL) { | 2628 | if (smb_buffer == NULL) { |
2631 | return -ENOMEM; | 2629 | return -ENOMEM; |
@@ -2778,7 +2776,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2778 | CIFS_CRYPTO_KEY_SIZE); | 2776 | CIFS_CRYPTO_KEY_SIZE); |
2779 | if (SecurityBlob2->NegotiateFlags & | 2777 | if (SecurityBlob2->NegotiateFlags & |
2780 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) | 2778 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) |
2781 | *pNTLMv2_flag = TRUE; | 2779 | *pNTLMv2_flag = true; |
2782 | 2780 | ||
2783 | if ((SecurityBlob2->NegotiateFlags & | 2781 | if ((SecurityBlob2->NegotiateFlags & |
2784 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) | 2782 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) |
@@ -2939,7 +2937,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2939 | } | 2937 | } |
2940 | static int | 2938 | static int |
2941 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | 2939 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, |
2942 | char *ntlm_session_key, int ntlmv2_flag, | 2940 | char *ntlm_session_key, bool ntlmv2_flag, |
2943 | const struct nls_table *nls_codepage) | 2941 | const struct nls_table *nls_codepage) |
2944 | { | 2942 | { |
2945 | struct smb_hdr *smb_buffer; | 2943 | struct smb_hdr *smb_buffer; |
@@ -3556,8 +3554,6 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3556 | cifs_sb->prepath = NULL; | 3554 | cifs_sb->prepath = NULL; |
3557 | kfree(tmp); | 3555 | kfree(tmp); |
3558 | if (ses) | 3556 | if (ses) |
3559 | schedule_timeout_interruptible(msecs_to_jiffies(500)); | ||
3560 | if (ses) | ||
3561 | sesInfoFree(ses); | 3557 | sesInfoFree(ses); |
3562 | 3558 | ||
3563 | FreeXid(xid); | 3559 | FreeXid(xid); |
@@ -3569,7 +3565,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
3569 | { | 3565 | { |
3570 | int rc = 0; | 3566 | int rc = 0; |
3571 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; | 3567 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; |
3572 | int ntlmv2_flag = FALSE; | 3568 | bool ntlmv2_flag = false; |
3573 | int first_time = 0; | 3569 | int first_time = 0; |
3574 | 3570 | ||
3575 | /* what if server changes its buffer size after dropping the session? */ | 3571 | /* what if server changes its buffer size after dropping the session? */ |