From patchwork Tue Dec 6 22:02:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovskiy X-Patchwork-Id: 9463335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B802B60231 for ; Tue, 6 Dec 2016 22:18:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9F9D284F0 for ; Tue, 6 Dec 2016 22:18:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EB1F284F4; Tue, 6 Dec 2016 22:18:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1983D284F0 for ; Tue, 6 Dec 2016 22:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752296AbcLFWSF (ORCPT ); Tue, 6 Dec 2016 17:18:05 -0500 Received: from mail-bn3nam01on0120.outbound.protection.outlook.com ([104.47.33.120]:2512 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752291AbcLFWSE (ORCPT ); Tue, 6 Dec 2016 17:18:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HYak8vX11ppvB8zBZm7azen2jBqx6s0aYoLYfJF2dAQ=; b=OEqPweESpq9joY00BP5P04kDiirlkCmDURk4NawTo4P3Pq2w6IwHSw99J5Pybz1AzNIMM6Nr4Sj1LuJbPkL0+Z5jyIz/oHWUf4Ip33OdTsHLyKwBCxox5STzAB5U0zy+Tk48GxWaqv4kTSS8cnaiNHv6dxg/IGekN3B9GIaunQk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pshilov@microsoft.com; Received: from ubuntu-vm.corp.microsoft.com (2001:4898:80e8:2::63b) by CY4PR03MB2549.namprd03.prod.outlook.com (10.173.41.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Tue, 6 Dec 2016 22:02:46 +0000 From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 03/15] CIFS: Make send_cancel take rqst as argument Date: Tue, 6 Dec 2016 14:02:26 -0800 Message-Id: <1481061758-52020-4-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481061758-52020-1-git-send-email-pshilov@microsoft.com> References: <1481061758-52020-1-git-send-email-pshilov@microsoft.com> MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:2::63b] X-ClientProxiedBy: CY1PR17CA0004.namprd17.prod.outlook.com (10.163.68.14) To CY4PR03MB2549.namprd03.prod.outlook.com (10.173.41.148) X-MS-Office365-Filtering-Correlation-Id: eeaf3115-cbcb-4db0-af42-08d41e239cc4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY4PR03MB2549; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 3:PLLNJmGMnGPhHePOSoNnLZvpzDrYwlGLj+k/PNVSfy6HPdJhTBpregJxJb2+c0uYESpJq3MM1BDM5vrUQ63rJfDmDvv09kS7jjHW2jcHp9CwOJQevS3dNOoj7jZkuw6unUQwyj4QpabsqP9pPHfa9BM9hCWC7Xsk+cHENYH7cqyKiRJ2+v0qmE3J7pZY0b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CxUdtPH1HIW6INwOlJ7lxTkZ6DvI6kf6Sqdpx5ww86NeX0Si7SsEnKOSYn+r/4JItpFjqmMOX3Qkg0u5PRFj0Nbvczcp9LBfLWTqRDCFt9WY0POg0XuX3hP7Vr70BCuVXeKCaVMrzqFobHFX6lQoZM7247gXim5dv3LU3j6PIL0a5RdKDxKxHY=; 20:lepojmnH/Lxn+Uofdm3/sM3QYwpRJR/CG2EtkulcHskgHmNaxVneqYwfay+hOIKhkfCYQc911MfnKOf+YTOD0l/dlDDTGzq5PAhZOjNjwV5finLz3rdYy1Y4ALYulfGjd0qI14lMDgn1uKXBXsAKP3AZK/VBhXKgb0OlYdpcBGTWXxEtecAsDqcEBav40ZX3OCuY8N7N0/UM6C7oj97O1JA+r/e86LWoIsmCPZmQ+kjKF1vHeS03CUJk7OhY0yE4zmkLjwZ/Le1WMHw+jTPi99COyd3ZgCBigXhWb8J1VRVZvDymgJ3d49Q3bi+oLoyInY2dSjK7Li19P1JXxeykbEWy0YdnM3BlcuAh3sjDI2l8nbEolteaKw+gO8NPYym6J37Fkw/0cEKULXP2/q7Ip9BE5uVYVVEeWH27D/VbNOgWqmRtAf21vh9SXLlhzmR+WncxGQN0j/vm/pAmwbynlgckvDKTF7BbPy9IfA8VqiRvw8+w78ZvYlFNPkvLlDU4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6047074)(6072148); SRVR:CY4PR03MB2549; BCL:0; PCL:0; RULEID:; SRVR:CY4PR03MB2549; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 4:78si4inRmfQofqJksSlpU6QO3iH6duGf+oAyq1QeENF1HKfsJ65xrlhC30dFY4preCP3oQfu2hLUkQbcfA4QrAXIlqFqxjw6gbX9W6c+1mmCbkJUt3cceTlcF/JJuCpHS5zdbiKtHZFMMl4rOaP/oA2ixjUUfeYcRMuqTPada6qgcTjapWDG6TXYNB9i3gJBU5UfHphF3szlDlXNLhagJY6zdSBea0fLuK4oDW1kob7fue6CsymviC/2+2oM+kgGpX42Ugeqg+yfg+BUeKKvVjgerppBCvPC+WsXx+An91sLQiD+Eu4TLvaGGcBU2mSJM40UiF0e91vkp/2wtfv2aM4e6a94ksbkf9HlpTIxeHBk2CqZs9Un3A4g7p9MHPwBQKi1wuzQ5pKDctjsADJmzpqWEc98pjH3s3yZfiwNBZgFwlqpZSlTpyLQJs+xofado6U6wqy79Lf09OOkvWfjNaCtIpWhUZWI5tpehhqJYIBDvra5kC9US+TXC4mkgn0KHilwXBy9/x1IWotxMwDKg4PkmPWovzvJoCzQtv06u5Y19dUFZiJpPDXHrV5SVfE+JWIsdBuOSHVwZGplteJDsiTLHx4Ns5MvdGWFhhXmZmfCpBq8Y0q4XmuCQgqte6qNVmFER+jLPiPuSUtMNfFWXEN4kAICXfEx3WxyLeWCSPc= X-Forefront-PRVS: 01480965DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(50466002)(92566002)(101416001)(86362001)(33646002)(47776003)(48376002)(2950100002)(6916009)(106356001)(105586002)(6666003)(50986999)(42186005)(39860400001)(39850400001)(39840400001)(86612001)(76176999)(2361001)(110136003)(2351001)(450100001)(189998001)(5660300001)(10090500001)(5003940100001)(10290500002)(38730400001)(5005710100001)(8676002)(6116002)(36756003)(107886002)(39410400001)(733004)(7846002)(2906002)(39450400002)(6486002)(7736002)(50226002)(68736007)(305945005)(81156014)(97736004)(81166006); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR03MB2549; H:ubuntu-vm.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2549; 23:ulCLep4Z2oe2yJIxzdxRS4G47s5YA+3y2osgO0Kfm?= =?us-ascii?Q?LRRAWnLMGtSRVkCKo1/V9HzktY32fLNB5m4HySgS7eBB93KJGS94E0YwGk9G?= =?us-ascii?Q?idYiEo5JCT2xn+gcDOxweoawigFAjfh7RQKwqqG+EifOT7z8kjw9F38H4j/o?= =?us-ascii?Q?/qQd8D9ZKfZPflSWsljaNpmK4OCPZy+vYuVadq+ya7JUsuTiSgRgnGZOwe1v?= =?us-ascii?Q?aXAbpfc4fSDpOMgXIKx6+xker23VMIucd7D7MvRKPxIM/tl8tGk8M3SVThHP?= =?us-ascii?Q?UpqGZv3gk/VNZYwvoQYvxInGUe5P0oOegpmCyGFjTsZCtz6t20LV2p8WiAqS?= =?us-ascii?Q?zMBotVktXVeG85GQqB3Tsew/iAN5K37vD4r5Y5+yj7yLaF1afr3ApP4OsXve?= =?us-ascii?Q?LPakiiHqjwd7PBhC1I+eU3po8D+vPVqQHqTywyeLxavbzkB/H0aR/7i7unPh?= =?us-ascii?Q?DWu8RY+9foDcG95shwlreJCy/JqwPEW0iTVE+FsY8hOZY7QtcQD43jvaz5Uz?= =?us-ascii?Q?NpIKblfph6GJtVLxMNfeHe2IQ+9MNe6YbsGKQQTkhft4viZf+TnWbjIMwdZA?= =?us-ascii?Q?qWLu0irMIiLh+Tu9+UqHqIVuc81i50o5K++cf/aMamohsCpzpsSy/VbffaOk?= =?us-ascii?Q?H8/A3pYiaxNWRJdiLjNy5Qfad7q5IJTN8jNRXhw6azGT2D66ukBmCfMhwoyW?= =?us-ascii?Q?7hS63IvJ3SRiBlPmBt1JReGSgSJgD4roWTGGokuUjBpNiS0xs+K29paIR6hV?= =?us-ascii?Q?efYAlXSJEB55VMf3DPS17oI+oYtsD6DwVTF2Qv8znmY59+oE+kk42PtFoMKx?= =?us-ascii?Q?jTr5FmdvAL3rXlS8BxbLedxM8CaacjQNPcMrZGKe00/xAiv+NKclX7qIMN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fHE662AxxdmmMVGhaOsUCBDqNWXx4YokI6jf3aeOop67geORKiX1kBOsOuYN1Bw/fR8Y/0G2r4Q549r2GjeJjwoV7C3/RBwcWa1j5w9N52/1UbEXZPpqyyMD+tmGAZMvpR8HHyEqN7sbNA=; 24:41+JqJ4eR1eWUKWSeCQonlnqz/FeCRILqoJeSawoxcrY7PlW4pvE5rRvyID3G13dWC6l41zpAbfvha1AeEKsOo8aAXXpP8IDxDOJeMvNDVQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2549; 7:f2Azhw4xFj3zG9nx+XW1UH6Mvin7l5GLLjLVXwB8+gyYGcq7RFpabcWTKKvEFrWxRdGIjlAb7k9Uf9sRjKeobmLHnbyY9yLAE4hTw3j0/HCOtje0PCrLZ0bZxT/NhdGcKeJYO5lkB350694tAP7NAkU23cKX5cNZWeUgRy5tpbsSxVycDpuLSk+1M65z+G96ej6esl2B8PCh12dwyy19CDOZO08zCf+Xoxdq95WfA8CfOhViHyat3jr1L548v5mG9PqEJPvLHVQLj0pnjzqEhFOWLlJYvD1jcDlqgqFxcIjVjYPgun49ZWeVNtOyGCCPO3VF0RTzarp0FsTdiHgDODNIkwQOMM/MJCx8l3am5wbTEX2cQVfGLQA91Dza0h236fFS9d6d7ay/KWWqKc+sj4n+3l/H4BbYkxR1DaFRk+6mj/PxFBoSOlG3Tj5rG536Jps/6AVmQcaPfx2UKQENtg== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2016 22:02:46.8046 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2549 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsglob.h | 2 +- fs/cifs/smb1ops.c | 4 ++-- fs/cifs/transport.c | 33 +++++++++++++++++++-------------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 59ab5a2..4f4fffd 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -208,7 +208,7 @@ struct cifsInodeInfo; struct cifs_open_parms; struct smb_version_operations { - int (*send_cancel)(struct TCP_Server_Info *, void *, + int (*send_cancel)(struct TCP_Server_Info *, struct smb_rqst *, struct mid_q_entry *); bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *); /* setup request: allocate mid, sign message */ diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index fc537c2..67a987e 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -36,11 +36,11 @@ * SMB_COM_NT_CANCEL request and then sends it. */ static int -send_nt_cancel(struct TCP_Server_Info *server, void *buf, +send_nt_cancel(struct TCP_Server_Info *server, struct smb_rqst *rqst, struct mid_q_entry *mid) { int rc = 0; - struct smb_hdr *in_buf = (struct smb_hdr *)buf; + struct smb_hdr *in_buf = (struct smb_hdr *)rqst->rq_iov[0].iov_base; /* -4 for RFC1001 length and +2 for BCC field */ in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2); diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index b9fad50..d59ebd0 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -595,10 +595,11 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) } static inline int -send_cancel(struct TCP_Server_Info *server, void *buf, struct mid_q_entry *mid) +send_cancel(struct TCP_Server_Info *server, struct smb_rqst *rqst, + struct mid_q_entry *mid) { return server->ops->send_cancel ? - server->ops->send_cancel(server, buf, mid) : 0; + server->ops->send_cancel(server, rqst, mid) : 0; } int @@ -718,7 +719,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, rc = wait_for_response(ses->server, midQ); if (rc != 0) { - send_cancel(ses->server, buf, midQ); + send_cancel(ses->server, &rqst, midQ); spin_lock(&GlobalMid_Lock); if (midQ->mid_state == MID_REQUEST_SUBMITTED) { midQ->callback = DeleteMidQEntry; @@ -771,6 +772,9 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, { int rc = 0; struct mid_q_entry *midQ; + unsigned int len = be32_to_cpu(in_buf->smb_buf_length); + struct kvec iov = { .iov_base = in_buf, .iov_len = len }; + struct smb_rqst rqst = { .rq_iov = &iov, .rq_nvec = 1 }; if (ses == NULL) { cifs_dbg(VFS, "Null smb session\n"); @@ -788,10 +792,9 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, to the same server. We may make this configurable later or use ses->maxReq */ - if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize + - MAX_CIFS_HDR_SIZE - 4) { + if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { cifs_dbg(VFS, "Illegal length, greater than maximum frame, %d\n", - be32_to_cpu(in_buf->smb_buf_length)); + len); return -EIO; } @@ -822,7 +825,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, midQ->mid_state = MID_REQUEST_SUBMITTED; cifs_in_send_inc(ses->server); - rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); + rc = smb_send(ses->server, in_buf, len); cifs_in_send_dec(ses->server); cifs_save_when_sent(midQ); @@ -839,7 +842,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, rc = wait_for_response(ses->server, midQ); if (rc != 0) { - send_cancel(ses->server, in_buf, midQ); + send_cancel(ses->server, &rqst, midQ); spin_lock(&GlobalMid_Lock); if (midQ->mid_state == MID_REQUEST_SUBMITTED) { /* no longer considered to be "in-flight" */ @@ -908,6 +911,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, int rstart = 0; struct mid_q_entry *midQ; struct cifs_ses *ses; + unsigned int len = be32_to_cpu(in_buf->smb_buf_length); + struct kvec iov = { .iov_base = in_buf, .iov_len = len }; + struct smb_rqst rqst = { .rq_iov = &iov, .rq_nvec = 1 }; if (tcon == NULL || tcon->ses == NULL) { cifs_dbg(VFS, "Null smb session\n"); @@ -927,10 +933,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, to the same server. We may make this configurable later or use ses->maxReq */ - if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize + - MAX_CIFS_HDR_SIZE - 4) { + if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { cifs_dbg(VFS, "Illegal length, greater than maximum frame, %d\n", - be32_to_cpu(in_buf->smb_buf_length)); + len); return -EIO; } @@ -959,7 +964,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, midQ->mid_state = MID_REQUEST_SUBMITTED; cifs_in_send_inc(ses->server); - rc = smb_send(ses->server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); + rc = smb_send(ses->server, in_buf, len); cifs_in_send_dec(ses->server); cifs_save_when_sent(midQ); @@ -988,7 +993,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, if (in_buf->Command == SMB_COM_TRANSACTION2) { /* POSIX lock. We send a NT_CANCEL SMB to cause the blocking lock to return. */ - rc = send_cancel(ses->server, in_buf, midQ); + rc = send_cancel(ses->server, &rqst, midQ); if (rc) { cifs_delete_mid(midQ); return rc; @@ -1009,7 +1014,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, rc = wait_for_response(ses->server, midQ); if (rc) { - send_cancel(ses->server, in_buf, midQ); + send_cancel(ses->server, &rqst, midQ); spin_lock(&GlobalMid_Lock); if (midQ->mid_state == MID_REQUEST_SUBMITTED) { /* no longer considered to be "in-flight" */