aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-05-04 23:12:25 -0400
committerSteve French <smfrench@gmail.com>2013-05-04 23:17:23 -0400
commitf96637be081141d6f8813429499f164260b49d70 (patch)
treec91f5a9b5a2b7a67bbeda15d7c9805655547a098 /fs/cifs/connect.c
parentf7f7c1850eb98da758731ea7edfa830ebefe24cd (diff)
[CIFS] cifs: Rename cERROR and cFYI to cifs_dbg
It's not obvious from reading the macro names that these macros are for debugging. Convert the names to a single more typical kernel style cifs_dbg macro. cERROR(1, ...) -> cifs_dbg(VFS, ...) cFYI(1, ...) -> cifs_dbg(FYI, ...) cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...) Move the terminating format newline from the macro to the call site. Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the "CIFS VFS: " prefix for VFS messages. Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y) $ size fs/cifs/cifs.ko* text data bss dec hex filename 265245 2525 132 267902 4167e fs/cifs/cifs.ko.new 268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old Other miscellaneous changes around these conversions: o Miscellaneous typo fixes o Add terminating \n's to almost all formats and remove them from the macros to be more kernel style like. A few formats previously had defective \n's o Remove unnecessary OOM messages as kmalloc() calls dump_stack o Coalesce formats to make grep easier, added missing spaces when coalescing formats o Use %s, __func__ instead of embedded function name o Removed unnecessary "cifs: " prefixes o Convert kzalloc with multiply to kcalloc o Remove unused cifswarn macro Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c310
1 files changed, 149 insertions, 161 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 06394f5478a2..9535abe3d24c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -316,11 +316,12 @@ cifs_reconnect(struct TCP_Server_Info *server)
316 server->max_read = 0; 316 server->max_read = 0;
317#endif 317#endif
318 318
319 cFYI(1, "Reconnecting tcp session"); 319 cifs_dbg(FYI, "Reconnecting tcp session\n");
320 320
321 /* before reconnecting the tcp session, mark the smb session (uid) 321 /* before reconnecting the tcp session, mark the smb session (uid)
322 and the tid bad so they are not used until reconnected */ 322 and the tid bad so they are not used until reconnected */
323 cFYI(1, "%s: marking sessions and tcons for reconnect", __func__); 323 cifs_dbg(FYI, "%s: marking sessions and tcons for reconnect\n",
324 __func__);
324 spin_lock(&cifs_tcp_ses_lock); 325 spin_lock(&cifs_tcp_ses_lock);
325 list_for_each(tmp, &server->smb_ses_list) { 326 list_for_each(tmp, &server->smb_ses_list) {
326 ses = list_entry(tmp, struct cifs_ses, smb_ses_list); 327 ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
@@ -334,15 +335,14 @@ cifs_reconnect(struct TCP_Server_Info *server)
334 spin_unlock(&cifs_tcp_ses_lock); 335 spin_unlock(&cifs_tcp_ses_lock);
335 336
336 /* do not want to be sending data on a socket we are freeing */ 337 /* do not want to be sending data on a socket we are freeing */
337 cFYI(1, "%s: tearing down socket", __func__); 338 cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
338 mutex_lock(&server->srv_mutex); 339 mutex_lock(&server->srv_mutex);
339 if (server->ssocket) { 340 if (server->ssocket) {
340 cFYI(1, "State: 0x%x Flags: 0x%lx", server->ssocket->state, 341 cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
341 server->ssocket->flags); 342 server->ssocket->state, server->ssocket->flags);
342 kernel_sock_shutdown(server->ssocket, SHUT_WR); 343 kernel_sock_shutdown(server->ssocket, SHUT_WR);
343 cFYI(1, "Post shutdown state: 0x%x Flags: 0x%lx", 344 cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n",
344 server->ssocket->state, 345 server->ssocket->state, server->ssocket->flags);
345 server->ssocket->flags);
346 sock_release(server->ssocket); 346 sock_release(server->ssocket);
347 server->ssocket = NULL; 347 server->ssocket = NULL;
348 } 348 }
@@ -356,7 +356,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
356 356
357 /* mark submitted MIDs for retry and issue callback */ 357 /* mark submitted MIDs for retry and issue callback */
358 INIT_LIST_HEAD(&retry_list); 358 INIT_LIST_HEAD(&retry_list);
359 cFYI(1, "%s: moving mids to private list", __func__); 359 cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
360 spin_lock(&GlobalMid_Lock); 360 spin_lock(&GlobalMid_Lock);
361 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { 361 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
362 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 362 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
@@ -366,7 +366,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
366 } 366 }
367 spin_unlock(&GlobalMid_Lock); 367 spin_unlock(&GlobalMid_Lock);
368 368
369 cFYI(1, "%s: issuing mid callbacks", __func__); 369 cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
370 list_for_each_safe(tmp, tmp2, &retry_list) { 370 list_for_each_safe(tmp, tmp2, &retry_list) {
371 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 371 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
372 list_del_init(&mid_entry->qhead); 372 list_del_init(&mid_entry->qhead);
@@ -379,7 +379,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
379 /* we should try only the port we connected to before */ 379 /* we should try only the port we connected to before */
380 rc = generic_ip_connect(server); 380 rc = generic_ip_connect(server);
381 if (rc) { 381 if (rc) {
382 cFYI(1, "reconnect error %d", rc); 382 cifs_dbg(FYI, "reconnect error %d\n", rc);
383 msleep(3000); 383 msleep(3000);
384 } else { 384 } else {
385 atomic_inc(&tcpSesReconnectCount); 385 atomic_inc(&tcpSesReconnectCount);
@@ -413,8 +413,8 @@ cifs_echo_request(struct work_struct *work)
413 413
414 rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS; 414 rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS;
415 if (rc) 415 if (rc)
416 cFYI(1, "Unable to send echo request to server: %s", 416 cifs_dbg(FYI, "Unable to send echo request to server: %s\n",
417 server->hostname); 417 server->hostname);
418 418
419requeue_echo: 419requeue_echo:
420 queue_delayed_work(cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); 420 queue_delayed_work(cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL);
@@ -426,7 +426,7 @@ allocate_buffers(struct TCP_Server_Info *server)
426 if (!server->bigbuf) { 426 if (!server->bigbuf) {
427 server->bigbuf = (char *)cifs_buf_get(); 427 server->bigbuf = (char *)cifs_buf_get();
428 if (!server->bigbuf) { 428 if (!server->bigbuf) {
429 cERROR(1, "No memory for large SMB response"); 429 cifs_dbg(VFS, "No memory for large SMB response\n");
430 msleep(3000); 430 msleep(3000);
431 /* retry will check if exiting */ 431 /* retry will check if exiting */
432 return false; 432 return false;
@@ -439,7 +439,7 @@ allocate_buffers(struct TCP_Server_Info *server)
439 if (!server->smallbuf) { 439 if (!server->smallbuf) {
440 server->smallbuf = (char *)cifs_small_buf_get(); 440 server->smallbuf = (char *)cifs_small_buf_get();
441 if (!server->smallbuf) { 441 if (!server->smallbuf) {
442 cERROR(1, "No memory for SMB response"); 442 cifs_dbg(VFS, "No memory for SMB response\n");
443 msleep(1000); 443 msleep(1000);
444 /* retry will check if exiting */ 444 /* retry will check if exiting */
445 return false; 445 return false;
@@ -469,9 +469,8 @@ server_unresponsive(struct TCP_Server_Info *server)
469 */ 469 */
470 if (server->tcpStatus == CifsGood && 470 if (server->tcpStatus == CifsGood &&
471 time_after(jiffies, server->lstrp + 2 * SMB_ECHO_INTERVAL)) { 471 time_after(jiffies, server->lstrp + 2 * SMB_ECHO_INTERVAL)) {
472 cERROR(1, "Server %s has not responded in %d seconds. " 472 cifs_dbg(VFS, "Server %s has not responded in %d seconds. Reconnecting...\n",
473 "Reconnecting...", server->hostname, 473 server->hostname, (2 * SMB_ECHO_INTERVAL) / HZ);
474 (2 * SMB_ECHO_INTERVAL) / HZ);
475 cifs_reconnect(server); 474 cifs_reconnect(server);
476 wake_up(&server->response_q); 475 wake_up(&server->response_q);
477 return true; 476 return true;
@@ -582,8 +581,8 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig,
582 length = 0; 581 length = 0;
583 continue; 582 continue;
584 } else if (length <= 0) { 583 } else if (length <= 0) {
585 cFYI(1, "Received no data or error: expecting %d " 584 cifs_dbg(FYI, "Received no data or error: expecting %d\n"
586 "got %d", to_read, length); 585 "got %d", to_read, length);
587 cifs_reconnect(server); 586 cifs_reconnect(server);
588 total_read = -EAGAIN; 587 total_read = -EAGAIN;
589 break; 588 break;
@@ -617,17 +616,17 @@ is_smb_response(struct TCP_Server_Info *server, unsigned char type)
617 /* Regular SMB response */ 616 /* Regular SMB response */
618 return true; 617 return true;
619 case RFC1002_SESSION_KEEP_ALIVE: 618 case RFC1002_SESSION_KEEP_ALIVE:
620 cFYI(1, "RFC 1002 session keep alive"); 619 cifs_dbg(FYI, "RFC 1002 session keep alive\n");
621 break; 620 break;
622 case RFC1002_POSITIVE_SESSION_RESPONSE: 621 case RFC1002_POSITIVE_SESSION_RESPONSE:
623 cFYI(1, "RFC 1002 positive session response"); 622 cifs_dbg(FYI, "RFC 1002 positive session response\n");
624 break; 623 break;
625 case RFC1002_NEGATIVE_SESSION_RESPONSE: 624 case RFC1002_NEGATIVE_SESSION_RESPONSE:
626 /* 625 /*
627 * We get this from Windows 98 instead of an error on 626 * We get this from Windows 98 instead of an error on
628 * SMB negprot response. 627 * SMB negprot response.
629 */ 628 */
630 cFYI(1, "RFC 1002 negative session response"); 629 cifs_dbg(FYI, "RFC 1002 negative session response\n");
631 /* give server a second to clean up */ 630 /* give server a second to clean up */
632 msleep(1000); 631 msleep(1000);
633 /* 632 /*
@@ -641,7 +640,7 @@ is_smb_response(struct TCP_Server_Info *server, unsigned char type)
641 wake_up(&server->response_q); 640 wake_up(&server->response_q);
642 break; 641 break;
643 default: 642 default:
644 cERROR(1, "RFC 1002 unknown response type 0x%x", type); 643 cifs_dbg(VFS, "RFC 1002 unknown response type 0x%x\n", type);
645 cifs_reconnect(server); 644 cifs_reconnect(server);
646 } 645 }
647 646
@@ -727,7 +726,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
727 spin_lock(&GlobalMid_Lock); 726 spin_lock(&GlobalMid_Lock);
728 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { 727 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
729 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 728 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
730 cFYI(1, "Clearing mid 0x%llx", mid_entry->mid); 729 cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid);
731 mid_entry->mid_state = MID_SHUTDOWN; 730 mid_entry->mid_state = MID_SHUTDOWN;
732 list_move(&mid_entry->qhead, &dispose_list); 731 list_move(&mid_entry->qhead, &dispose_list);
733 } 732 }
@@ -736,7 +735,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
736 /* now walk dispose list and issue callbacks */ 735 /* now walk dispose list and issue callbacks */
737 list_for_each_safe(tmp, tmp2, &dispose_list) { 736 list_for_each_safe(tmp, tmp2, &dispose_list) {
738 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 737 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
739 cFYI(1, "Callback mid 0x%llx", mid_entry->mid); 738 cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid);
740 list_del_init(&mid_entry->qhead); 739 list_del_init(&mid_entry->qhead);
741 mid_entry->callback(mid_entry); 740 mid_entry->callback(mid_entry);
742 } 741 }
@@ -753,7 +752,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
753 * least 45 seconds before giving up on a request getting a 752 * least 45 seconds before giving up on a request getting a
754 * response and going ahead and killing cifsd. 753 * response and going ahead and killing cifsd.
755 */ 754 */
756 cFYI(1, "Wait for exit from demultiplex thread"); 755 cifs_dbg(FYI, "Wait for exit from demultiplex thread\n");
757 msleep(46000); 756 msleep(46000);
758 /* 757 /*
759 * If threads still have not exited they are probably never 758 * If threads still have not exited they are probably never
@@ -780,8 +779,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
780 779
781 /* make sure this will fit in a large buffer */ 780 /* make sure this will fit in a large buffer */
782 if (pdu_length > CIFSMaxBufSize + MAX_HEADER_SIZE(server) - 4) { 781 if (pdu_length > CIFSMaxBufSize + MAX_HEADER_SIZE(server) - 4) {
783 cERROR(1, "SMB response too long (%u bytes)", 782 cifs_dbg(VFS, "SMB response too long (%u bytes)\n", pdu_length);
784 pdu_length);
785 cifs_reconnect(server); 783 cifs_reconnect(server);
786 wake_up(&server->response_q); 784 wake_up(&server->response_q);
787 return -EAGAIN; 785 return -EAGAIN;
@@ -839,7 +837,7 @@ cifs_demultiplex_thread(void *p)
839 struct mid_q_entry *mid_entry; 837 struct mid_q_entry *mid_entry;
840 838
841 current->flags |= PF_MEMALLOC; 839 current->flags |= PF_MEMALLOC;
842 cFYI(1, "Demultiplex PID: %d", task_pid_nr(current)); 840 cifs_dbg(FYI, "Demultiplex PID: %d\n", task_pid_nr(current));
843 841
844 length = atomic_inc_return(&tcpSesAllocCount); 842 length = atomic_inc_return(&tcpSesAllocCount);
845 if (length > 1) 843 if (length > 1)
@@ -869,14 +867,14 @@ cifs_demultiplex_thread(void *p)
869 */ 867 */
870 pdu_length = get_rfc1002_length(buf); 868 pdu_length = get_rfc1002_length(buf);
871 869
872 cFYI(1, "RFC1002 header 0x%x", pdu_length); 870 cifs_dbg(FYI, "RFC1002 header 0x%x\n", pdu_length);
873 if (!is_smb_response(server, buf[0])) 871 if (!is_smb_response(server, buf[0]))
874 continue; 872 continue;
875 873
876 /* make sure we have enough to get to the MID */ 874 /* make sure we have enough to get to the MID */
877 if (pdu_length < HEADER_SIZE(server) - 1 - 4) { 875 if (pdu_length < HEADER_SIZE(server) - 1 - 4) {
878 cERROR(1, "SMB response too short (%u bytes)", 876 cifs_dbg(VFS, "SMB response too short (%u bytes)\n",
879 pdu_length); 877 pdu_length);
880 cifs_reconnect(server); 878 cifs_reconnect(server);
881 wake_up(&server->response_q); 879 wake_up(&server->response_q);
882 continue; 880 continue;
@@ -908,8 +906,8 @@ cifs_demultiplex_thread(void *p)
908 mid_entry->callback(mid_entry); 906 mid_entry->callback(mid_entry);
909 } else if (!server->ops->is_oplock_break || 907 } else if (!server->ops->is_oplock_break ||
910 !server->ops->is_oplock_break(buf, server)) { 908 !server->ops->is_oplock_break(buf, server)) {
911 cERROR(1, "No task to wake, unknown frame received! " 909 cifs_dbg(VFS, "No task to wake, unknown frame received! NumMids %d\n",
912 "NumMids %d", atomic_read(&midCount)); 910 atomic_read(&midCount));
913 cifs_dump_mem("Received Data is: ", buf, 911 cifs_dump_mem("Received Data is: ", buf,
914 HEADER_SIZE(server)); 912 HEADER_SIZE(server));
915#ifdef CONFIG_CIFS_DEBUG2 913#ifdef CONFIG_CIFS_DEBUG2
@@ -1035,7 +1033,7 @@ static int cifs_parse_security_flavors(char *value,
1035 break; 1033 break;
1036 case Opt_sec_krb5p: 1034 case Opt_sec_krb5p:
1037 /* vol->secFlg |= CIFSSEC_MUST_SEAL | CIFSSEC_MAY_KRB5; */ 1035 /* vol->secFlg |= CIFSSEC_MUST_SEAL | CIFSSEC_MAY_KRB5; */
1038 cERROR(1, "Krb5 cifs privacy not supported"); 1036 cifs_dbg(VFS, "Krb5 cifs privacy not supported\n");
1039 break; 1037 break;
1040 case Opt_sec_ntlmssp: 1038 case Opt_sec_ntlmssp:
1041 vol->secFlg |= CIFSSEC_MAY_NTLMSSP; 1039 vol->secFlg |= CIFSSEC_MAY_NTLMSSP;
@@ -1065,7 +1063,7 @@ static int cifs_parse_security_flavors(char *value,
1065 vol->nullauth = 1; 1063 vol->nullauth = 1;
1066 break; 1064 break;
1067 default: 1065 default:
1068 cERROR(1, "bad security option: %s", value); 1066 cifs_dbg(VFS, "bad security option: %s\n", value);
1069 return 1; 1067 return 1;
1070 } 1068 }
1071 1069
@@ -1091,7 +1089,7 @@ cifs_parse_cache_flavor(char *value, struct smb_vol *vol)
1091 vol->strict_io = false; 1089 vol->strict_io = false;
1092 break; 1090 break;
1093 default: 1091 default:
1094 cERROR(1, "bad cache= option: %s", value); 1092 cifs_dbg(VFS, "bad cache= option: %s\n", value);
1095 return 1; 1093 return 1;
1096 } 1094 }
1097 return 0; 1095 return 0;
@@ -1122,7 +1120,7 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol)
1122 break; 1120 break;
1123#endif 1121#endif
1124 default: 1122 default:
1125 cERROR(1, "Unknown vers= option specified: %s", value); 1123 cifs_dbg(VFS, "Unknown vers= option specified: %s\n", value);
1126 return 1; 1124 return 1;
1127 } 1125 }
1128 return 0; 1126 return 0;
@@ -1253,7 +1251,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1253 separator[0] = options[4]; 1251 separator[0] = options[4];
1254 options += 5; 1252 options += 5;
1255 } else { 1253 } else {
1256 cFYI(1, "Null separator not allowed"); 1254 cifs_dbg(FYI, "Null separator not allowed\n");
1257 } 1255 }
1258 } 1256 }
1259 vol->backupuid_specified = false; /* no backup intent for a user */ 1257 vol->backupuid_specified = false; /* no backup intent for a user */
@@ -1438,8 +1436,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1438 break; 1436 break;
1439 case Opt_fsc: 1437 case Opt_fsc:
1440#ifndef CONFIG_CIFS_FSCACHE 1438#ifndef CONFIG_CIFS_FSCACHE
1441 cERROR(1, "FS-Cache support needs CONFIG_CIFS_FSCACHE " 1439 cifs_dbg(VFS, "FS-Cache support needs CONFIG_CIFS_FSCACHE kernel config option set\n");
1442 "kernel config option set");
1443 goto cifs_parse_mount_err; 1440 goto cifs_parse_mount_err;
1444#endif 1441#endif
1445 vol->fsc = true; 1442 vol->fsc = true;
@@ -1457,55 +1454,55 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1457 /* Numeric Values */ 1454 /* Numeric Values */
1458 case Opt_backupuid: 1455 case Opt_backupuid:
1459 if (get_option_uid(args, &vol->backupuid)) { 1456 if (get_option_uid(args, &vol->backupuid)) {
1460 cERROR(1, "%s: Invalid backupuid value", 1457 cifs_dbg(VFS, "%s: Invalid backupuid value\n",
1461 __func__); 1458 __func__);
1462 goto cifs_parse_mount_err; 1459 goto cifs_parse_mount_err;
1463 } 1460 }
1464 vol->backupuid_specified = true; 1461 vol->backupuid_specified = true;
1465 break; 1462 break;
1466 case Opt_backupgid: 1463 case Opt_backupgid:
1467 if (get_option_gid(args, &vol->backupgid)) { 1464 if (get_option_gid(args, &vol->backupgid)) {
1468 cERROR(1, "%s: Invalid backupgid value", 1465 cifs_dbg(VFS, "%s: Invalid backupgid value\n",
1469 __func__); 1466 __func__);
1470 goto cifs_parse_mount_err; 1467 goto cifs_parse_mount_err;
1471 } 1468 }
1472 vol->backupgid_specified = true; 1469 vol->backupgid_specified = true;
1473 break; 1470 break;
1474 case Opt_uid: 1471 case Opt_uid:
1475 if (get_option_uid(args, &vol->linux_uid)) { 1472 if (get_option_uid(args, &vol->linux_uid)) {
1476 cERROR(1, "%s: Invalid uid value", 1473 cifs_dbg(VFS, "%s: Invalid uid value\n",
1477 __func__); 1474 __func__);
1478 goto cifs_parse_mount_err; 1475 goto cifs_parse_mount_err;
1479 } 1476 }
1480 uid_specified = true; 1477 uid_specified = true;
1481 break; 1478 break;
1482 case Opt_cruid: 1479 case Opt_cruid:
1483 if (get_option_uid(args, &vol->cred_uid)) { 1480 if (get_option_uid(args, &vol->cred_uid)) {
1484 cERROR(1, "%s: Invalid cruid value", 1481 cifs_dbg(VFS, "%s: Invalid cruid value\n",
1485 __func__); 1482 __func__);
1486 goto cifs_parse_mount_err; 1483 goto cifs_parse_mount_err;
1487 } 1484 }
1488 break; 1485 break;
1489 case Opt_gid: 1486 case Opt_gid:
1490 if (get_option_gid(args, &vol->linux_gid)) { 1487 if (get_option_gid(args, &vol->linux_gid)) {
1491 cERROR(1, "%s: Invalid gid value", 1488 cifs_dbg(VFS, "%s: Invalid gid value\n",
1492 __func__); 1489 __func__);
1493 goto cifs_parse_mount_err; 1490 goto cifs_parse_mount_err;
1494 } 1491 }
1495 gid_specified = true; 1492 gid_specified = true;
1496 break; 1493 break;
1497 case Opt_file_mode: 1494 case Opt_file_mode:
1498 if (get_option_ul(args, &option)) { 1495 if (get_option_ul(args, &option)) {
1499 cERROR(1, "%s: Invalid file_mode value", 1496 cifs_dbg(VFS, "%s: Invalid file_mode value\n",
1500 __func__); 1497 __func__);
1501 goto cifs_parse_mount_err; 1498 goto cifs_parse_mount_err;
1502 } 1499 }
1503 vol->file_mode = option; 1500 vol->file_mode = option;
1504 break; 1501 break;
1505 case Opt_dirmode: 1502 case Opt_dirmode:
1506 if (get_option_ul(args, &option)) { 1503 if (get_option_ul(args, &option)) {
1507 cERROR(1, "%s: Invalid dir_mode value", 1504 cifs_dbg(VFS, "%s: Invalid dir_mode value\n",
1508 __func__); 1505 __func__);
1509 goto cifs_parse_mount_err; 1506 goto cifs_parse_mount_err;
1510 } 1507 }
1511 vol->dir_mode = option; 1508 vol->dir_mode = option;
@@ -1513,37 +1510,37 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1513 case Opt_port: 1510 case Opt_port:
1514 if (get_option_ul(args, &option) || 1511 if (get_option_ul(args, &option) ||
1515 option > USHRT_MAX) { 1512 option > USHRT_MAX) {
1516 cERROR(1, "%s: Invalid port value", __func__); 1513 cifs_dbg(VFS, "%s: Invalid port value\n",
1514 __func__);
1517 goto cifs_parse_mount_err; 1515 goto cifs_parse_mount_err;
1518 } 1516 }
1519 port = (unsigned short)option; 1517 port = (unsigned short)option;
1520 break; 1518 break;
1521 case Opt_rsize: 1519 case Opt_rsize:
1522 if (get_option_ul(args, &option)) { 1520 if (get_option_ul(args, &option)) {
1523 cERROR(1, "%s: Invalid rsize value", 1521 cifs_dbg(VFS, "%s: Invalid rsize value\n",
1524 __func__); 1522 __func__);
1525 goto cifs_parse_mount_err; 1523 goto cifs_parse_mount_err;
1526 } 1524 }
1527 vol->rsize = option; 1525 vol->rsize = option;
1528 break; 1526 break;
1529 case Opt_wsize: 1527 case Opt_wsize:
1530 if (get_option_ul(args, &option)) { 1528 if (get_option_ul(args, &option)) {
1531 cERROR(1, "%s: Invalid wsize value", 1529 cifs_dbg(VFS, "%s: Invalid wsize value\n",
1532 __func__); 1530 __func__);
1533 goto cifs_parse_mount_err; 1531 goto cifs_parse_mount_err;
1534 } 1532 }
1535 vol->wsize = option; 1533 vol->wsize = option;
1536 break; 1534 break;
1537 case Opt_actimeo: 1535 case Opt_actimeo:
1538 if (get_option_ul(args, &option)) { 1536 if (get_option_ul(args, &option)) {
1539 cERROR(1, "%s: Invalid actimeo value", 1537 cifs_dbg(VFS, "%s: Invalid actimeo value\n",
1540 __func__); 1538 __func__);
1541 goto cifs_parse_mount_err; 1539 goto cifs_parse_mount_err;
1542 } 1540 }
1543 vol->actimeo = HZ * option; 1541 vol->actimeo = HZ * option;
1544 if (vol->actimeo > CIFS_MAX_ACTIMEO) { 1542 if (vol->actimeo > CIFS_MAX_ACTIMEO) {
1545 cERROR(1, "CIFS: attribute cache" 1543 cifs_dbg(VFS, "attribute cache timeout too large\n");
1546 "timeout too large");
1547 goto cifs_parse_mount_err; 1544 goto cifs_parse_mount_err;
1548 } 1545 }
1549 break; 1546 break;
@@ -1566,11 +1563,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1566 goto cifs_parse_mount_err; 1563 goto cifs_parse_mount_err;
1567 } 1564 }
1568 vol->username = kstrdup(string, GFP_KERNEL); 1565 vol->username = kstrdup(string, GFP_KERNEL);
1569 if (!vol->username) { 1566 if (!vol->username)
1570 printk(KERN_WARNING "CIFS: no memory "
1571 "for username\n");
1572 goto cifs_parse_mount_err; 1567 goto cifs_parse_mount_err;
1573 }
1574 break; 1568 break;
1575 case Opt_blank_pass: 1569 case Opt_blank_pass:
1576 /* passwords have to be handled differently 1570 /* passwords have to be handled differently
@@ -1675,7 +1669,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1675 "for domainname\n"); 1669 "for domainname\n");
1676 goto cifs_parse_mount_err; 1670 goto cifs_parse_mount_err;
1677 } 1671 }
1678 cFYI(1, "Domain name set"); 1672 cifs_dbg(FYI, "Domain name set\n");
1679 break; 1673 break;
1680 case Opt_srcaddr: 1674 case Opt_srcaddr:
1681 string = match_strdup(args); 1675 string = match_strdup(args);
@@ -1713,7 +1707,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1713 /* if iocharset not set then load_nls_default 1707 /* if iocharset not set then load_nls_default
1714 * is used by caller 1708 * is used by caller
1715 */ 1709 */
1716 cFYI(1, "iocharset set to %s", string); 1710 cifs_dbg(FYI, "iocharset set to %s\n", string);
1717 break; 1711 break;
1718 case Opt_netbiosname: 1712 case Opt_netbiosname:
1719 string = match_strdup(args); 1713 string = match_strdup(args);
@@ -1827,20 +1821,18 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1827#ifndef CONFIG_KEYS 1821#ifndef CONFIG_KEYS
1828 /* Muliuser mounts require CONFIG_KEYS support */ 1822 /* Muliuser mounts require CONFIG_KEYS support */
1829 if (vol->multiuser) { 1823 if (vol->multiuser) {
1830 cERROR(1, "Multiuser mounts require kernels with " 1824 cifs_dbg(VFS, "Multiuser mounts require kernels with CONFIG_KEYS enabled\n");
1831 "CONFIG_KEYS enabled.");
1832 goto cifs_parse_mount_err; 1825 goto cifs_parse_mount_err;
1833 } 1826 }
1834#endif 1827#endif
1835 if (!vol->UNC) { 1828 if (!vol->UNC) {
1836 cERROR(1, "CIFS mount error: No usable UNC path provided in " 1829 cifs_dbg(VFS, "CIFS mount error: No usable UNC path provided in device string or in unc= option!\n");
1837 "device string or in unc= option!");
1838 goto cifs_parse_mount_err; 1830 goto cifs_parse_mount_err;
1839 } 1831 }
1840 1832
1841 /* make sure UNC has a share name */ 1833 /* make sure UNC has a share name */
1842 if (!strchr(vol->UNC + 3, '\\')) { 1834 if (!strchr(vol->UNC + 3, '\\')) {
1843 cERROR(1, "Malformed UNC. Unable to find share name."); 1835 cifs_dbg(VFS, "Malformed UNC. Unable to find share name.\n");
1844 goto cifs_parse_mount_err; 1836 goto cifs_parse_mount_err;
1845 } 1837 }
1846 1838
@@ -2061,7 +2053,7 @@ cifs_find_tcp_session(struct smb_vol *vol)
2061 2053
2062 ++server->srv_count; 2054 ++server->srv_count;
2063 spin_unlock(&cifs_tcp_ses_lock); 2055 spin_unlock(&cifs_tcp_ses_lock);
2064 cFYI(1, "Existing tcp session with server found"); 2056 cifs_dbg(FYI, "Existing tcp session with server found\n");
2065 return server; 2057 return server;
2066 } 2058 }
2067 spin_unlock(&cifs_tcp_ses_lock); 2059 spin_unlock(&cifs_tcp_ses_lock);
@@ -2108,7 +2100,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2108 struct TCP_Server_Info *tcp_ses = NULL; 2100 struct TCP_Server_Info *tcp_ses = NULL;
2109 int rc; 2101 int rc;
2110 2102
2111 cFYI(1, "UNC: %s", volume_info->UNC); 2103 cifs_dbg(FYI, "UNC: %s\n", volume_info->UNC);
2112 2104
2113 /* see if we already have a matching tcp_ses */ 2105 /* see if we already have a matching tcp_ses */
2114 tcp_ses = cifs_find_tcp_session(volume_info); 2106 tcp_ses = cifs_find_tcp_session(volume_info);
@@ -2123,7 +2115,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2123 2115
2124 rc = cifs_crypto_shash_allocate(tcp_ses); 2116 rc = cifs_crypto_shash_allocate(tcp_ses);
2125 if (rc) { 2117 if (rc) {
2126 cERROR(1, "could not setup hash structures rc %d", rc); 2118 cifs_dbg(VFS, "could not setup hash structures rc %d\n", rc);
2127 goto out_err; 2119 goto out_err;
2128 } 2120 }
2129 2121
@@ -2170,7 +2162,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2170 2162
2171 rc = ip_connect(tcp_ses); 2163 rc = ip_connect(tcp_ses);
2172 if (rc < 0) { 2164 if (rc < 0) {
2173 cERROR(1, "Error connecting to socket. Aborting operation"); 2165 cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n");
2174 goto out_err_crypto_release; 2166 goto out_err_crypto_release;
2175 } 2167 }
2176 2168
@@ -2183,7 +2175,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2183 tcp_ses, "cifsd"); 2175 tcp_ses, "cifsd");
2184 if (IS_ERR(tcp_ses->tsk)) { 2176 if (IS_ERR(tcp_ses->tsk)) {
2185 rc = PTR_ERR(tcp_ses->tsk); 2177 rc = PTR_ERR(tcp_ses->tsk);
2186 cERROR(1, "error %d create cifsd thread", rc); 2178 cifs_dbg(VFS, "error %d create cifsd thread\n", rc);
2187 module_put(THIS_MODULE); 2179 module_put(THIS_MODULE);
2188 goto out_err_crypto_release; 2180 goto out_err_crypto_release;
2189 } 2181 }
@@ -2270,7 +2262,7 @@ cifs_put_smb_ses(struct cifs_ses *ses)
2270 unsigned int xid; 2262 unsigned int xid;
2271 struct TCP_Server_Info *server = ses->server; 2263 struct TCP_Server_Info *server = ses->server;
2272 2264
2273 cFYI(1, "%s: ses_count=%d", __func__, ses->ses_count); 2265 cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count);
2274 spin_lock(&cifs_tcp_ses_lock); 2266 spin_lock(&cifs_tcp_ses_lock);
2275 if (--ses->ses_count > 0) { 2267 if (--ses->ses_count > 0) {
2276 spin_unlock(&cifs_tcp_ses_lock); 2268 spin_unlock(&cifs_tcp_ses_lock);
@@ -2322,23 +2314,24 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2322 sprintf(desc, "cifs:a:%pI6c", &sa6->sin6_addr.s6_addr); 2314 sprintf(desc, "cifs:a:%pI6c", &sa6->sin6_addr.s6_addr);
2323 break; 2315 break;
2324 default: 2316 default:
2325 cFYI(1, "Bad ss_family (%hu)", server->dstaddr.ss_family); 2317 cifs_dbg(FYI, "Bad ss_family (%hu)\n",
2318 server->dstaddr.ss_family);
2326 rc = -EINVAL; 2319 rc = -EINVAL;
2327 goto out_err; 2320 goto out_err;
2328 } 2321 }
2329 2322
2330 cFYI(1, "%s: desc=%s", __func__, desc); 2323 cifs_dbg(FYI, "%s: desc=%s\n", __func__, desc);
2331 key = request_key(&key_type_logon, desc, ""); 2324 key = request_key(&key_type_logon, desc, "");
2332 if (IS_ERR(key)) { 2325 if (IS_ERR(key)) {
2333 if (!ses->domainName) { 2326 if (!ses->domainName) {
2334 cFYI(1, "domainName is NULL"); 2327 cifs_dbg(FYI, "domainName is NULL\n");
2335 rc = PTR_ERR(key); 2328 rc = PTR_ERR(key);
2336 goto out_err; 2329 goto out_err;
2337 } 2330 }
2338 2331
2339 /* didn't work, try to find a domain key */ 2332 /* didn't work, try to find a domain key */
2340 sprintf(desc, "cifs:d:%s", ses->domainName); 2333 sprintf(desc, "cifs:d:%s", ses->domainName);
2341 cFYI(1, "%s: desc=%s", __func__, desc); 2334 cifs_dbg(FYI, "%s: desc=%s\n", __func__, desc);
2342 key = request_key(&key_type_logon, desc, ""); 2335 key = request_key(&key_type_logon, desc, "");
2343 if (IS_ERR(key)) { 2336 if (IS_ERR(key)) {
2344 rc = PTR_ERR(key); 2337 rc = PTR_ERR(key);
@@ -2356,32 +2349,34 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2356 /* find first : in payload */ 2349 /* find first : in payload */
2357 payload = (char *)upayload->data; 2350 payload = (char *)upayload->data;
2358 delim = strnchr(payload, upayload->datalen, ':'); 2351 delim = strnchr(payload, upayload->datalen, ':');
2359 cFYI(1, "payload=%s", payload); 2352 cifs_dbg(FYI, "payload=%s\n", payload);
2360 if (!delim) { 2353 if (!delim) {
2361 cFYI(1, "Unable to find ':' in payload (datalen=%d)", 2354 cifs_dbg(FYI, "Unable to find ':' in payload (datalen=%d)\n",
2362 upayload->datalen); 2355 upayload->datalen);
2363 rc = -EINVAL; 2356 rc = -EINVAL;
2364 goto out_key_put; 2357 goto out_key_put;
2365 } 2358 }
2366 2359
2367 len = delim - payload; 2360 len = delim - payload;
2368 if (len > MAX_USERNAME_SIZE || len <= 0) { 2361 if (len > MAX_USERNAME_SIZE || len <= 0) {
2369 cFYI(1, "Bad value from username search (len=%zd)", len); 2362 cifs_dbg(FYI, "Bad value from username search (len=%zd)\n",
2363 len);
2370 rc = -EINVAL; 2364 rc = -EINVAL;
2371 goto out_key_put; 2365 goto out_key_put;
2372 } 2366 }
2373 2367
2374 vol->username = kstrndup(payload, len, GFP_KERNEL); 2368 vol->username = kstrndup(payload, len, GFP_KERNEL);
2375 if (!vol->username) { 2369 if (!vol->username) {
2376 cFYI(1, "Unable to allocate %zd bytes for username", len); 2370 cifs_dbg(FYI, "Unable to allocate %zd bytes for username\n",
2371 len);
2377 rc = -ENOMEM; 2372 rc = -ENOMEM;
2378 goto out_key_put; 2373 goto out_key_put;
2379 } 2374 }
2380 cFYI(1, "%s: username=%s", __func__, vol->username); 2375 cifs_dbg(FYI, "%s: username=%s\n", __func__, vol->username);
2381 2376
2382 len = key->datalen - (len + 1); 2377 len = key->datalen - (len + 1);
2383 if (len > MAX_PASSWORD_SIZE || len <= 0) { 2378 if (len > MAX_PASSWORD_SIZE || len <= 0) {
2384 cFYI(1, "Bad len for password search (len=%zd)", len); 2379 cifs_dbg(FYI, "Bad len for password search (len=%zd)\n", len);
2385 rc = -EINVAL; 2380 rc = -EINVAL;
2386 kfree(vol->username); 2381 kfree(vol->username);
2387 vol->username = NULL; 2382 vol->username = NULL;
@@ -2391,7 +2386,8 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2391 ++delim; 2386 ++delim;
2392 vol->password = kstrndup(delim, len, GFP_KERNEL); 2387 vol->password = kstrndup(delim, len, GFP_KERNEL);
2393 if (!vol->password) { 2388 if (!vol->password) {
2394 cFYI(1, "Unable to allocate %zd bytes for password", len); 2389 cifs_dbg(FYI, "Unable to allocate %zd bytes for password\n",
2390 len);
2395 rc = -ENOMEM; 2391 rc = -ENOMEM;
2396 kfree(vol->username); 2392 kfree(vol->username);
2397 vol->username = NULL; 2393 vol->username = NULL;
@@ -2403,7 +2399,7 @@ out_key_put:
2403 key_put(key); 2399 key_put(key);
2404out_err: 2400out_err:
2405 kfree(desc); 2401 kfree(desc);
2406 cFYI(1, "%s: returning %d", __func__, rc); 2402 cifs_dbg(FYI, "%s: returning %d\n", __func__, rc);
2407 return rc; 2403 return rc;
2408} 2404}
2409#else /* ! CONFIG_KEYS */ 2405#else /* ! CONFIG_KEYS */
@@ -2428,7 +2424,8 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
2428 2424
2429 ses = cifs_find_smb_ses(server, volume_info); 2425 ses = cifs_find_smb_ses(server, volume_info);
2430 if (ses) { 2426 if (ses) {
2431 cFYI(1, "Existing smb sess found (status=%d)", ses->status); 2427 cifs_dbg(FYI, "Existing smb sess found (status=%d)\n",
2428 ses->status);
2432 2429
2433 mutex_lock(&ses->session_mutex); 2430 mutex_lock(&ses->session_mutex);
2434 rc = cifs_negotiate_protocol(xid, ses); 2431 rc = cifs_negotiate_protocol(xid, ses);
@@ -2440,7 +2437,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
2440 return ERR_PTR(rc); 2437 return ERR_PTR(rc);
2441 } 2438 }
2442 if (ses->need_reconnect) { 2439 if (ses->need_reconnect) {
2443 cFYI(1, "Session needs reconnect"); 2440 cifs_dbg(FYI, "Session needs reconnect\n");
2444 rc = cifs_setup_session(xid, ses, 2441 rc = cifs_setup_session(xid, ses,
2445 volume_info->local_nls); 2442 volume_info->local_nls);
2446 if (rc) { 2443 if (rc) {
@@ -2459,7 +2456,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
2459 return ses; 2456 return ses;
2460 } 2457 }
2461 2458
2462 cFYI(1, "Existing smb sess not found"); 2459 cifs_dbg(FYI, "Existing smb sess not found\n");
2463 ses = sesInfoAlloc(); 2460 ses = sesInfoAlloc();
2464 if (ses == NULL) 2461 if (ses == NULL)
2465 goto get_ses_fail; 2462 goto get_ses_fail;
@@ -2549,7 +2546,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
2549 unsigned int xid; 2546 unsigned int xid;
2550 struct cifs_ses *ses = tcon->ses; 2547 struct cifs_ses *ses = tcon->ses;
2551 2548
2552 cFYI(1, "%s: tc_count=%d", __func__, tcon->tc_count); 2549 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
2553 spin_lock(&cifs_tcp_ses_lock); 2550 spin_lock(&cifs_tcp_ses_lock);
2554 if (--tcon->tc_count > 0) { 2551 if (--tcon->tc_count > 0) {
2555 spin_unlock(&cifs_tcp_ses_lock); 2552 spin_unlock(&cifs_tcp_ses_lock);
@@ -2577,12 +2574,11 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
2577 2574
2578 tcon = cifs_find_tcon(ses, volume_info->UNC); 2575 tcon = cifs_find_tcon(ses, volume_info->UNC);
2579 if (tcon) { 2576 if (tcon) {
2580 cFYI(1, "Found match on UNC path"); 2577 cifs_dbg(FYI, "Found match on UNC path\n");
2581 /* existing tcon already has a reference */ 2578 /* existing tcon already has a reference */
2582 cifs_put_smb_ses(ses); 2579 cifs_put_smb_ses(ses);
2583 if (tcon->seal != volume_info->seal) 2580 if (tcon->seal != volume_info->seal)
2584 cERROR(1, "transport encryption setting " 2581 cifs_dbg(VFS, "transport encryption setting conflicts with existing tid\n");
2585 "conflicts with existing tid");
2586 return tcon; 2582 return tcon;
2587 } 2583 }
2588 2584
@@ -2614,13 +2610,13 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
2614 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, 2610 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon,
2615 volume_info->local_nls); 2611 volume_info->local_nls);
2616 free_xid(xid); 2612 free_xid(xid);
2617 cFYI(1, "Tcon rc = %d", rc); 2613 cifs_dbg(FYI, "Tcon rc = %d\n", rc);
2618 if (rc) 2614 if (rc)
2619 goto out_fail; 2615 goto out_fail;
2620 2616
2621 if (volume_info->nodfs) { 2617 if (volume_info->nodfs) {
2622 tcon->Flags &= ~SMB_SHARE_IS_IN_DFS; 2618 tcon->Flags &= ~SMB_SHARE_IS_IN_DFS;
2623 cFYI(1, "DFS disabled (%d)", tcon->Flags); 2619 cifs_dbg(FYI, "DFS disabled (%d)\n", tcon->Flags);
2624 } 2620 }
2625 tcon->seal = volume_info->seal; 2621 tcon->seal = volume_info->seal;
2626 /* 2622 /*
@@ -2774,7 +2770,7 @@ get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path,
2774 strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$"); 2770 strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$");
2775 rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL, 2771 rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL,
2776 nls_codepage); 2772 nls_codepage);
2777 cFYI(1, "Tcon rc = %d ipc_tid = %d", rc, ses->ipc_tid); 2773 cifs_dbg(FYI, "Tcon rc = %d ipc_tid = %d\n", rc, ses->ipc_tid);
2778 kfree(temp_unc); 2774 kfree(temp_unc);
2779 } 2775 }
2780 if (rc == 0) 2776 if (rc == 0)
@@ -2852,13 +2848,11 @@ bind_socket(struct TCP_Server_Info *server)
2852 saddr4 = (struct sockaddr_in *)&server->srcaddr; 2848 saddr4 = (struct sockaddr_in *)&server->srcaddr;
2853 saddr6 = (struct sockaddr_in6 *)&server->srcaddr; 2849 saddr6 = (struct sockaddr_in6 *)&server->srcaddr;
2854 if (saddr6->sin6_family == AF_INET6) 2850 if (saddr6->sin6_family == AF_INET6)
2855 cERROR(1, "cifs: " 2851 cifs_dbg(VFS, "Failed to bind to: %pI6c, error: %d\n",
2856 "Failed to bind to: %pI6c, error: %d", 2852 &saddr6->sin6_addr, rc);
2857 &saddr6->sin6_addr, rc);
2858 else 2853 else
2859 cERROR(1, "cifs: " 2854 cifs_dbg(VFS, "Failed to bind to: %pI4, error: %d\n",
2860 "Failed to bind to: %pI4, error: %d", 2855 &saddr4->sin_addr.s_addr, rc);
2861 &saddr4->sin_addr.s_addr, rc);
2862 } 2856 }
2863 } 2857 }
2864 return rc; 2858 return rc;
@@ -2963,13 +2957,13 @@ generic_ip_connect(struct TCP_Server_Info *server)
2963 rc = __sock_create(cifs_net_ns(server), sfamily, SOCK_STREAM, 2957 rc = __sock_create(cifs_net_ns(server), sfamily, SOCK_STREAM,
2964 IPPROTO_TCP, &socket, 1); 2958 IPPROTO_TCP, &socket, 1);
2965 if (rc < 0) { 2959 if (rc < 0) {
2966 cERROR(1, "Error %d creating socket", rc); 2960 cifs_dbg(VFS, "Error %d creating socket\n", rc);
2967 server->ssocket = NULL; 2961 server->ssocket = NULL;
2968 return rc; 2962 return rc;
2969 } 2963 }
2970 2964
2971 /* BB other socket options to set KEEPALIVE, NODELAY? */ 2965 /* BB other socket options to set KEEPALIVE, NODELAY? */
2972 cFYI(1, "Socket created"); 2966 cifs_dbg(FYI, "Socket created\n");
2973 server->ssocket = socket; 2967 server->ssocket = socket;
2974 socket->sk->sk_allocation = GFP_NOFS; 2968 socket->sk->sk_allocation = GFP_NOFS;
2975 if (sfamily == AF_INET6) 2969 if (sfamily == AF_INET6)
@@ -3003,16 +2997,17 @@ generic_ip_connect(struct TCP_Server_Info *server)
3003 rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, 2997 rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY,
3004 (char *)&val, sizeof(val)); 2998 (char *)&val, sizeof(val));
3005 if (rc) 2999 if (rc)
3006 cFYI(1, "set TCP_NODELAY socket option error %d", rc); 3000 cifs_dbg(FYI, "set TCP_NODELAY socket option error %d\n",
3001 rc);
3007 } 3002 }
3008 3003
3009 cFYI(1, "sndbuf %d rcvbuf %d rcvtimeo 0x%lx", 3004 cifs_dbg(FYI, "sndbuf %d rcvbuf %d rcvtimeo 0x%lx\n",
3010 socket->sk->sk_sndbuf, 3005 socket->sk->sk_sndbuf,
3011 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo); 3006 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo);
3012 3007
3013 rc = socket->ops->connect(socket, saddr, slen, 0); 3008 rc = socket->ops->connect(socket, saddr, slen, 0);
3014 if (rc < 0) { 3009 if (rc < 0) {
3015 cFYI(1, "Error %d connecting to server", rc); 3010 cifs_dbg(FYI, "Error %d connecting to server\n", rc);
3016 sock_release(socket); 3011 sock_release(socket);
3017 server->ssocket = NULL; 3012 server->ssocket = NULL;
3018 return rc; 3013 return rc;
@@ -3070,19 +3065,19 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3070 if (vol_info && vol_info->no_linux_ext) { 3065 if (vol_info && vol_info->no_linux_ext) {
3071 tcon->fsUnixInfo.Capability = 0; 3066 tcon->fsUnixInfo.Capability = 0;
3072 tcon->unix_ext = 0; /* Unix Extensions disabled */ 3067 tcon->unix_ext = 0; /* Unix Extensions disabled */
3073 cFYI(1, "Linux protocol extensions disabled"); 3068 cifs_dbg(FYI, "Linux protocol extensions disabled\n");
3074 return; 3069 return;
3075 } else if (vol_info) 3070 } else if (vol_info)
3076 tcon->unix_ext = 1; /* Unix Extensions supported */ 3071 tcon->unix_ext = 1; /* Unix Extensions supported */
3077 3072
3078 if (tcon->unix_ext == 0) { 3073 if (tcon->unix_ext == 0) {
3079 cFYI(1, "Unix extensions disabled so not set on reconnect"); 3074 cifs_dbg(FYI, "Unix extensions disabled so not set on reconnect\n");
3080 return; 3075 return;
3081 } 3076 }
3082 3077
3083 if (!CIFSSMBQFSUnixInfo(xid, tcon)) { 3078 if (!CIFSSMBQFSUnixInfo(xid, tcon)) {
3084 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); 3079 __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
3085 cFYI(1, "unix caps which server supports %lld", cap); 3080 cifs_dbg(FYI, "unix caps which server supports %lld\n", cap);
3086 /* check for reconnect case in which we do not 3081 /* check for reconnect case in which we do not
3087 want to change the mount behavior if we can avoid it */ 3082 want to change the mount behavior if we can avoid it */
3088 if (vol_info == NULL) { 3083 if (vol_info == NULL) {
@@ -3092,22 +3087,22 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3092 cap &= ~CIFS_UNIX_POSIX_ACL_CAP; 3087 cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
3093 if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { 3088 if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
3094 if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) 3089 if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP)
3095 cERROR(1, "POSIXPATH support change"); 3090 cifs_dbg(VFS, "POSIXPATH support change\n");
3096 cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; 3091 cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
3097 } else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { 3092 } else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
3098 cERROR(1, "possible reconnect error"); 3093 cifs_dbg(VFS, "possible reconnect error\n");
3099 cERROR(1, "server disabled POSIX path support"); 3094 cifs_dbg(VFS, "server disabled POSIX path support\n");
3100 } 3095 }
3101 } 3096 }
3102 3097
3103 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP) 3098 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)
3104 cERROR(1, "per-share encryption not supported yet"); 3099 cifs_dbg(VFS, "per-share encryption not supported yet\n");
3105 3100
3106 cap &= CIFS_UNIX_CAP_MASK; 3101 cap &= CIFS_UNIX_CAP_MASK;
3107 if (vol_info && vol_info->no_psx_acl) 3102 if (vol_info && vol_info->no_psx_acl)
3108 cap &= ~CIFS_UNIX_POSIX_ACL_CAP; 3103 cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
3109 else if (CIFS_UNIX_POSIX_ACL_CAP & cap) { 3104 else if (CIFS_UNIX_POSIX_ACL_CAP & cap) {
3110 cFYI(1, "negotiated posix acl support"); 3105 cifs_dbg(FYI, "negotiated posix acl support\n");
3111 if (cifs_sb) 3106 if (cifs_sb)
3112 cifs_sb->mnt_cifs_flags |= 3107 cifs_sb->mnt_cifs_flags |=
3113 CIFS_MOUNT_POSIXACL; 3108 CIFS_MOUNT_POSIXACL;
@@ -3116,43 +3111,38 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3116 if (vol_info && vol_info->posix_paths == 0) 3111 if (vol_info && vol_info->posix_paths == 0)
3117 cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; 3112 cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
3118 else if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) { 3113 else if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
3119 cFYI(1, "negotiate posix pathnames"); 3114 cifs_dbg(FYI, "negotiate posix pathnames\n");
3120 if (cifs_sb) 3115 if (cifs_sb)
3121 cifs_sb->mnt_cifs_flags |= 3116 cifs_sb->mnt_cifs_flags |=
3122 CIFS_MOUNT_POSIX_PATHS; 3117 CIFS_MOUNT_POSIX_PATHS;
3123 } 3118 }
3124 3119
3125 cFYI(1, "Negotiate caps 0x%x", (int)cap); 3120 cifs_dbg(FYI, "Negotiate caps 0x%x\n", (int)cap);
3126#ifdef CONFIG_CIFS_DEBUG2 3121#ifdef CONFIG_CIFS_DEBUG2
3127 if (cap & CIFS_UNIX_FCNTL_CAP) 3122 if (cap & CIFS_UNIX_FCNTL_CAP)
3128 cFYI(1, "FCNTL cap"); 3123 cifs_dbg(FYI, "FCNTL cap\n");
3129 if (cap & CIFS_UNIX_EXTATTR_CAP) 3124 if (cap & CIFS_UNIX_EXTATTR_CAP)
3130 cFYI(1, "EXTATTR cap"); 3125 cifs_dbg(FYI, "EXTATTR cap\n");
3131 if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) 3126 if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP)
3132 cFYI(1, "POSIX path cap"); 3127 cifs_dbg(FYI, "POSIX path cap\n");
3133 if (cap & CIFS_UNIX_XATTR_CAP) 3128 if (cap & CIFS_UNIX_XATTR_CAP)
3134 cFYI(1, "XATTR cap"); 3129 cifs_dbg(FYI, "XATTR cap\n");
3135 if (cap & CIFS_UNIX_POSIX_ACL_CAP) 3130 if (cap & CIFS_UNIX_POSIX_ACL_CAP)
3136 cFYI(1, "POSIX ACL cap"); 3131 cifs_dbg(FYI, "POSIX ACL cap\n");
3137 if (cap & CIFS_UNIX_LARGE_READ_CAP) 3132 if (cap & CIFS_UNIX_LARGE_READ_CAP)
3138 cFYI(1, "very large read cap"); 3133 cifs_dbg(FYI, "very large read cap\n");
3139 if (cap & CIFS_UNIX_LARGE_WRITE_CAP) 3134 if (cap & CIFS_UNIX_LARGE_WRITE_CAP)
3140 cFYI(1, "very large write cap"); 3135 cifs_dbg(FYI, "very large write cap\n");
3141 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP) 3136 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)
3142 cFYI(1, "transport encryption cap"); 3137 cifs_dbg(FYI, "transport encryption cap\n");
3143 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP) 3138 if (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)
3144 cFYI(1, "mandatory transport encryption cap"); 3139 cifs_dbg(FYI, "mandatory transport encryption cap\n");
3145#endif /* CIFS_DEBUG2 */ 3140#endif /* CIFS_DEBUG2 */
3146 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { 3141 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
3147 if (vol_info == NULL) { 3142 if (vol_info == NULL) {
3148 cFYI(1, "resetting capabilities failed"); 3143 cifs_dbg(FYI, "resetting capabilities failed\n");
3149 } else 3144 } else
3150 cERROR(1, "Negotiating Unix capabilities " 3145 cifs_dbg(VFS, "Negotiating Unix capabilities with the server failed. Consider mounting with the Unix Extensions disabled if problems are found by specifying the nounix mount option.\n");
3151 "with the server failed. Consider "
3152 "mounting with the Unix Extensions "
3153 "disabled if problems are found "
3154 "by specifying the nounix mount "
3155 "option.");
3156 3146
3157 } 3147 }
3158 } 3148 }
@@ -3177,8 +3167,8 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
3177 cifs_sb->mnt_gid = pvolume_info->linux_gid; 3167 cifs_sb->mnt_gid = pvolume_info->linux_gid;
3178 cifs_sb->mnt_file_mode = pvolume_info->file_mode; 3168 cifs_sb->mnt_file_mode = pvolume_info->file_mode;
3179 cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; 3169 cifs_sb->mnt_dir_mode = pvolume_info->dir_mode;
3180 cFYI(1, "file mode: 0x%hx dir mode: 0x%hx", 3170 cifs_dbg(FYI, "file mode: 0x%hx dir mode: 0x%hx\n",
3181 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); 3171 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
3182 3172
3183 cifs_sb->actimeo = pvolume_info->actimeo; 3173 cifs_sb->actimeo = pvolume_info->actimeo;
3184 cifs_sb->local_nls = pvolume_info->local_nls; 3174 cifs_sb->local_nls = pvolume_info->local_nls;
@@ -3227,21 +3217,19 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
3227 if (pvolume_info->strict_io) 3217 if (pvolume_info->strict_io)
3228 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO; 3218 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO;
3229 if (pvolume_info->direct_io) { 3219 if (pvolume_info->direct_io) {
3230 cFYI(1, "mounting share using direct i/o"); 3220 cifs_dbg(FYI, "mounting share using direct i/o\n");
3231 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; 3221 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;
3232 } 3222 }
3233 if (pvolume_info->mfsymlinks) { 3223 if (pvolume_info->mfsymlinks) {
3234 if (pvolume_info->sfu_emul) { 3224 if (pvolume_info->sfu_emul) {
3235 cERROR(1, "mount option mfsymlinks ignored if sfu " 3225 cifs_dbg(VFS, "mount option mfsymlinks ignored if sfu mount option is used\n");
3236 "mount option is used");
3237 } else { 3226 } else {
3238 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MF_SYMLINKS; 3227 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MF_SYMLINKS;
3239 } 3228 }
3240 } 3229 }
3241 3230
3242 if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) 3231 if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm))
3243 cERROR(1, "mount option dynperm ignored if cifsacl " 3232 cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n");
3244 "mount option supported");
3245} 3233}
3246 3234
3247static void 3235static void
@@ -3293,7 +3281,7 @@ build_unc_path_to_root(const struct smb_vol *vol,
3293 3281
3294 *pos = '\0'; /* add trailing null */ 3282 *pos = '\0'; /* add trailing null */
3295 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); 3283 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
3296 cFYI(1, "%s: full_path=%s", __func__, full_path); 3284 cifs_dbg(FYI, "%s: full_path=%s\n", __func__, full_path);
3297 return full_path; 3285 return full_path;
3298} 3286}
3299 3287
@@ -3364,14 +3352,14 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
3364 return -EINVAL; 3352 return -EINVAL;
3365 3353
3366 if (volume_info->nullauth) { 3354 if (volume_info->nullauth) {
3367 cFYI(1, "Anonymous login"); 3355 cifs_dbg(FYI, "Anonymous login\n");
3368 kfree(volume_info->username); 3356 kfree(volume_info->username);
3369 volume_info->username = NULL; 3357 volume_info->username = NULL;
3370 } else if (volume_info->username) { 3358 } else if (volume_info->username) {
3371 /* BB fixme parse for domain name here */ 3359 /* BB fixme parse for domain name here */
3372 cFYI(1, "Username: %s", volume_info->username); 3360 cifs_dbg(FYI, "Username: %s\n", volume_info->username);
3373 } else { 3361 } else {
3374 cifserror("No username specified"); 3362 cifs_dbg(VFS, "No username specified\n");
3375 /* In userspace mount helper we can get user name from alternate 3363 /* In userspace mount helper we can get user name from alternate
3376 locations such as env variables and files on disk */ 3364 locations such as env variables and files on disk */
3377 return -EINVAL; 3365 return -EINVAL;
@@ -3384,7 +3372,7 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
3384 } else { 3372 } else {
3385 volume_info->local_nls = load_nls(volume_info->iocharset); 3373 volume_info->local_nls = load_nls(volume_info->iocharset);
3386 if (volume_info->local_nls == NULL) { 3374 if (volume_info->local_nls == NULL) {
3387 cERROR(1, "CIFS mount error: iocharset %s not found", 3375 cifs_dbg(VFS, "CIFS mount error: iocharset %s not found\n",
3388 volume_info->iocharset); 3376 volume_info->iocharset);
3389 return -ELIBACC; 3377 return -ELIBACC;
3390 } 3378 }
@@ -3734,13 +3722,13 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
3734 if (length == 3) { 3722 if (length == 3) {
3735 if ((bcc_ptr[0] == 'I') && (bcc_ptr[1] == 'P') && 3723 if ((bcc_ptr[0] == 'I') && (bcc_ptr[1] == 'P') &&
3736 (bcc_ptr[2] == 'C')) { 3724 (bcc_ptr[2] == 'C')) {
3737 cFYI(1, "IPC connection"); 3725 cifs_dbg(FYI, "IPC connection\n");
3738 tcon->ipc = 1; 3726 tcon->ipc = 1;
3739 } 3727 }
3740 } else if (length == 2) { 3728 } else if (length == 2) {
3741 if ((bcc_ptr[0] == 'A') && (bcc_ptr[1] == ':')) { 3729 if ((bcc_ptr[0] == 'A') && (bcc_ptr[1] == ':')) {
3742 /* the most common case */ 3730 /* the most common case */
3743 cFYI(1, "disk share connection"); 3731 cifs_dbg(FYI, "disk share connection\n");
3744 } 3732 }
3745 } 3733 }
3746 bcc_ptr += length + 1; 3734 bcc_ptr += length + 1;
@@ -3753,7 +3741,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
3753 bytes_left, is_unicode, 3741 bytes_left, is_unicode,
3754 nls_codepage); 3742 nls_codepage);
3755 3743
3756 cFYI(1, "nativeFileSystem=%s", tcon->nativeFileSystem); 3744 cifs_dbg(FYI, "nativeFileSystem=%s\n", tcon->nativeFileSystem);
3757 3745
3758 if ((smb_buffer_response->WordCount == 3) || 3746 if ((smb_buffer_response->WordCount == 3) ||
3759 (smb_buffer_response->WordCount == 7)) 3747 (smb_buffer_response->WordCount == 7))
@@ -3761,7 +3749,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
3761 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); 3749 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
3762 else 3750 else
3763 tcon->Flags = 0; 3751 tcon->Flags = 0;
3764 cFYI(1, "Tcon flags: 0x%x ", tcon->Flags); 3752 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
3765 } else if ((rc == 0) && tcon == NULL) { 3753 } else if ((rc == 0) && tcon == NULL) {
3766 /* all we need to save for IPC$ connection */ 3754 /* all we need to save for IPC$ connection */
3767 ses->ipc_tid = smb_buffer_response->Tid; 3755 ses->ipc_tid = smb_buffer_response->Tid;
@@ -3839,14 +3827,14 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
3839 if (linuxExtEnabled == 0) 3827 if (linuxExtEnabled == 0)
3840 ses->capabilities &= (~server->vals->cap_unix); 3828 ses->capabilities &= (~server->vals->cap_unix);
3841 3829
3842 cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", 3830 cifs_dbg(FYI, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d\n",
3843 server->sec_mode, server->capabilities, server->timeAdj); 3831 server->sec_mode, server->capabilities, server->timeAdj);
3844 3832
3845 if (server->ops->sess_setup) 3833 if (server->ops->sess_setup)
3846 rc = server->ops->sess_setup(xid, ses, nls_info); 3834 rc = server->ops->sess_setup(xid, ses, nls_info);
3847 3835
3848 if (rc) { 3836 if (rc) {
3849 cERROR(1, "Send error in SessSetup = %d", rc); 3837 cifs_dbg(VFS, "Send error in SessSetup = %d\n", rc);
3850 } else { 3838 } else {
3851 mutex_lock(&ses->server->srv_mutex); 3839 mutex_lock(&ses->server->srv_mutex);
3852 if (!server->session_estab) { 3840 if (!server->session_estab) {
@@ -3858,7 +3846,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
3858 } 3846 }
3859 mutex_unlock(&server->srv_mutex); 3847 mutex_unlock(&server->srv_mutex);
3860 3848
3861 cFYI(1, "CIFS Session Established successfully"); 3849 cifs_dbg(FYI, "CIFS Session Established successfully\n");
3862 spin_lock(&GlobalMid_Lock); 3850 spin_lock(&GlobalMid_Lock);
3863 ses->status = CifsGood; 3851 ses->status = CifsGood;
3864 ses->need_reconnect = false; 3852 ses->need_reconnect = false;