forked from Minki/linux
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>
This commit is contained in:
parent
2c8f981d93
commit
fcc31cb6f1
@ -67,8 +67,8 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,
|
|||||||
extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
|
extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
|
||||||
struct TCP_Server_Info *server);
|
struct TCP_Server_Info *server);
|
||||||
extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
|
extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
|
||||||
extern int cifs_call_async(struct TCP_Server_Info *server,
|
extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
|
||||||
struct smb_hdr *in_buf, mid_callback_t *callback,
|
unsigned int nvec, mid_callback_t *callback,
|
||||||
void *cbdata);
|
void *cbdata);
|
||||||
extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
|
extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
|
||||||
struct smb_hdr * /* input */ ,
|
struct smb_hdr * /* input */ ,
|
||||||
|
@ -725,6 +725,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
|
|||||||
{
|
{
|
||||||
ECHO_REQ *smb;
|
ECHO_REQ *smb;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
struct kvec iov;
|
||||||
|
|
||||||
cFYI(1, "In echo request");
|
cFYI(1, "In echo request");
|
||||||
|
|
||||||
@ -739,9 +740,10 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
|
|||||||
put_bcc(1, &smb->hdr);
|
put_bcc(1, &smb->hdr);
|
||||||
smb->Data[0] = 'a';
|
smb->Data[0] = 'a';
|
||||||
inc_rfc1001_len(smb, 3);
|
inc_rfc1001_len(smb, 3);
|
||||||
|
iov.iov_base = smb;
|
||||||
|
iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
|
||||||
|
|
||||||
rc = cifs_call_async(server, (struct smb_hdr *)smb,
|
rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server);
|
||||||
cifs_echo_callback, server);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
cFYI(1, "Echo request failed: %d", rc);
|
cFYI(1, "Echo request failed: %d", rc);
|
||||||
|
|
||||||
|
@ -342,11 +342,12 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
|
|||||||
* the result. Caller is responsible for dealing with timeouts.
|
* the result. Caller is responsible for dealing with timeouts.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
|
cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
|
||||||
mid_callback_t *callback, void *cbdata)
|
unsigned int nvec, mid_callback_t *callback, void *cbdata)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct mid_q_entry *mid;
|
struct mid_q_entry *mid;
|
||||||
|
struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
|
||||||
|
|
||||||
rc = wait_for_free_request(server, CIFS_ASYNC_OP);
|
rc = wait_for_free_request(server, CIFS_ASYNC_OP);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -354,10 +355,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
|
|||||||
|
|
||||||
/* enable signing if server requires it */
|
/* enable signing if server requires it */
|
||||||
if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
|
if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
|
||||||
in_buf->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
|
hdr->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
|
||||||
|
|
||||||
mutex_lock(&server->srv_mutex);
|
mutex_lock(&server->srv_mutex);
|
||||||
mid = AllocMidQEntry(in_buf, server);
|
mid = AllocMidQEntry(hdr, server);
|
||||||
if (mid == NULL) {
|
if (mid == NULL) {
|
||||||
mutex_unlock(&server->srv_mutex);
|
mutex_unlock(&server->srv_mutex);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -368,7 +369,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
|
|||||||
list_add_tail(&mid->qhead, &server->pending_mid_q);
|
list_add_tail(&mid->qhead, &server->pending_mid_q);
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
|
||||||
rc = cifs_sign_smb(in_buf, server, &mid->sequence_number);
|
rc = cifs_sign_smb2(iov, nvec, server, &mid->sequence_number);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
mutex_unlock(&server->srv_mutex);
|
mutex_unlock(&server->srv_mutex);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
@ -380,7 +381,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
|
|||||||
#ifdef CONFIG_CIFS_STATS2
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
atomic_inc(&server->inSend);
|
atomic_inc(&server->inSend);
|
||||||
#endif
|
#endif
|
||||||
rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
|
rc = smb_sendv(server, iov, nvec);
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
atomic_dec(&server->inSend);
|
atomic_dec(&server->inSend);
|
||||||
mid->when_sent = jiffies;
|
mid->when_sent = jiffies;
|
||||||
|
Loading…
Reference in New Issue
Block a user