diff mbox

[14/19] cifs: remove rfc1002 header from smb2_lease_ack

Message ID 20171109011433.14468-15-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ronnie Sahlberg Nov. 9, 2017, 1:14 a.m. UTC
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2pdu.c | 18 ++++++++++++++----
 fs/cifs/smb2pdu.h |  2 +-
 2 files changed, 15 insertions(+), 5 deletions(-)

Comments

Aurélien Aptel Nov. 9, 2017, 2:11 p.m. UTC | #1
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Pavel Shilovsky Nov. 17, 2017, 10:56 p.m. UTC | #2
2017-11-08 17:14 GMT-08:00 Ronnie Sahlberg <lsahlber@redhat.com>:
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2pdu.c | 18 ++++++++++++++----
>  fs/cifs/smb2pdu.h |  2 +-
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 3ba9b2853902..d5c295cd44ea 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -3572,24 +3572,34 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
>  {
>         int rc;
>         struct smb2_lease_ack *req = NULL;
> +       struct cifs_ses *ses = tcon->ses;
>         int flags = CIFS_OBREAK_OP;
> +       unsigned int total_len;
> +       struct kvec iov[1];
> +       struct kvec rsp_iov;
> +       int resp_buf_type;
>
>         cifs_dbg(FYI, "SMB2_lease_break\n");
> -       rc = small_smb2_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req);
> +       rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req,
> +                            &total_len);
>         if (rc)
>                 return rc;
>
>         if (encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
> -       req->hdr.sync_hdr.CreditRequest = cpu_to_le16(1);
> +       req->sync_hdr.CreditRequest = cpu_to_le16(1);
>         req->StructureSize = cpu_to_le16(36);
> -       inc_rfc1001_len(req, 12);

Originally, we increased length to 12 for lease break.

>
>         memcpy(req->LeaseKey, lease_key, 16);
>         req->LeaseState = lease_state;
>
> -       rc = SendReceiveNoRsp(xid, tcon->ses, (char *) req, flags);
> +       flags |= CIFS_NO_RESP;
> +
> +       iov[0].iov_base = (char *)req;
> +       iov[0].iov_len = total_len;
> +

Don't we need to increase iov_len as well above?


--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 3ba9b2853902..d5c295cd44ea 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3572,24 +3572,34 @@  SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
 {
 	int rc;
 	struct smb2_lease_ack *req = NULL;
+	struct cifs_ses *ses = tcon->ses;
 	int flags = CIFS_OBREAK_OP;
+	unsigned int total_len;
+	struct kvec iov[1];
+	struct kvec rsp_iov;
+	int resp_buf_type;
 
 	cifs_dbg(FYI, "SMB2_lease_break\n");
-	rc = small_smb2_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req);
+	rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req,
+			     &total_len);
 	if (rc)
 		return rc;
 
 	if (encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
-	req->hdr.sync_hdr.CreditRequest = cpu_to_le16(1);
+	req->sync_hdr.CreditRequest = cpu_to_le16(1);
 	req->StructureSize = cpu_to_le16(36);
-	inc_rfc1001_len(req, 12);
 
 	memcpy(req->LeaseKey, lease_key, 16);
 	req->LeaseState = lease_state;
 
-	rc = SendReceiveNoRsp(xid, tcon->ses, (char *) req, flags);
+	flags |= CIFS_NO_RESP;
+
+	iov[0].iov_base = (char *)req;
+	iov[0].iov_len = total_len;
+
+	rc = smb2_send_recv(xid, ses, iov, 1, &resp_buf_type, flags, &rsp_iov);
 	cifs_small_buf_release(req);
 
 	if (rc) {
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 3c856f058be7..32f0f633b614 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -1057,7 +1057,7 @@  struct smb2_lease_break {
 } __packed;
 
 struct smb2_lease_ack {
-	struct smb2_hdr hdr;
+	struct smb2_sync_hdr sync_hdr;
 	__le16 StructureSize; /* Must be 36 */
 	__le16 Reserved;
 	__le32 Flags;