{"id":833234,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833234/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20171102070312.18903-11-lsahlber@redhat.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.2/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171102070312.18903-11-lsahlber@redhat.com>","list_archive_url":null,"date":"2017-11-02T07:03:03","name":"[10/19] cifs: remove rfc1002 header from smb2_create_req","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"db3bb6ccc8ef65f84ad33dea979da4f0d17fd801","submitter":{"id":72324,"url":"http://patchwork.ozlabs.org/api/1.2/people/72324/?format=json","name":"Ronnie Sahlberg","email":"lsahlber@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20171102070312.18903-11-lsahlber@redhat.com/mbox/","series":[{"id":11445,"url":"http://patchwork.ozlabs.org/api/1.2/series/11445/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=11445","date":"2017-11-02T07:03:12","name":"cifs: remove rfc1002 header from all smb2 requests","version":1,"mbox":"http://patchwork.ozlabs.org/series/11445/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833234/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833234/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-cifs-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-cifs-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=lsahlber@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySGLs62BHz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 18:05:25 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755140AbdKBHFZ (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 2 Nov 2017 03:05:25 -0400","from mx1.redhat.com ([209.132.183.28]:41384 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1754944AbdKBHFX (ORCPT <rfc822;linux-cifs@vger.kernel.org>);\n\tThu, 2 Nov 2017 03:05:23 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 7B87481DEB;\n\tThu,  2 Nov 2017 07:05:23 +0000 (UTC)","from test1190.test.redhat.com (vpn2-54-17.bne.redhat.com\n\t[10.64.54.17])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 2BD845D9C6;\n\tThu,  2 Nov 2017 07:05:20 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 7B87481DEB","From":"Ronnie Sahlberg <lsahlber@redhat.com>","To":"linux-cifs <linux-cifs@vger.kernel.org>","Cc":"Steve French <smfrench@gmail.com>","Subject":"[PATCH 10/19] cifs: remove rfc1002 header from smb2_create_req","Date":"Thu,  2 Nov 2017 18:03:03 +1100","Message-Id":"<20171102070312.18903-11-lsahlber@redhat.com>","In-Reply-To":"<20171102070312.18903-1-lsahlber@redhat.com>","References":"<20171102070312.18903-1-lsahlber@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tThu, 02 Nov 2017 07:05:23 +0000 (UTC)","Sender":"linux-cifs-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-cifs.vger.kernel.org>","X-Mailing-List":"linux-cifs@vger.kernel.org"},"content":"Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>\n---\n fs/cifs/smb2pdu.c | 29 +++++++++++------------------\n fs/cifs/smb2pdu.h |  2 +-\n 2 files changed, 12 insertions(+), 19 deletions(-)","diff":"diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c\nindex 305e4be511ba..1e012713d79b 100644\n--- a/fs/cifs/smb2pdu.c\n+++ b/fs/cifs/smb2pdu.c\n@@ -1519,11 +1519,10 @@ add_lease_context(struct TCP_Server_Info *server, struct kvec *iov,\n \treq->RequestedOplockLevel = SMB2_OPLOCK_LEVEL_LEASE;\n \tif (!req->CreateContextsOffset)\n \t\treq->CreateContextsOffset = cpu_to_le32(\n-\t\t\t\tsizeof(struct smb2_create_req) - 4 +\n+\t\t\t\tsizeof(struct smb2_create_req) +\n \t\t\t\tiov[num - 1].iov_len);\n \tle32_add_cpu(&req->CreateContextsLength,\n \t\t     server->vals->create_lease_size);\n-\tinc_rfc1001_len(&req->hdr, server->vals->create_lease_size);\n \t*num_iovec = num + 1;\n \treturn 0;\n }\n@@ -1603,10 +1602,9 @@ add_durable_v2_context(struct kvec *iov, unsigned int *num_iovec,\n \tiov[num].iov_len = sizeof(struct create_durable_v2);\n \tif (!req->CreateContextsOffset)\n \t\treq->CreateContextsOffset =\n-\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) - 4 +\n+\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) +\n \t\t\t\t\t\t\t\tiov[1].iov_len);\n \tle32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable_v2));\n-\tinc_rfc1001_len(&req->hdr, sizeof(struct create_durable_v2));\n \t*num_iovec = num + 1;\n \treturn 0;\n }\n@@ -1627,12 +1625,10 @@ add_durable_reconnect_v2_context(struct kvec *iov, unsigned int *num_iovec,\n \tiov[num].iov_len = sizeof(struct create_durable_handle_reconnect_v2);\n \tif (!req->CreateContextsOffset)\n \t\treq->CreateContextsOffset =\n-\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) - 4 +\n+\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) +\n \t\t\t\t\t\t\t\tiov[1].iov_len);\n \tle32_add_cpu(&req->CreateContextsLength,\n \t\t\tsizeof(struct create_durable_handle_reconnect_v2));\n-\tinc_rfc1001_len(&req->hdr,\n-\t\t\tsizeof(struct create_durable_handle_reconnect_v2));\n \t*num_iovec = num + 1;\n \treturn 0;\n }\n@@ -1663,10 +1659,9 @@ add_durable_context(struct kvec *iov, unsigned int *num_iovec,\n \tiov[num].iov_len = sizeof(struct create_durable);\n \tif (!req->CreateContextsOffset)\n \t\treq->CreateContextsOffset =\n-\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) - 4 +\n+\t\t\tcpu_to_le32(sizeof(struct smb2_create_req) +\n \t\t\t\t\t\t\t\tiov[1].iov_len);\n \tle32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable));\n-\tinc_rfc1001_len(&req->hdr, sizeof(struct create_durable));\n \t*num_iovec = num + 1;\n \treturn 0;\n }\n@@ -1737,6 +1732,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \t__u32 file_attributes = 0;\n \tchar *dhc_buf = NULL, *lc_buf = NULL;\n \tint flags = 0;\n+\tunsigned int total_len;\n \n \tcifs_dbg(FYI, \"create/open\\n\");\n \n@@ -1745,7 +1741,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \telse\n \t\treturn -EIO;\n \n-\trc = small_smb2_init(SMB2_CREATE, tcon, (void **) &req);\n+\trc = smb2_plain_req_init(SMB2_CREATE, tcon, (void **) &req, &total_len);\n+\n \tif (rc)\n \t\treturn rc;\n \n@@ -1766,12 +1763,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \treq->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);\n \n \tiov[0].iov_base = (char *)req;\n-\t/* 4 for rfc1002 length field */\n-\tiov[0].iov_len = get_rfc1002_length(req) + 4;\n \t/* -1 since last byte is buf[0] which is sent below (path) */\n-\tiov[0].iov_len--;\n+\tiov[0].iov_len = total_len - 1;\n \n-\treq->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req) - 4);\n+\treq->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req));\n \n \t/* [MS-SMB2] 2.2.13 NameOffset:\n \t * If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of\n@@ -1784,7 +1779,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \tif (tcon->share_flags & SHI1005_FLAGS_DFS) {\n \t\tint name_len;\n \n-\t\treq->hdr.sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;\n+\t\treq->sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;\n \t\trc = alloc_path_with_tree_prefix(&copy_path, &copy_size,\n \t\t\t\t\t\t &name_len,\n \t\t\t\t\t\t tcon->treeName, path);\n@@ -1811,8 +1806,6 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \n \tiov[1].iov_len = uni_path_len;\n \tiov[1].iov_base = path;\n-\t/* -1 since last byte is buf[0] which was counted in smb2_buf_len */\n-\tinc_rfc1001_len(req, uni_path_len - 1);\n \n \tif (!server->oplocks)\n \t\t*oplock = SMB2_OPLOCK_LEVEL_NONE;\n@@ -1850,7 +1843,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,\n \t\tdhc_buf = iov[n_iov-1].iov_base;\n \t}\n \n-\trc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov);\n+\trc = SendReceive3(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov);\n \tcifs_small_buf_release(req);\n \trsp = (struct smb2_create_rsp *)rsp_iov.iov_base;\n \ndiff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h\nindex 4f80b95d02ae..6e1874a81014 100644\n--- a/fs/cifs/smb2pdu.h\n+++ b/fs/cifs/smb2pdu.h\n@@ -496,7 +496,7 @@ struct smb2_tree_disconnect_rsp {\n #define SVHDX_OPEN_DEVICE_CONTEXT\t0x83CE6F1AD851E0986E34401CC9BCFCE9\n \n struct smb2_create_req {\n-\tstruct smb2_hdr hdr;\n+\tstruct smb2_sync_hdr sync_hdr;\n \t__le16 StructureSize;\t/* Must be 57 */\n \t__u8   SecurityFlags;\n \t__u8   RequestedOplockLevel;\n","prefixes":["10/19"]}