summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2019-09-03 22:32:41 -0400
committerSteve French <stfrench@microsoft.com>2019-09-16 12:43:38 -0400
commit3175eb9b577e82b44a25ad2d515ec9418ae06c04 (patch)
treebcb8165506bdc73cd5ddf08c371a69870a95cfa3 /fs/cifs/smb2ops.c
parent46f17d17687e8140f2e4e517d7dfa65e62fcc5f4 (diff)
cifs: add a debug macro that prints \\server\share for errors
Where we have a tcon available we can log \\server\share as part of the message. Only do this for the VFS log level. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 070d0b7b21dc..83b02d74d48e 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -109,10 +109,10 @@ smb2_add_credits(struct TCP_Server_Info *server,
109 /* change_conf hasn't been executed */ 109 /* change_conf hasn't been executed */
110 break; 110 break;
111 case 0: 111 case 0:
112 cifs_dbg(VFS, "Possible client or server bug - zero credits\n"); 112 cifs_server_dbg(VFS, "Possible client or server bug - zero credits\n");
113 break; 113 break;
114 case 1: 114 case 1:
115 cifs_dbg(VFS, "disabling echoes and oplocks\n"); 115 cifs_server_dbg(VFS, "disabling echoes and oplocks\n");
116 break; 116 break;
117 case 2: 117 case 2:
118 cifs_dbg(FYI, "disabling oplocks\n"); 118 cifs_dbg(FYI, "disabling oplocks\n");
@@ -230,7 +230,7 @@ smb2_adjust_credits(struct TCP_Server_Info *server,
230 230
231 if (server->reconnect_instance != credits->instance) { 231 if (server->reconnect_instance != credits->instance) {
232 spin_unlock(&server->req_lock); 232 spin_unlock(&server->req_lock);
233 cifs_dbg(VFS, "trying to return %d credits to old session\n", 233 cifs_server_dbg(VFS, "trying to return %d credits to old session\n",
234 credits->value - new_val); 234 credits->value - new_val);
235 return -EAGAIN; 235 return -EAGAIN;
236 } 236 }
@@ -270,7 +270,7 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf)
270 __u64 wire_mid = le64_to_cpu(shdr->MessageId); 270 __u64 wire_mid = le64_to_cpu(shdr->MessageId);
271 271
272 if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) { 272 if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) {
273 cifs_dbg(VFS, "Encrypted frame parsing not supported yet\n"); 273 cifs_server_dbg(VFS, "Encrypted frame parsing not supported yet\n");
274 return NULL; 274 return NULL;
275 } 275 }
276 276
@@ -294,10 +294,10 @@ smb2_dump_detail(void *buf, struct TCP_Server_Info *server)
294#ifdef CONFIG_CIFS_DEBUG2 294#ifdef CONFIG_CIFS_DEBUG2
295 struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf; 295 struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf;
296 296
297 cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d\n", 297 cifs_server_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d\n",
298 shdr->Command, shdr->Status, shdr->Flags, shdr->MessageId, 298 shdr->Command, shdr->Status, shdr->Flags, shdr->MessageId,
299 shdr->ProcessId); 299 shdr->ProcessId);
300 cifs_dbg(VFS, "smb buf %p len %u\n", buf, 300 cifs_server_dbg(VFS, "smb buf %p len %u\n", buf,
301 server->ops->calc_smb_size(buf, server)); 301 server->ops->calc_smb_size(buf, server));
302#endif 302#endif
303} 303}
@@ -576,7 +576,7 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon)
576 "server does not support query network interfaces\n"); 576 "server does not support query network interfaces\n");
577 goto out; 577 goto out;
578 } else if (rc != 0) { 578 } else if (rc != 0) {
579 cifs_dbg(VFS, "error %d on ioctl to get interface list\n", rc); 579 cifs_tcon_dbg(VFS, "error %d on ioctl to get interface list\n", rc);
580 goto out; 580 goto out;
581 } 581 }
582 582
@@ -1330,11 +1330,11 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
1330 (char **)&res_key, &ret_data_len); 1330 (char **)&res_key, &ret_data_len);
1331 1331
1332 if (rc) { 1332 if (rc) {
1333 cifs_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc); 1333 cifs_tcon_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc);
1334 goto req_res_key_exit; 1334 goto req_res_key_exit;
1335 } 1335 }
1336 if (ret_data_len < sizeof(struct resume_key_req)) { 1336 if (ret_data_len < sizeof(struct resume_key_req)) {
1337 cifs_dbg(VFS, "Invalid refcopy resume key length\n"); 1337 cifs_tcon_dbg(VFS, "Invalid refcopy resume key length\n");
1338 rc = -EINVAL; 1338 rc = -EINVAL;
1339 goto req_res_key_exit; 1339 goto req_res_key_exit;
1340 } 1340 }
@@ -1486,7 +1486,7 @@ smb2_ioctl_query_info(const unsigned int xid,
1486 qi.input_buffer_length, 1486 qi.input_buffer_length,
1487 qi.output_buffer_length, buffer); 1487 qi.output_buffer_length, buffer);
1488 } else { /* unknown flags */ 1488 } else { /* unknown flags */
1489 cifs_dbg(VFS, "invalid passthru query flags: 0x%x\n", qi.flags); 1489 cifs_tcon_dbg(VFS, "invalid passthru query flags: 0x%x\n", qi.flags);
1490 rc = -EINVAL; 1490 rc = -EINVAL;
1491 } 1491 }
1492 1492
@@ -1613,7 +1613,7 @@ smb2_copychunk_range(const unsigned int xid,
1613 if (rc == 0) { 1613 if (rc == 0) {
1614 if (ret_data_len != 1614 if (ret_data_len !=
1615 sizeof(struct copychunk_ioctl_rsp)) { 1615 sizeof(struct copychunk_ioctl_rsp)) {
1616 cifs_dbg(VFS, "invalid cchunk response size\n"); 1616 cifs_tcon_dbg(VFS, "invalid cchunk response size\n");
1617 rc = -EIO; 1617 rc = -EIO;
1618 goto cchunk_out; 1618 goto cchunk_out;
1619 } 1619 }
@@ -1627,12 +1627,12 @@ smb2_copychunk_range(const unsigned int xid,
1627 */ 1627 */
1628 if (le32_to_cpu(retbuf->TotalBytesWritten) > 1628 if (le32_to_cpu(retbuf->TotalBytesWritten) >
1629 le32_to_cpu(pcchunk->Length)) { 1629 le32_to_cpu(pcchunk->Length)) {
1630 cifs_dbg(VFS, "invalid copy chunk response\n"); 1630 cifs_tcon_dbg(VFS, "invalid copy chunk response\n");
1631 rc = -EIO; 1631 rc = -EIO;
1632 goto cchunk_out; 1632 goto cchunk_out;
1633 } 1633 }
1634 if (le32_to_cpu(retbuf->ChunksWritten) != 1) { 1634 if (le32_to_cpu(retbuf->ChunksWritten) != 1) {
1635 cifs_dbg(VFS, "invalid num chunks written\n"); 1635 cifs_tcon_dbg(VFS, "invalid num chunks written\n");
1636 rc = -EIO; 1636 rc = -EIO;
1637 goto cchunk_out; 1637 goto cchunk_out;
1638 } 1638 }
@@ -2422,7 +2422,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
2422 2422
2423 if (rc) { 2423 if (rc) {
2424 if ((rc != -ENOENT) && (rc != -EOPNOTSUPP)) 2424 if ((rc != -ENOENT) && (rc != -EOPNOTSUPP))
2425 cifs_dbg(VFS, "ioctl error in %s rc=%d\n", __func__, rc); 2425 cifs_tcon_dbg(VFS, "ioctl error in %s rc=%d\n", __func__, rc);
2426 goto out; 2426 goto out;
2427 } 2427 }
2428 2428
@@ -2431,7 +2431,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
2431 nls_codepage, remap, search_name, 2431 nls_codepage, remap, search_name,
2432 true /* is_unicode */); 2432 true /* is_unicode */);
2433 if (rc) { 2433 if (rc) {
2434 cifs_dbg(VFS, "parse error in %s rc=%d\n", __func__, rc); 2434 cifs_tcon_dbg(VFS, "parse error in %s rc=%d\n", __func__, rc);
2435 goto out; 2435 goto out;
2436 } 2436 }
2437 2437
@@ -2661,7 +2661,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
2661 2661
2662 if (plen + le32_to_cpu(ioctl_rsp->OutputOffset) > 2662 if (plen + le32_to_cpu(ioctl_rsp->OutputOffset) >
2663 rsp_iov[1].iov_len) { 2663 rsp_iov[1].iov_len) {
2664 cifs_dbg(VFS, "srv returned invalid ioctl len: %d\n", 2664 cifs_tcon_dbg(VFS, "srv returned invalid ioctl len: %d\n",
2665 plen); 2665 plen);
2666 rc = -EIO; 2666 rc = -EIO;
2667 goto querty_exit; 2667 goto querty_exit;
@@ -3614,14 +3614,14 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
3614 3614
3615 rc = smb2_get_enc_key(server, tr_hdr->SessionId, enc, key); 3615 rc = smb2_get_enc_key(server, tr_hdr->SessionId, enc, key);
3616 if (rc) { 3616 if (rc) {
3617 cifs_dbg(VFS, "%s: Could not get %scryption key\n", __func__, 3617 cifs_server_dbg(VFS, "%s: Could not get %scryption key\n", __func__,
3618 enc ? "en" : "de"); 3618 enc ? "en" : "de");
3619 return 0; 3619 return 0;
3620 } 3620 }
3621 3621
3622 rc = smb3_crypto_aead_allocate(server); 3622 rc = smb3_crypto_aead_allocate(server);
3623 if (rc) { 3623 if (rc) {
3624 cifs_dbg(VFS, "%s: crypto alloc failed\n", __func__); 3624 cifs_server_dbg(VFS, "%s: crypto alloc failed\n", __func__);
3625 return rc; 3625 return rc;
3626 } 3626 }
3627 3627
@@ -3629,19 +3629,19 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
3629 server->secmech.ccmaesdecrypt; 3629 server->secmech.ccmaesdecrypt;
3630 rc = crypto_aead_setkey(tfm, key, SMB3_SIGN_KEY_SIZE); 3630 rc = crypto_aead_setkey(tfm, key, SMB3_SIGN_KEY_SIZE);
3631 if (rc) { 3631 if (rc) {
3632 cifs_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc); 3632 cifs_server_dbg(VFS, "%s: Failed to set aead key %d\n", __func__, rc);
3633 return rc; 3633 return rc;
3634 } 3634 }
3635 3635
3636 rc = crypto_aead_setauthsize(tfm, SMB2_SIGNATURE_SIZE); 3636 rc = crypto_aead_setauthsize(tfm, SMB2_SIGNATURE_SIZE);
3637 if (rc) { 3637 if (rc) {
3638 cifs_dbg(VFS, "%s: Failed to set authsize %d\n", __func__, rc); 3638 cifs_server_dbg(VFS, "%s: Failed to set authsize %d\n", __func__, rc);
3639 return rc; 3639 return rc;
3640 } 3640 }
3641 3641
3642 req = aead_request_alloc(tfm, GFP_KERNEL); 3642 req = aead_request_alloc(tfm, GFP_KERNEL);
3643 if (!req) { 3643 if (!req) {
3644 cifs_dbg(VFS, "%s: Failed to alloc aead request\n", __func__); 3644 cifs_server_dbg(VFS, "%s: Failed to alloc aead request\n", __func__);
3645 return -ENOMEM; 3645 return -ENOMEM;
3646 } 3646 }
3647 3647
@@ -3652,7 +3652,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
3652 3652
3653 sg = init_sg(num_rqst, rqst, sign); 3653 sg = init_sg(num_rqst, rqst, sign);
3654 if (!sg) { 3654 if (!sg) {
3655 cifs_dbg(VFS, "%s: Failed to init sg\n", __func__); 3655 cifs_server_dbg(VFS, "%s: Failed to init sg\n", __func__);
3656 rc = -ENOMEM; 3656 rc = -ENOMEM;
3657 goto free_req; 3657 goto free_req;
3658 } 3658 }
@@ -3660,7 +3660,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
3660 iv_len = crypto_aead_ivsize(tfm); 3660 iv_len = crypto_aead_ivsize(tfm);
3661 iv = kzalloc(iv_len, GFP_KERNEL); 3661 iv = kzalloc(iv_len, GFP_KERNEL);
3662 if (!iv) { 3662 if (!iv) {
3663 cifs_dbg(VFS, "%s: Failed to alloc iv\n", __func__); 3663 cifs_server_dbg(VFS, "%s: Failed to alloc iv\n", __func__);
3664 rc = -ENOMEM; 3664 rc = -ENOMEM;
3665 goto free_sg; 3665 goto free_sg;
3666 } 3666 }
@@ -3902,7 +3902,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
3902 bool use_rdma_mr = false; 3902 bool use_rdma_mr = false;
3903 3903
3904 if (shdr->Command != SMB2_READ) { 3904 if (shdr->Command != SMB2_READ) {
3905 cifs_dbg(VFS, "only big read responses are supported\n"); 3905 cifs_server_dbg(VFS, "only big read responses are supported\n");
3906 return -ENOTSUPP; 3906 return -ENOTSUPP;
3907 } 3907 }
3908 3908
@@ -4148,7 +4148,7 @@ one_more:
4148 } 4148 }
4149 4149
4150 if (*num_mids >= MAX_COMPOUND) { 4150 if (*num_mids >= MAX_COMPOUND) {
4151 cifs_dbg(VFS, "too many PDUs in compound\n"); 4151 cifs_server_dbg(VFS, "too many PDUs in compound\n");
4152 return -1; 4152 return -1;
4153 } 4153 }
4154 bufs[*num_mids] = buf; 4154 bufs[*num_mids] = buf;
@@ -4194,7 +4194,7 @@ smb3_receive_transform(struct TCP_Server_Info *server,
4194 4194
4195 if (pdu_length < sizeof(struct smb2_transform_hdr) + 4195 if (pdu_length < sizeof(struct smb2_transform_hdr) +
4196 sizeof(struct smb2_sync_hdr)) { 4196 sizeof(struct smb2_sync_hdr)) {
4197 cifs_dbg(VFS, "Transform message is too small (%u)\n", 4197 cifs_server_dbg(VFS, "Transform message is too small (%u)\n",
4198 pdu_length); 4198 pdu_length);
4199 cifs_reconnect(server); 4199 cifs_reconnect(server);
4200 wake_up(&server->response_q); 4200 wake_up(&server->response_q);
@@ -4202,7 +4202,7 @@ smb3_receive_transform(struct TCP_Server_Info *server,
4202 } 4202 }
4203 4203
4204 if (pdu_length < orig_len + sizeof(struct smb2_transform_hdr)) { 4204 if (pdu_length < orig_len + sizeof(struct smb2_transform_hdr)) {
4205 cifs_dbg(VFS, "Transform message is broken\n"); 4205 cifs_server_dbg(VFS, "Transform message is broken\n");
4206 cifs_reconnect(server); 4206 cifs_reconnect(server);
4207 wake_up(&server->response_q); 4207 wake_up(&server->response_q);
4208 return -ECONNABORTED; 4208 return -ECONNABORTED;