Whamcloud - gitweb
LU-3534 ptlrpc: mbits is sent within ptlrpc_body
[fs/lustre-release.git] / lustre / ptlrpc / sec_plain.c
index 4ed546a..94b924a 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -47,6 +47,8 @@
 #include <lustre_net.h>
 #include <lustre_sec.h>
 
+#include "ptlrpc_internal.h"
+
 struct plain_sec {
         struct ptlrpc_sec       pls_base;
        rwlock_t            pls_lock;
@@ -157,14 +159,16 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
        char           *ptr;
        unsigned int    off, i;
 
+       LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type));
+
        for (i = 0; i < desc->bd_iov_count; i++) {
-               if (desc->bd_iov[i].kiov_len == 0)
+               if (BD_GET_KIOV(desc, i).kiov_len == 0)
                        continue;
 
-               ptr = kmap(desc->bd_iov[i].kiov_page);
-               off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+               ptr = kmap(BD_GET_KIOV(desc, i).kiov_page);
+               off = BD_GET_KIOV(desc, i).kiov_offset & ~PAGE_MASK;
                ptr[off] ^= 0x1;
-               kunmap(desc->bd_iov[i].kiov_page);
+               kunmap(BD_GET_KIOV(desc, i).kiov_page);
                return;
        }
 }
@@ -339,6 +343,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
         int                          rc;
         int                          i, nob;
 
+       LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type));
         LASSERT(req->rq_pack_bulk);
         LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
         LASSERT(req->rq_repdata->lm_bufcount == PLAIN_PACK_SEGMENTS);
@@ -352,14 +357,15 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                 return 0;
         }
 
-        /* fix the actual data size */
-        for (i = 0, nob = 0; i < desc->bd_iov_count; i++) {
-                if (desc->bd_iov[i].kiov_len + nob > desc->bd_nob_transferred) {
-                        desc->bd_iov[i].kiov_len =
-                                desc->bd_nob_transferred - nob;
-                }
-                nob += desc->bd_iov[i].kiov_len;
-        }
+       /* fix the actual data size */
+       for (i = 0, nob = 0; i < desc->bd_iov_count; i++) {
+               if (BD_GET_KIOV(desc, i).kiov_len +
+                   nob > desc->bd_nob_transferred) {
+                       BD_GET_KIOV(desc, i).kiov_len =
+                               desc->bd_nob_transferred - nob;
+               }
+               nob += BD_GET_KIOV(desc, i).kiov_len;
+       }
 
         rc = plain_verify_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg,
                                     tokenv);
@@ -891,7 +897,7 @@ int plain_authorize(struct ptlrpc_request *req)
                        lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0),
                        lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF),
                        NULL, 0, (unsigned char *)&msg->lm_cksum, &hsize);
-                       req->rq_reply_off = 0;
+               req->rq_reply_off = 0;
         }
 
         RETURN(0);