aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-05-19 16:22:53 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-22 22:58:26 -0400
commitfcc31cb6f1ae6c4e64a463b124d3c2e9cbd7dd70 (patch)
treecf4b73bc9d8d5e71e71b76d69550a70f58fb8278 /fs/cifs
parent2c8f981d93f830c167c811f046b5107cc24b6e1b (diff)
cifs: make cifs_send_async take a kvec array
We'll need this for async writes, so convert the call to take a kvec array. CIFSSMBEcho is changed to put a kvec on the stack and pass in the SMB buffer using that. Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/cifssmb.c6
-rw-r--r--fs/cifs/transport.c13
3 files changed, 13 insertions, 10 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 7aa131112884..f00aa74c2607 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -67,8 +67,8 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,
67extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer, 67extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
68 struct TCP_Server_Info *server); 68 struct TCP_Server_Info *server);
69extern void DeleteMidQEntry(struct mid_q_entry *midEntry); 69extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
70extern int cifs_call_async(struct TCP_Server_Info *server, 70extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
71 struct smb_hdr *in_buf, mid_callback_t *callback, 71 unsigned int nvec, mid_callback_t *callback,
72 void *cbdata); 72 void *cbdata);
73extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, 73extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
74 struct smb_hdr * /* input */ , 74 struct smb_hdr * /* input */ ,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 83df937b814e..8791c74575d9 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -725,6 +725,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
725{ 725{
726 ECHO_REQ *smb; 726 ECHO_REQ *smb;
727 int rc = 0; 727 int rc = 0;
728 struct kvec iov;
728 729
729 cFYI(1, "In echo request"); 730 cFYI(1, "In echo request");
730 731
@@ -739,9 +740,10 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
739 put_bcc(1, &smb->hdr); 740 put_bcc(1, &smb->hdr);
740 smb->Data[0] = 'a'; 741 smb->Data[0] = 'a';
741 inc_rfc1001_len(smb, 3); 742 inc_rfc1001_len(smb, 3);
743 iov.iov_base = smb;
744 iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
742 745
743 rc = cifs_call_async(server, (struct smb_hdr *)smb, 746 rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server);
744 cifs_echo_callback, server);
745 if (rc) 747 if (rc)
746 cFYI(1, "Echo request failed: %d", rc); 748 cFYI(1, "Echo request failed: %d", rc);
747 749
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 43633a79942a..67f59c7b5d79 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -342,11 +342,12 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
342 * the result. Caller is responsible for dealing with timeouts. 342 * the result. Caller is responsible for dealing with timeouts.
343 */ 343 */
344int 344int
345cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf, 345cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
346 mid_callback_t *callback, void *cbdata) 346 unsigned int nvec, mid_callback_t *callback, void *cbdata)
347{ 347{
348 int rc; 348 int rc;
349 struct mid_q_entry *mid; 349 struct mid_q_entry *mid;
350 struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
350 351
351 rc = wait_for_free_request(server, CIFS_ASYNC_OP); 352 rc = wait_for_free_request(server, CIFS_ASYNC_OP);
352 if (rc) 353 if (rc)
@@ -354,10 +355,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
354 355
355 /* enable signing if server requires it */ 356 /* enable signing if server requires it */
356 if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) 357 if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
357 in_buf->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; 358 hdr->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
358 359
359 mutex_lock(&server->srv_mutex); 360 mutex_lock(&server->srv_mutex);
360 mid = AllocMidQEntry(in_buf, server); 361 mid = AllocMidQEntry(hdr, server);
361 if (mid == NULL) { 362 if (mid == NULL) {
362 mutex_unlock(&server->srv_mutex); 363 mutex_unlock(&server->srv_mutex);
363 return -ENOMEM; 364 return -ENOMEM;
@@ -368,7 +369,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
368 list_add_tail(&mid->qhead, &server->pending_mid_q); 369 list_add_tail(&mid->qhead, &server->pending_mid_q);
369 spin_unlock(&GlobalMid_Lock); 370 spin_unlock(&GlobalMid_Lock);
370 371
371 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number); 372 rc = cifs_sign_smb2(iov, nvec, server, &mid->sequence_number);
372 if (rc) { 373 if (rc) {
373 mutex_unlock(&server->srv_mutex); 374 mutex_unlock(&server->srv_mutex);
374 goto out_err; 375 goto out_err;
@@ -380,7 +381,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
380#ifdef CONFIG_CIFS_STATS2 381#ifdef CONFIG_CIFS_STATS2
381 atomic_inc(&server->inSend); 382 atomic_inc(&server->inSend);
382#endif 383#endif
383 rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); 384 rc = smb_sendv(server, iov, nvec);
384#ifdef CONFIG_CIFS_STATS2 385#ifdef CONFIG_CIFS_STATS2
385 atomic_dec(&server->inSend); 386 atomic_dec(&server->inSend);
386 mid->when_sent = jiffies; 387 mid->when_sent = jiffies;