Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326293
b: refs/heads/master
c: fec344e
h: refs/heads/master
i:
  326291: c0f25db
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Sep 25, 2012
1 parent 4e021c3 commit 0012424
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 80 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb308a6f22f7f4f3574dab6b36c4a3598e50cf05
refs/heads/master: fec344e3f31aa911297cd3a4639432d983b1f324
8 changes: 4 additions & 4 deletions trunk/fs/cifs/cifsglob.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ struct smb_version_operations {
struct mid_q_entry *);
bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *);
/* setup request: allocate mid, sign message */
int (*setup_request)(struct cifs_ses *, struct kvec *, unsigned int,
struct mid_q_entry **);
struct mid_q_entry *(*setup_request)(struct cifs_ses *,
struct smb_rqst *);
/* setup async request: allocate mid, sign message */
int (*setup_async_request)(struct TCP_Server_Info *, struct kvec *,
unsigned int, struct mid_q_entry **);
struct mid_q_entry *(*setup_async_request)(struct TCP_Server_Info *,
struct smb_rqst *);
/* check response: verify signature, map error */
int (*check_receive)(struct mid_q_entry *, struct TCP_Server_Info *,
bool);
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/cifs/cifsproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
extern void cifs_delete_mid(struct mid_q_entry *mid);
extern void cifs_wake_up_task(struct mid_q_entry *mid);
extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
unsigned int nvec, mid_receive_t *receive,
mid_callback_t *callback, void *cbdata,
const int flags);
extern int cifs_call_async(struct TCP_Server_Info *server,
struct smb_rqst *rqst,
mid_receive_t *receive, mid_callback_t *callback,
void *cbdata, const int flags);
extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
struct smb_hdr * /* input */ ,
struct smb_hdr * /* out */ ,
int * /* bytes returned */ , const int);
extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
char *in_buf, int flags);
extern int cifs_setup_request(struct cifs_ses *, struct kvec *, unsigned int,
struct mid_q_entry **);
extern int cifs_setup_async_request(struct TCP_Server_Info *, struct kvec *,
unsigned int, struct mid_q_entry **);
extern struct mid_q_entry *cifs_setup_request(struct cifs_ses *,
struct smb_rqst *);
extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
struct smb_rqst *);
extern int cifs_check_receive(struct mid_q_entry *mid,
struct TCP_Server_Info *server, bool log_error);
extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
Expand Down
20 changes: 13 additions & 7 deletions trunk/fs/cifs/cifssmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,8 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
ECHO_REQ *smb;
int rc = 0;
struct kvec iov;
struct smb_rqst rqst = { .rq_iov = &iov,
.rq_nvec = 1 };

cFYI(1, "In echo request");

Expand All @@ -742,7 +744,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
iov.iov_base = smb;
iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;

rc = cifs_call_async(server, &iov, 1, NULL, cifs_echo_callback,
rc = cifs_call_async(server, &rqst, NULL, cifs_echo_callback,
server, CIFS_ASYNC_OP | CIFS_ECHO_OP);
if (rc)
cFYI(1, "Echo request failed: %d", rc);
Expand Down Expand Up @@ -1585,6 +1587,8 @@ cifs_async_readv(struct cifs_readdata *rdata)
READ_REQ *smb = NULL;
int wct;
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
struct smb_rqst rqst = { .rq_iov = rdata->iov,
.rq_nvec = 1 };

cFYI(1, "%s: offset=%llu bytes=%u", __func__,
rdata->offset, rdata->bytes);
Expand Down Expand Up @@ -1628,9 +1632,8 @@ cifs_async_readv(struct cifs_readdata *rdata)
rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;

kref_get(&rdata->refcount);
rc = cifs_call_async(tcon->ses->server, rdata->iov, 1,
cifs_readv_receive, cifs_readv_callback,
rdata, 0);
rc = cifs_call_async(tcon->ses->server, &rqst, cifs_readv_receive,
cifs_readv_callback, rdata, 0);

if (rc == 0)
cifs_stats_inc(&tcon->stats.cifs_stats.num_reads);
Expand Down Expand Up @@ -2035,6 +2038,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
int wct;
struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
struct kvec *iov = NULL;
struct smb_rqst rqst = { };

if (tcon->ses->capabilities & CAP_LARGE_FILES) {
wct = 14;
Expand All @@ -2051,11 +2055,13 @@ cifs_async_writev(struct cifs_writedata *wdata)
goto async_writev_out;

/* 1 iov per page + 1 for header */
iov = kzalloc((wdata->nr_pages + 1) * sizeof(*iov), GFP_NOFS);
rqst.rq_nvec = wdata->nr_pages + 1;
iov = kzalloc((rqst.rq_nvec) * sizeof(*iov), GFP_NOFS);
if (iov == NULL) {
rc = -ENOMEM;
goto async_writev_out;
}
rqst.rq_iov = iov;

smb->hdr.Pid = cpu_to_le16((__u16)wdata->pid);
smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16));
Expand Down Expand Up @@ -2104,8 +2110,8 @@ cifs_async_writev(struct cifs_writedata *wdata)
}

kref_get(&wdata->refcount);
rc = cifs_call_async(tcon->ses->server, iov, wdata->nr_pages + 1,
NULL, cifs_writev_callback, wdata, 0);
rc = cifs_call_async(tcon->ses->server, &rqst, NULL,
cifs_writev_callback, wdata, 0);

if (rc == 0)
cifs_stats_inc(&tcon->stats.cifs_stats.num_writes);
Expand Down
15 changes: 11 additions & 4 deletions trunk/fs/cifs/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,8 @@ SMB2_echo(struct TCP_Server_Info *server)
struct smb2_echo_req *req;
int rc = 0;
struct kvec iov;
struct smb_rqst rqst = { .rq_iov = &iov,
.rq_nvec = 1 };

cFYI(1, "In echo request");

Expand All @@ -1184,7 +1186,7 @@ SMB2_echo(struct TCP_Server_Info *server)
/* 4 for rfc1002 length field */
iov.iov_len = get_rfc1002_length(req) + 4;

rc = cifs_call_async(server, &iov, 1, NULL, smb2_echo_callback, server,
rc = cifs_call_async(server, &rqst, NULL, smb2_echo_callback, server,
CIFS_ECHO_OP);
if (rc)
cFYI(1, "Echo request failed: %d", rc);
Expand Down Expand Up @@ -1344,6 +1346,8 @@ smb2_async_readv(struct cifs_readdata *rdata)
int rc;
struct smb2_hdr *buf;
struct cifs_io_parms io_parms;
struct smb_rqst rqst = { .rq_iov = rdata->iov,
.rq_nvec = 1 };

cFYI(1, "%s: offset=%llu bytes=%u", __func__,
rdata->offset, rdata->bytes);
Expand All @@ -1363,7 +1367,7 @@ smb2_async_readv(struct cifs_readdata *rdata)
rdata->iov[0].iov_len = get_rfc1002_length(rdata->iov[0].iov_base) + 4;

kref_get(&rdata->refcount);
rc = cifs_call_async(io_parms.tcon->ses->server, rdata->iov, 1,
rc = cifs_call_async(io_parms.tcon->ses->server, &rqst,
cifs_readv_receive, smb2_readv_callback,
rdata, 0);
if (rc)
Expand Down Expand Up @@ -1484,6 +1488,7 @@ smb2_async_writev(struct cifs_writedata *wdata)
struct smb2_write_req *req = NULL;
struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
struct kvec *iov = NULL;
struct smb_rqst rqst;

rc = small_smb2_init(SMB2_WRITE, tcon, (void **) &req);
if (rc)
Expand All @@ -1495,6 +1500,8 @@ smb2_async_writev(struct cifs_writedata *wdata)
rc = -ENOMEM;
goto async_writev_out;
}
rqst.rq_iov = iov;
rqst.rq_nvec = wdata->nr_pages + 1;

req->hdr.ProcessId = cpu_to_le32(wdata->cfile->pid);

Expand Down Expand Up @@ -1530,8 +1537,8 @@ smb2_async_writev(struct cifs_writedata *wdata)
inc_rfc1001_len(&req->hdr, wdata->bytes - 1 /* Buffer */);

kref_get(&wdata->refcount);
rc = cifs_call_async(tcon->ses->server, iov, wdata->nr_pages + 1,
NULL, smb2_writev_callback, wdata, 0);
rc = cifs_call_async(tcon->ses->server, &rqst, NULL,
smb2_writev_callback, wdata, 0);

if (rc)
kref_put(&wdata->refcount, cifs_writedata_release);
Expand Down
9 changes: 4 additions & 5 deletions trunk/fs/cifs/smb2proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ extern __le16 *cifs_convert_path_to_utf16(const char *from,
extern int smb2_verify_signature(struct smb_rqst *, struct TCP_Server_Info *);
extern int smb2_check_receive(struct mid_q_entry *mid,
struct TCP_Server_Info *server, bool log_error);
extern int smb2_setup_request(struct cifs_ses *ses, struct kvec *iov,
unsigned int nvec, struct mid_q_entry **ret_mid);
extern int smb2_setup_async_request(struct TCP_Server_Info *server,
struct kvec *iov, unsigned int nvec,
struct mid_q_entry **ret_mid);
extern struct mid_q_entry *smb2_setup_request(struct cifs_ses *ses,
struct smb_rqst *rqst);
extern struct mid_q_entry *smb2_setup_async_request(
struct TCP_Server_Info *server, struct smb_rqst *rqst);
extern void smb2_echo_request(struct work_struct *work);
extern bool smb2_is_valid_oplock_break(char *buffer,
struct TCP_Server_Info *srv);
Expand Down
40 changes: 17 additions & 23 deletions trunk/fs/cifs/smb2transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,50 +281,44 @@ smb2_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
return map_smb2_to_linux_error(mid->resp_buf, log_error);
}

int
smb2_setup_request(struct cifs_ses *ses, struct kvec *iov,
unsigned int nvec, struct mid_q_entry **ret_mid)
struct mid_q_entry *
smb2_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst)
{
int rc;
struct smb2_hdr *hdr = (struct smb2_hdr *)iov[0].iov_base;
struct smb2_hdr *hdr = (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
struct mid_q_entry *mid;
struct smb_rqst rqst = { .rq_iov = iov,
.rq_nvec = nvec };

smb2_seq_num_into_buf(ses->server, hdr);

rc = smb2_get_mid_entry(ses, hdr, &mid);
if (rc)
return rc;
rc = smb2_sign_rqst(&rqst, ses->server);
if (rc)
return ERR_PTR(rc);
rc = smb2_sign_rqst(rqst, ses->server);
if (rc) {
cifs_delete_mid(mid);
*ret_mid = mid;
return rc;
return ERR_PTR(rc);
}
return mid;
}

int
smb2_setup_async_request(struct TCP_Server_Info *server, struct kvec *iov,
unsigned int nvec, struct mid_q_entry **ret_mid)
struct mid_q_entry *
smb2_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst)
{
int rc = 0;
struct smb2_hdr *hdr = (struct smb2_hdr *)iov[0].iov_base;
int rc;
struct smb2_hdr *hdr = (struct smb2_hdr *)rqst->rq_iov[0].iov_base;
struct mid_q_entry *mid;
struct smb_rqst rqst = { .rq_iov = iov,
.rq_nvec = nvec };

smb2_seq_num_into_buf(server, hdr);

mid = smb2_mid_entry_alloc(hdr, server);
if (mid == NULL)
return -ENOMEM;
return ERR_PTR(-ENOMEM);

rc = smb2_sign_rqst(&rqst, server);
rc = smb2_sign_rqst(rqst, server);
if (rc) {
DeleteMidQEntry(mid);
return rc;
return ERR_PTR(rc);
}

*ret_mid = mid;
return rc;
return mid;
}
Loading

0 comments on commit 0012424

Please sign in to comment.