From ee8630b585a1bbd650dd2c4fec61f30370bdb17c Mon Sep 17 00:00:00 2001
From: shadow <shadow>
Date: Mon, 19 May 2008 07:23:33 +0000
Subject: [PATCH] remove ptlrpc msg v1. b=14523 i=adilger i=eric.mei

---
 lustre/autoconf/lustre-version.ac  |   4 +-
 lustre/include/lustre/lustre_idl.h |  18 --
 lustre/include/lustre_net.h        |   4 -
 lustre/ldlm/ldlm_lib.c             |  10 +-
 lustre/ptlrpc/layout.c             |   3 -
 lustre/ptlrpc/pack_generic.c       | 410 +----------------------------
 lustre/ptlrpc/sec.c                |  87 +++---
 lustre/ptlrpc/sec_null.c           |  17 +-
 lustre/ptlrpc/wirehdr.c            |  18 ++
 lustre/ptlrpc/wiretest.c           | 155 +++++------
 lustre/utils/wirecheck.c           |  24 --
 lustre/utils/wiretest.c            | 164 ++++--------
 12 files changed, 182 insertions(+), 732 deletions(-)

diff --git a/lustre/autoconf/lustre-version.ac b/lustre/autoconf/lustre-version.ac
index 556fb9dd07..b4a2135b84 100644
--- a/lustre/autoconf/lustre-version.ac
+++ b/lustre/autoconf/lustre-version.ac
@@ -1,6 +1,6 @@
 m4_define([LUSTRE_MAJOR],[1])
-m4_define([LUSTRE_MINOR],[7])
-m4_define([LUSTRE_PATCH],[91])
+m4_define([LUSTRE_MINOR],[9])
+m4_define([LUSTRE_PATCH],[50])
 m4_define([LUSTRE_FIX],[0])
 
 dnl # liblustre delta is 0.0.1.32 , next version with fixes is ok, but
diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h
index 9ad76d44db..af095e1291 100644
--- a/lustre/include/lustre/lustre_idl.h
+++ b/lustre/include/lustre/lustre_idl.h
@@ -416,24 +416,6 @@ static inline void lustre_handle_copy(struct lustre_handle *tgt,
         tgt->cookie = src->cookie;
 }
 
-/* we depend on this structure to be 8-byte aligned */
-/* this type is only endian-adjusted in lustre_unpack_msg() */
-struct lustre_msg_v1 {
-        struct lustre_handle lm_handle;
-        __u32 lm_magic;
-        __u32 lm_type;
-        __u32 lm_version;
-        __u32 lm_opc;
-        __u64 lm_last_xid;
-        __u64 lm_last_committed;
-        __u64 lm_transno;
-        __u32 lm_status;
-        __u32 lm_flags;
-        __u32 lm_conn_cnt;
-        __u32 lm_bufcount;
-        __u32 lm_buflens[0];
-};
-
 #define lustre_msg lustre_msg_v2
 /* we depend on this structure to be 8-byte aligned */
 /* this type is only endian-adjusted in lustre_unpack_msg() */
diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h
index f146ba418c..30204b7be5 100644
--- a/lustre/include/lustre_net.h
+++ b/lustre/include/lustre_net.h
@@ -889,7 +889,6 @@ int lustre_msg_size(__u32 magic, int count, int *lengths);
 int lustre_msg_size_v2(int count, int *lengths);
 int lustre_packed_msg_size(struct lustre_msg *msg);
 int lustre_unpack_msg(struct lustre_msg *m, int len);
-void *lustre_msg_buf_v1(void *msg, int n, int min_size);
 void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size);
 void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen);
 int lustre_msg_buflen(struct lustre_msg *m, int n);
@@ -967,9 +966,6 @@ static inline __u32 lustre_request_magic(struct ptlrpc_request *req)
 static inline int ptlrpc_req_get_repsize(struct ptlrpc_request *req)
 {
         switch (req->rq_reqmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                CERROR("function not supported for lustre_msg V1!\n");
-                return -ENOTSUPP;
         case LUSTRE_MSG_MAGIC_V2:
                 return req->rq_reqmsg->lm_repsize;
         default:
diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c
index 3a93ff96b3..2988abe9d0 100644
--- a/lustre/ldlm/ldlm_lib.c
+++ b/lustre/ldlm/ldlm_lib.c
@@ -955,15 +955,7 @@ dont_check_exports:
         revimp->imp_remote_handle = conn;
         revimp->imp_dlm_fake = 1;
         revimp->imp_state = LUSTRE_IMP_FULL;
-
-        if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V1 &&
-            lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_NEXT_VER) {
-                revimp->imp_msg_magic = LUSTRE_MSG_MAGIC_V2;
-                lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_NEXT_VER);
-        } else {
-                /* unknown magic has been filtered out by unpack */
-                revimp->imp_msg_magic = req->rq_reqmsg->lm_magic;
-        }
+        revimp->imp_msg_magic = req->rq_reqmsg->lm_magic;
 
         rc = sptlrpc_import_sec_adapt(revimp, req->rq_svc_ctx,
                                       req->rq_flvr.sf_rpc);
diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c
index 06b270fe7e..32f3427134 100644
--- a/lustre/ptlrpc/layout.c
+++ b/lustre/ptlrpc/layout.c
@@ -1468,9 +1468,6 @@ int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
         if (size < 0)
                 return size;
 
-        if (magic == LUSTRE_MSG_MAGIC_V1)
-                i++;
-
         for (; i < fmt->rf_fields[loc].nr; ++i)
                 if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
                         size += size_round(fmt->rf_fields[loc].d[i]->rmf_size);
diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c
index d222812dbd..19f66f5313 100644
--- a/lustre/ptlrpc/pack_generic.c
+++ b/lustre/ptlrpc/pack_generic.c
@@ -39,17 +39,6 @@
 #include <obd_class.h>
 #include <lustre_net.h>
 
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(1,8,0,0)
-#error "lustre_msg_v1 has been deprecated since 1.6.0, please remove it"
-#elif LUSTRE_VERSION_CODE > OBD_OCD_VERSION(1,6,50,0)
-#warning "lustre_msg_v1 has been deprecated since 1.6.0, consider removing it"
-#endif
-
-static inline int lustre_msg_hdr_size_v1(int count)
-{
-        return size_round(offsetof(struct lustre_msg_v1, lm_buflens[count]));
-}
-
 static inline int lustre_msg_hdr_size_v2(int count)
 {
         return size_round(offsetof(struct lustre_msg_v2, lm_buflens[count]));
@@ -58,8 +47,6 @@ static inline int lustre_msg_hdr_size_v2(int count)
 int lustre_msg_hdr_size(__u32 magic, int count)
 {
         switch (magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                return lustre_msg_hdr_size_v1(count - 1);
         case LUSTRE_MSG_MAGIC_V2:
                 return lustre_msg_hdr_size_v2(count);
         default:
@@ -71,8 +58,7 @@ EXPORT_SYMBOL(lustre_msg_hdr_size);
 
 int lustre_msg_swabbed(struct lustre_msg *msg)
 {
-        return (msg->lm_magic == LUSTRE_MSG_MAGIC_V1_SWABBED) ||
-               (msg->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED);
+        return (msg->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED);
 }
 
 static inline int
@@ -87,7 +73,8 @@ int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
         switch (msg->lm_magic) {
         case LUSTRE_MSG_MAGIC_V1:
         case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 0;
+                CERROR("msg v1 not supported - please upgrade you system\n");
+                return -EINVAL; 
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return lustre_msg_check_version_v2(msg, version);
@@ -97,19 +84,6 @@ int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
         }
 }
 
-static inline int lustre_msg_size_v1(int count, int *lengths)
-{
-        int size;
-        int i;
-
-        LASSERT(count >= 0);
-        size = lustre_msg_hdr_size_v1(count);
-        for (i = 0; i < count; i++)
-                size += size_round(lengths[i]);
-
-        return size;
-}
-
 int lustre_msg_size_v2(int count, int *lengths)
 {
         int size;
@@ -142,8 +116,6 @@ int lustre_msg_size(__u32 magic, int count, int *lens)
         LASSERT(lens[MSG_PTLRPC_BODY_OFF] == sizeof(struct ptlrpc_body));
 
         switch (magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                return lustre_msg_size_v1(count - 1, lens + 1);
         case LUSTRE_MSG_MAGIC_V2:
                 return lustre_msg_size_v2(count, lens);
         default:
@@ -157,11 +129,6 @@ int lustre_msg_size(__u32 magic, int count, int *lens)
 int lustre_packed_msg_size(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1: {
-                struct lustre_msg_v1 *v1_msg = (struct lustre_msg_v1 *)msg;
-                return lustre_msg_size_v1(v1_msg->lm_bufcount,
-                                          v1_msg->lm_buflens);
-        }
         case LUSTRE_MSG_MAGIC_V2:
                 return lustre_msg_size_v2(msg->lm_bufcount, msg->lm_buflens);
         default:
@@ -170,31 +137,6 @@ int lustre_packed_msg_size(struct lustre_msg *msg)
         }
 }
 
-static
-void lustre_init_msg_v1(void *m, int count, int *lens, char **bufs)
-{
-        struct lustre_msg_v1 *msg = (struct lustre_msg_v1 *)m;
-        char *ptr;
-        int i;
-
-        LASSERT(count >= 0);
-        msg->lm_magic = LUSTRE_MSG_MAGIC_V1;
-        msg->lm_version = PTLRPC_MSG_VERSION;
-        msg->lm_bufcount = count;
-
-        for (i = 0; i < count; i++)
-                msg->lm_buflens[i] = lens[i];
-
-        if (bufs == NULL)
-                return;
-
-        ptr = (char *)msg + lustre_msg_hdr_size_v1(count);
-        for (i = 0; i < count; i++) {
-                char *tmp = bufs[i];
-                LOGL(tmp, lens[i], ptr);
-        }
-}
-
 void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, int *lens,
                         char **bufs)
 {
@@ -219,23 +161,6 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, int *lens,
 }
 EXPORT_SYMBOL(lustre_init_msg_v2);
 
-static int lustre_pack_request_v1(struct ptlrpc_request *req,
-                                  int count, int *lens, char **bufs)
-{
-        int reqlen, rc;
-
-        reqlen = lustre_msg_size_v1(count, lens);
-
-        rc = sptlrpc_cli_alloc_reqbuf(req, reqlen);
-        if (rc)
-                return rc;
-
-        req->rq_reqlen = reqlen;
-
-        lustre_init_msg_v1(req->rq_reqmsg, count, lens, bufs);
-        return 0;
-}
-
 static int lustre_pack_request_v2(struct ptlrpc_request *req,
                                   int count, int *lens, char **bufs)
 {
@@ -272,9 +197,6 @@ int lustre_pack_request(struct ptlrpc_request *req, __u32 magic, int count,
         magic = LUSTRE_MSG_MAGIC_V2;
 
         switch (magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                return lustre_pack_request_v1(req, count - 1, lens + 1,
-                                              bufs ? bufs + 1 : NULL);
         case LUSTRE_MSG_MAGIC_V2:
                 return lustre_pack_request_v2(req, count, lens, bufs);
         default:
@@ -349,38 +271,6 @@ void lustre_put_emerg_rs(struct ptlrpc_reply_state *rs)
         cfs_waitq_signal(&svc->srv_free_rs_waitq);
 }
 
-static int lustre_pack_reply_v1(struct ptlrpc_request *req, int count,
-                                int *lens, char **bufs)
-{
-        struct ptlrpc_reply_state *rs;
-        int                        msg_len, rc;
-        ENTRY;
-
-        LASSERT (req->rq_reply_state == NULL);
-
-        msg_len = lustre_msg_size_v1(count, lens);
-        rc = sptlrpc_svc_alloc_rs(req, msg_len);
-        if (rc)
-                RETURN(rc);
-
-        rs = req->rq_reply_state;
-        atomic_set(&rs->rs_refcount, 1);        /* 1 ref for rq_reply_state */
-        rs->rs_cb_id.cbid_fn = reply_out_callback;
-        rs->rs_cb_id.cbid_arg = rs;
-        rs->rs_service = req->rq_rqbd->rqbd_service;
-        CFS_INIT_LIST_HEAD(&rs->rs_exp_list);
-        CFS_INIT_LIST_HEAD(&rs->rs_obd_list);
-
-        req->rq_replen = msg_len;
-        req->rq_reply_state = rs;
-        req->rq_repmsg = rs->rs_msg;
-        lustre_init_msg_v1(rs->rs_msg, count, lens, bufs);
-
-        PTLRPC_RS_DEBUG_LRU_ADD(rs);
-
-        RETURN (0);
-}
-
 int lustre_pack_reply_v2(struct ptlrpc_request *req, int count,
                          int *lens, char **bufs)
 {
@@ -431,11 +321,6 @@ int lustre_pack_reply(struct ptlrpc_request *req, int count, int *lens,
         LASSERT(lens[MSG_PTLRPC_BODY_OFF] == sizeof(struct ptlrpc_body));
 
         switch (req->rq_reqmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                rc = lustre_pack_reply_v1(req, count - 1, lens + 1,
-                                          bufs ? bufs + 1 : NULL);
-                break;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 rc = lustre_pack_reply_v2(req, count, lens, bufs);
@@ -451,36 +336,6 @@ int lustre_pack_reply(struct ptlrpc_request *req, int count, int *lens,
         return rc;
 }
 
-void *lustre_msg_buf_v1(void *msg, int n, int min_size)
-{
-        struct lustre_msg_v1 *m = (struct lustre_msg_v1 *)msg;
-        int i, offset, buflen, bufcount;
-
-        LASSERT(m != NULL);
-        LASSERT(n >= 0);
-
-        bufcount = m->lm_bufcount;
-        if (unlikely(n >= bufcount)) {
-                CDEBUG(D_INFO, "msg %p buffer[%d] not present (count %d)\n",
-                       m, n, bufcount);
-                return NULL;
-        }
-
-        buflen = m->lm_buflens[n];
-        if (unlikely(buflen < min_size)) {
-                CERROR("msg %p buffer[%d] size %d too small (required %d)\n",
-                       m, n, buflen, min_size);
-                LBUG();
-                return NULL;
-        }
-
-        offset = lustre_msg_hdr_size_v1(bufcount);
-        for (i = 0; i < n; i++)
-                offset += size_round(m->lm_buflens[i]);
-
-        return (char *)m + offset;
-}
-
 void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size)
 {
         int i, offset, buflen, bufcount;
@@ -512,9 +367,6 @@ void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size)
 void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size)
 {
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return lustre_msg_buf_v1(m, n - 1, min_size);
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return lustre_msg_buf_v2(m, n, min_size);
@@ -524,45 +376,6 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size)
         }
 }
 
-int lustre_shrink_msg_v1(struct lustre_msg_v1 *msg, int segment,
-                         unsigned int newlen, int move_data)
-{
-        char   *tail = NULL, *newpos;
-        int     tail_len = 0, n;
-
-        LASSERT(msg);
-        LASSERT(segment >= 0);
-        LASSERT(msg->lm_bufcount > segment);
-        LASSERT(msg->lm_buflens[segment] >= newlen);
-
-        if (msg->lm_buflens[segment] == newlen)
-                goto out;
-
-        if (move_data && msg->lm_bufcount > segment + 1) {
-                tail = lustre_msg_buf_v1(msg, segment + 1, 0);
-                for (n = segment + 1; n < msg->lm_bufcount; n++)
-                        tail_len += size_round(msg->lm_buflens[n]);
-        }
-
-        msg->lm_buflens[segment] = newlen;
-
-        if (tail && tail_len) {
-                newpos = lustre_msg_buf_v1(msg, segment + 1, 0);
-                LASSERT(newpos <= tail);
-                if (newpos != tail)
-                        memcpy(newpos, tail, tail_len);
-        }
-
-        if (newlen == 0 && msg->lm_bufcount > segment + 1) {
-                memmove(&msg->lm_buflens[segment], &msg->lm_buflens[segment + 1],
-                        (msg->lm_bufcount - segment - 1) * sizeof(__u32));
-                msg->lm_buflens[msg->lm_bufcount - 1] = 0;
-        }
-
-out:
-        return lustre_msg_size_v1(msg->lm_bufcount, (int *)msg->lm_buflens);
-}
-
 int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
                          unsigned int newlen, int move_data)
 {
@@ -614,9 +427,6 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment,
                       unsigned int newlen, int move_data)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                return lustre_shrink_msg_v1((struct lustre_msg_v1 *) msg,
-                                            segment - 1, newlen, move_data);
         case LUSTRE_MSG_MAGIC_V2:
                 return lustre_shrink_msg_v2(msg, segment, newlen, move_data);
         default:
@@ -640,65 +450,6 @@ void lustre_free_reply_state(struct ptlrpc_reply_state *rs)
         sptlrpc_svc_free_rs(rs);
 }
 
-int lustre_unpack_msg_v1(void *msg, int len)
-{
-        struct lustre_msg_v1 *m = (struct lustre_msg_v1 *)msg;
-        int flipped, required_len, i;
-        ENTRY;
-
-        /* Now we know the sender speaks my language. */
-        required_len = lustre_msg_hdr_size_v1(0);
-        if (len < required_len) {
-                /* can't even look inside the message */
-                CERROR("message length %d too small for lustre_msg\n", len);
-                RETURN(-EINVAL);
-        }
-
-        flipped = lustre_msg_swabbed((struct lustre_msg *)m);
-
-        if (flipped) {
-                __swab32s(&m->lm_type);
-                __swab32s(&m->lm_version);
-                __swab32s(&m->lm_opc);
-                __swab64s(&m->lm_last_xid);
-                __swab64s(&m->lm_last_committed);
-                __swab64s(&m->lm_transno);
-                __swab32s(&m->lm_status);
-                __swab32s(&m->lm_flags);
-                __swab32s(&m->lm_conn_cnt);
-                __swab32s(&m->lm_bufcount);
-        }
-
-        if (m->lm_version != PTLRPC_MSG_VERSION) {
-                CERROR("wrong lustre_msg version %08x\n", m->lm_version);
-                RETURN(-EINVAL);
-        }
-
-        required_len = lustre_msg_hdr_size_v1(m->lm_bufcount);
-        if (len < required_len) {
-                /* didn't receive all the buffer lengths */
-                CERROR("message length %d too small for %d buflens\n",
-                        len, m->lm_bufcount);
-                RETURN(-EINVAL);
-        }
-
-        for (i = 0; i < m->lm_bufcount; i++) {
-                if (flipped)
-                        __swab32s (&m->lm_buflens[i]);
-                required_len += size_round(m->lm_buflens[i]);
-        }
-
-        if (len < required_len) {
-                CERROR("len: %d, required_len %d\n", len, required_len);
-                CERROR("bufcount: %d\n", m->lm_bufcount);
-                for (i = 0; i < m->lm_bufcount; i++)
-                        CERROR("buffer %d length %d\n", i, m->lm_buflens[i]);
-                RETURN(-EINVAL);
-        }
-
-        RETURN(0);
-}
-
 static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len)
 {
         int flipped, required_len, i;
@@ -769,10 +520,6 @@ int lustre_unpack_msg(struct lustre_msg *m, int len)
         }
 
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                rc = lustre_unpack_msg_v1(m, len);
-                break;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 rc = lustre_unpack_msg_v2(m, len);
@@ -809,9 +556,6 @@ static inline int lustre_unpack_ptlrpc_body_v2(struct lustre_msg_v2 *m,
 int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset)
 {
         switch (req->rq_reqmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 0;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 lustre_set_req_swabbed(req, offset);
@@ -826,9 +570,6 @@ int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset)
 int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset)
 {
         switch (req->rq_repmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 0;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 lustre_set_rep_swabbed(req, offset);
@@ -840,17 +581,6 @@ int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset)
         }
 }
 
-static inline int lustre_msg_buflen_v1(void *msg, int n)
-{
-        struct lustre_msg_v1 *m = (struct lustre_msg_v1 *)msg;
-
-        LASSERT(n >= 0);
-        if (n >= m->lm_bufcount)
-                return 0;
-
-        return m->lm_buflens[n];
-}
-
 static inline int lustre_msg_buflen_v2(struct lustre_msg_v2 *m, int n)
 {
         if (n >= m->lm_bufcount)
@@ -869,9 +599,6 @@ static inline int lustre_msg_buflen_v2(struct lustre_msg_v2 *m, int n)
 int lustre_msg_buflen(struct lustre_msg *m, int n)
 {
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return lustre_msg_buflen_v1(m, n - 1);
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return lustre_msg_buflen_v2(m, n);
@@ -882,17 +609,6 @@ int lustre_msg_buflen(struct lustre_msg *m, int n)
 }
 EXPORT_SYMBOL(lustre_msg_buflen);
 
-static inline void lustre_msg_set_buflen_v1(void *msg, int n, int len)
-{
-        struct lustre_msg_v1 *m = (struct lustre_msg_v1 *)msg;
-
-        LASSERT(n >= 0);
-        if (n >= m->lm_bufcount)
-                LBUG();
-
-        m->lm_buflens[n] = len;
-}
-
 static inline void
 lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len)
 {
@@ -905,9 +621,6 @@ lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len)
 void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len)
 {
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                lustre_msg_set_buflen_v1(m, n - 1, len);
-                return;
         case LUSTRE_MSG_MAGIC_V2:
                 lustre_msg_set_buflen_v2(m, n, len);
                 return;
@@ -923,9 +636,6 @@ EXPORT_SYMBOL(lustre_msg_set_buflen);
 int lustre_msg_bufcount(struct lustre_msg *m)
 {
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)m)->lm_bufcount + 1;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return m->lm_bufcount;
@@ -943,11 +653,6 @@ char *lustre_msg_string(struct lustre_msg *m, int index, int max_len)
         int slen, blen;
 
         switch (m->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                str = lustre_msg_buf_v1(m, index - 1, 0);
-                blen = lustre_msg_buflen_v1(m, index - 1);
-                break;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 str = lustre_msg_buf_v2(m, index, 0);
@@ -994,10 +699,6 @@ void *lustre_swab_buf(struct lustre_msg *msg, int index, int min_size,
         void *ptr = NULL;
 
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                ptr = lustre_msg_buf_v1(msg, index - 1, min_size);
-                break;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 ptr = lustre_msg_buf_v2(msg, index, min_size);
@@ -1031,10 +732,6 @@ void *lustre_swab_repbuf(struct ptlrpc_request *req, int index, int min_size,
 __u32 lustre_msg_get_flags(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_flags &
-                       MSG_GEN_FLAG_MASK;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1056,10 +753,6 @@ __u32 lustre_msg_get_flags(struct lustre_msg *msg)
 void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_flags |=
-                                        MSG_GEN_FLAG_MASK & flags;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1076,11 +769,6 @@ void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
 void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_flags &= ~MSG_GEN_FLAG_MASK;
-                ((struct lustre_msg_v1 *)msg)->lm_flags |=
-                                        MSG_GEN_FLAG_MASK & flags;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1097,11 +785,6 @@ void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
 void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                ((struct lustre_msg_v1 *)msg)->lm_flags &=
-                                        ~(MSG_GEN_FLAG_MASK & flags);
-                return;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1119,10 +802,6 @@ void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
 __u32 lustre_msg_get_op_flags(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_flags >>
-                       MSG_OP_FLAG_SHIFT;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1142,10 +821,6 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg)
 void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_flags |=
-                        (flags & MSG_GEN_FLAG_MASK) << MSG_OP_FLAG_SHIFT;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1162,11 +837,6 @@ void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
 void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_flags &= ~MSG_OP_FLAG_MASK;
-                ((struct lustre_msg_v1 *)msg)->lm_flags |=
-                        ((flags & MSG_GEN_FLAG_MASK) <<MSG_OP_FLAG_SHIFT);
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1183,9 +853,6 @@ void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
 struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return &((struct lustre_msg_v1 *)msg)->lm_handle;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1206,9 +873,6 @@ struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg)
 __u32 lustre_msg_get_type(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_type;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1229,9 +893,6 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg)
 __u32 lustre_msg_get_version(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_version;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1252,9 +913,6 @@ __u32 lustre_msg_get_version(struct lustre_msg *msg)
 void lustre_msg_add_version(struct lustre_msg *msg, int version)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1272,9 +930,6 @@ void lustre_msg_add_version(struct lustre_msg *msg, int version)
 __u32 lustre_msg_get_opc(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_opc;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1295,9 +950,6 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg)
 __u64 lustre_msg_get_last_xid(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_last_xid;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1318,9 +970,6 @@ __u64 lustre_msg_get_last_xid(struct lustre_msg *msg)
 __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_last_committed;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1341,9 +990,6 @@ __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
 __u64 lustre_msg_get_transno(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_transno;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1364,9 +1010,6 @@ __u64 lustre_msg_get_transno(struct lustre_msg *msg)
 int lustre_msg_get_status(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_status;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1388,9 +1031,6 @@ int lustre_msg_get_status(struct lustre_msg *msg)
 __u64 lustre_msg_get_slv(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 1;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1412,9 +1052,6 @@ __u64 lustre_msg_get_slv(struct lustre_msg *msg)
 void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1436,9 +1073,6 @@ void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv)
 __u32 lustre_msg_get_limit(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 1;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1460,9 +1094,6 @@ __u32 lustre_msg_get_limit(struct lustre_msg *msg)
 void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1484,9 +1115,6 @@ void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit)
 __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return ((struct lustre_msg_v1 *)msg)->lm_conn_cnt;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED: {
                 struct ptlrpc_body *pb;
@@ -1507,8 +1135,6 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg)
 __u32 lustre_msg_get_magic(struct lustre_msg *msg)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return msg->lm_magic;
@@ -1521,9 +1147,6 @@ __u32 lustre_msg_get_magic(struct lustre_msg *msg)
 void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_handle = *handle;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1540,9 +1163,6 @@ void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle)
 void lustre_msg_set_type(struct lustre_msg *msg, __u32 type)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_type = type;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1559,9 +1179,6 @@ void lustre_msg_set_type(struct lustre_msg *msg, __u32 type)
 void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_opc = opc;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1578,9 +1195,6 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc)
 void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_last_xid = last_xid;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1597,9 +1211,6 @@ void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid)
 void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_last_committed=last_committed;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1616,9 +1227,6 @@ void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed)
 void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_transno = transno;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1635,9 +1243,6 @@ void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno)
 void lustre_msg_set_status(struct lustre_msg *msg, __u32 status)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_status = status;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -1654,9 +1259,6 @@ void lustre_msg_set_status(struct lustre_msg *msg, __u32 status)
 void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt)
 {
         switch (msg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-                ((struct lustre_msg_v1 *)msg)->lm_conn_cnt = conn_cnt;
-                return;
         case LUSTRE_MSG_MAGIC_V2: {
                 struct ptlrpc_body *pb;
 
@@ -2344,9 +1946,6 @@ static inline int req_ptlrpc_body_swabbed(struct ptlrpc_request *req)
         LASSERT(req->rq_reqmsg);
 
         switch (req->rq_reqmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 1;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return lustre_req_swabbed(req, MSG_PTLRPC_BODY_OFF);
@@ -2362,9 +1961,6 @@ static inline int rep_ptlrpc_body_swabbed(struct ptlrpc_request *req)
         LASSERT(req->rq_repmsg);
 
         switch (req->rq_repmsg->lm_magic) {
-        case LUSTRE_MSG_MAGIC_V1:
-        case LUSTRE_MSG_MAGIC_V1_SWABBED:
-                return 1;
         case LUSTRE_MSG_MAGIC_V2:
         case LUSTRE_MSG_MAGIC_V2_SWABBED:
                 return lustre_rep_swabbed(req, MSG_PTLRPC_BODY_OFF);
diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c
index f3247e457b..315d439c97 100644
--- a/lustre/ptlrpc/sec.c
+++ b/lustre/ptlrpc/sec.c
@@ -851,6 +851,7 @@ int sptlrpc_cli_unwrap_reply(struct ptlrpc_request *req)
 {
         struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
         int                    rc;
+        __u16                  rpc_flvr;
         ENTRY;
 
         LASSERT(ctx);
@@ -867,43 +868,29 @@ int sptlrpc_cli_unwrap_reply(struct ptlrpc_request *req)
         }
 
 
-        if (req->rq_repbuf->lm_magic == LUSTRE_MSG_MAGIC_V1 ||
-            req->rq_repbuf->lm_magic == LUSTRE_MSG_MAGIC_V1_SWABBED) {
-                /*
-                 * v1 message, it's must be null flavor, so our requets also
-                 * should be in null flavor
-                 */
-                if (RPC_FLVR_POLICY(req->rq_flvr.sf_rpc) !=
-                    SPTLRPC_POLICY_NULL) {
-                        CERROR("request was %s but reply with null\n",
-                               sptlrpc_rpcflavor2name(req->rq_flvr.sf_rpc));
-                        RETURN(-EPROTO);
-                }
-        } else {
-                /*
-                 * v2 message, check request/reply policy match
-                 */
-                __u16 rpc_flvr = WIRE_FLVR_RPC(req->rq_repbuf->lm_secflvr);
-
-                if (req->rq_repbuf->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED)
-                        __swab16s(&rpc_flvr);
+        /*
+         * v2 message, check request/reply policy match
+         */
+        rpc_flvr = WIRE_FLVR_RPC(req->rq_repbuf->lm_secflvr);
 
-                if (RPC_FLVR_POLICY(rpc_flvr) !=
-                    RPC_FLVR_POLICY(req->rq_flvr.sf_rpc)) {
-                        CERROR("request policy was %u while reply with %u\n",
-                               RPC_FLVR_POLICY(req->rq_flvr.sf_rpc),
-                               RPC_FLVR_POLICY(rpc_flvr));
-                        RETURN(-EPROTO);
-                }
+        if (req->rq_repbuf->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED)
+                __swab16s(&rpc_flvr);
 
-                /* do nothing if it's null policy; otherwise unpack the
-                 * wrapper message
-                 */
-                if (RPC_FLVR_POLICY(rpc_flvr) != SPTLRPC_POLICY_NULL &&
-                    lustre_unpack_msg(req->rq_repbuf, req->rq_nob_received))
-                        RETURN(-EPROTO);
+        if (RPC_FLVR_POLICY(rpc_flvr) !=
+                RPC_FLVR_POLICY(req->rq_flvr.sf_rpc)) {
+                CERROR("request policy was %u while reply with %u\n",
+                        RPC_FLVR_POLICY(req->rq_flvr.sf_rpc),
+                        RPC_FLVR_POLICY(rpc_flvr));
+                RETURN(-EPROTO);
         }
 
+        /* do nothing if it's null policy; otherwise unpack the
+         * wrapper message
+         */
+        if (RPC_FLVR_POLICY(rpc_flvr) != SPTLRPC_POLICY_NULL &&
+            lustre_unpack_msg(req->rq_repbuf, req->rq_nob_received))
+                RETURN(-EPROTO);
+
         switch (RPC_FLVR_SVC(req->rq_flvr.sf_rpc)) {
         case SPTLRPC_SVC_NULL:
         case SPTLRPC_SVC_AUTH:
@@ -1746,28 +1733,18 @@ int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
                 RETURN(SECSVC_DROP);
         }
 
-        if (msg->lm_magic == LUSTRE_MSG_MAGIC_V1 ||
-            msg->lm_magic == LUSTRE_MSG_MAGIC_V1_SWABBED) {
-                /*
-                 * v1 message, treat as to be null
-                 */
-                req->rq_flvr.sf_rpc = SPTLRPC_FLVR_NULL;
-        } else {
-                /*
-                 * v2 message.
-                 */
-                if (msg->lm_magic == LUSTRE_MSG_MAGIC_V2)
-                        req->rq_flvr.sf_rpc = WIRE_FLVR_RPC(msg->lm_secflvr);
-                else
-                        req->rq_flvr.sf_rpc = WIRE_FLVR_RPC(
-                                                __swab32(msg->lm_secflvr));
-
-                /* unpack the wrapper message if the policy is not null */
-                if ((RPC_FLVR_POLICY(req->rq_flvr.sf_rpc) !=
-                     SPTLRPC_POLICY_NULL) &&
-                    lustre_unpack_msg(msg, req->rq_reqdata_len))
-                        RETURN(SECSVC_DROP);
-        }
+        /*
+         * v2 message.
+         */
+        if (msg->lm_magic == LUSTRE_MSG_MAGIC_V2)
+                req->rq_flvr.sf_rpc = WIRE_FLVR_RPC(msg->lm_secflvr);
+        else
+                req->rq_flvr.sf_rpc = WIRE_FLVR_RPC(__swab32(msg->lm_secflvr));
+
+        /* unpack the wrapper message if the policy is not null */
+        if ((RPC_FLVR_POLICY(req->rq_flvr.sf_rpc) != SPTLRPC_POLICY_NULL) &&
+             lustre_unpack_msg(msg, req->rq_reqdata_len))
+                RETURN(SECSVC_DROP);
 
         policy = sptlrpc_rpcflavor2policy(req->rq_flvr.sf_rpc);
         if (!policy) {
diff --git a/lustre/ptlrpc/sec_null.c b/lustre/ptlrpc/sec_null.c
index 6cb5c8c726..59e24005d7 100644
--- a/lustre/ptlrpc/sec_null.c
+++ b/lustre/ptlrpc/sec_null.c
@@ -73,14 +73,12 @@ int null_ctx_refresh(struct ptlrpc_cli_ctx *ctx)
 static
 int null_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
 {
-        if (req->rq_reqbuf->lm_magic != LUSTRE_MSG_MAGIC_V1) {
-                req->rq_reqbuf->lm_secflvr = SPTLRPC_FLVR_NULL;
-
-                if (!req->rq_import->imp_dlm_fake) {
-                        struct obd_device *obd = req->rq_import->imp_obd;
-                        null_encode_sec_part(req->rq_reqbuf,
-                                             obd->u.cli.cl_sec_part);
-                }
+        req->rq_reqbuf->lm_secflvr = SPTLRPC_FLVR_NULL;
+
+        if (!req->rq_import->imp_dlm_fake) {
+                struct obd_device *obd = req->rq_import->imp_obd;
+                null_encode_sec_part(req->rq_reqbuf,
+                                     obd->u.cli.cl_sec_part);
         }
         req->rq_reqdata_len = req->rq_reqlen;
         return 0;
@@ -331,8 +329,7 @@ int null_authorize(struct ptlrpc_request *req)
         struct ptlrpc_reply_state *rs = req->rq_reply_state;
 
         LASSERT(rs);
-        if (rs->rs_repbuf->lm_magic != LUSTRE_MSG_MAGIC_V1)
-                rs->rs_repbuf->lm_secflvr = SPTLRPC_FLVR_NULL;
+        rs->rs_repbuf->lm_secflvr = SPTLRPC_FLVR_NULL;
         rs->rs_repdata_len = req->rq_replen;
         return 0;
 }
diff --git a/lustre/ptlrpc/wirehdr.c b/lustre/ptlrpc/wirehdr.c
index d287ba3214..a674953085 100644
--- a/lustre/ptlrpc/wirehdr.c
+++ b/lustre/ptlrpc/wirehdr.c
@@ -3,6 +3,24 @@
 # include <liblustre.h>
 #endif
 
+#ifdef __KERNEL__
+# ifndef AUTOCONF_INCLUDED
+#  include <linux/config.h>
+# endif
+# ifdef CONFIG_FS_POSIX_ACL
+#  include <linux/fs.h>
+#  ifdef HAVE_XATTR_ACL
+#   include <linux/xattr_acl.h>
+#  else
+#   define xattr_acl_entry  posix_acl_xattr_entry
+#   define xattr_acl_header posix_acl_xattr_header
+#  endif
+#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+#   include <linux/posix_acl_xattr.h>
+#  endif
+# endif
+#endif
+
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c
index 090fa86979..3ecb7cf939 100644
--- a/lustre/ptlrpc/wiretest.c
+++ b/lustre/ptlrpc/wiretest.c
@@ -3,6 +3,24 @@
 # include <liblustre.h>
 #endif
 
+#ifdef __KERNEL__
+# ifndef AUTOCONF_INCLUDED
+#  include <linux/config.h>
+# endif
+# ifdef CONFIG_FS_POSIX_ACL
+#  include <linux/fs.h>
+#  ifdef HAVE_XATTR_ACL
+#   include <linux/xattr_acl.h>
+#  else
+#   define xattr_acl_entry  posix_acl_xattr_entry
+#   define xattr_acl_header posix_acl_xattr_header
+#  endif
+#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+#   include <linux/posix_acl_xattr.h>
+#  endif
+# endif
+#endif
+
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
@@ -12,13 +30,11 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwirecheck)
-         * running on Linux hideous 2.6.9-prep.qp3.5.34.4qsnet #3 Mon Aug 13 08:38:55 EEST 2007 i686 
-         * with gcc version 3.4.6 20060404 (Red Hat 3.4.6-3) */
+         * running on Linux rhel5.vbox 2.6.18-prep #1 SMP Fri Feb 22 14:24:02 EET 2008 i686 i686 i386
+         * with gcc version 4.1.2 20070626 (Red Hat 4.1.2-14) */
 
 
         /* Constants... */
-        LASSERTF(LUSTRE_MSG_MAGIC_V1 == 0x0BD00BD0," found %lld\n",
-                 (long long)LUSTRE_MSG_MAGIC_V1);
         LASSERTF(LUSTRE_MSG_MAGIC_V2 == 0x0BD00BD3," found %lld\n",
                  (long long)LUSTRE_MSG_MAGIC_V2);
         LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n",
@@ -185,8 +201,6 @@ void lustre_assert_wire_constants(void)
                  (long long)LCK_GROUP);
         LASSERTF(LCK_MAXMODE == 65, " found %lld\n",
                  (long long)LCK_MAXMODE);
-        LASSERTF(LCK_MODE_NUM == 7, " found %lld\n",
-                 (long long)LCK_MODE_NUM);
         CLASSERT(LDLM_PLAIN == 10);
         CLASSERT(LDLM_EXTENT == 11);
         CLASSERT(LDLM_FLOCK == 12);
@@ -229,62 +243,6 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_handle *)0)->cookie));
 
-        /* Checks for struct lustre_msg_v1 */
-        LASSERTF((int)sizeof(struct lustre_msg_v1) == 64, " found %lld\n",
-                 (long long)(int)sizeof(struct lustre_msg_v1));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_handle) == 0, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_handle));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_handle) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_handle));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_magic) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_magic));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_magic) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_magic));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_type) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_type));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_type) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_type));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_version) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_version));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_version) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_version));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_opc) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_opc));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_opc) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_opc));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_last_xid) == 24, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_last_xid));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_xid) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_xid));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_last_committed) == 32, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_last_committed));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_committed) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_committed));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_transno) == 40, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_transno));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_transno) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_transno));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_status) == 48, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_status));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_status) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_status));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_flags) == 52, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_flags));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_flags) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_flags));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_conn_cnt) == 56, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_conn_cnt));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_conn_cnt) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_conn_cnt));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_bufcount) == 60, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_bufcount));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_bufcount) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_bufcount));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_buflens[0]) == 64, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_buflens[0]));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_buflens[0]) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_buflens[0]));
-
         /* Checks for struct lustre_msg_v2 */
         LASSERTF((int)sizeof(struct lustre_msg_v2) == 32, " found %lld\n",
                  (long long)(int)sizeof(struct lustre_msg_v2));
@@ -324,7 +282,6 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lustre_msg_v2, lm_buflens[0]));
         LASSERTF((int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]));
-        LASSERT(offsetof(struct lustre_msg_v1, lm_magic) == offsetof(struct lustre_msg_v2, lm_magic));
 
         /* Checks for struct ptlrpc_body */
         LASSERTF((int)sizeof(struct ptlrpc_body) == 88, " found %lld\n",
@@ -457,6 +414,8 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_CONNECT_REQPORTAL == 0x00000040ULL);
         CLASSERT(OBD_CONNECT_ACL == 0x00000080ULL);
         CLASSERT(OBD_CONNECT_XATTR == 0x00000100ULL);
+        CLASSERT(OBD_CONNECT_REAL == 0x08000000ULL);
+        CLASSERT(OBD_CONNECT_CKSUM == 0x20000000ULL);
         CLASSERT(OBD_CONNECT_TRUNCLOCK == 0x00000400ULL);
         CLASSERT(OBD_CONNECT_IBITS == 0x00001000ULL);
         CLASSERT(OBD_CONNECT_JOIN == 0x00002000ULL);
@@ -468,13 +427,11 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_CONNECT_QUOTA64 == 0x00080000ULL);
         CLASSERT(OBD_CONNECT_MDS_CAPA == 0x00100000ULL);
         CLASSERT(OBD_CONNECT_OSS_CAPA == 0x00200000ULL);
-        CLASSERT(OBD_CONNECT_CANCELSET == 0x00400000ULL);
+        CLASSERT(OBD_CONNECT_MDS_MDS == 0x04000000ULL);
         CLASSERT(OBD_CONNECT_SOM == 0x00800000ULL);
         CLASSERT(OBD_CONNECT_AT == 0x01000000ULL);
+        CLASSERT(OBD_CONNECT_CANCELSET == 0x00400000ULL);
         CLASSERT(OBD_CONNECT_LRU_RESIZE == 0x02000000ULL);
-        CLASSERT(OBD_CONNECT_MDS_MDS == 0x04000000ULL);
-        CLASSERT(OBD_CONNECT_REAL == 0x08000000ULL);
-        CLASSERT(OBD_CONNECT_CKSUM == 0x20000000ULL);
 
         /* Checks for struct obdo */
         LASSERTF((int)sizeof(struct obdo) == 208, " found %lld\n",
@@ -621,8 +578,8 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_TRUNCLOCK == (0x00000800));
         CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000));
         CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000));
-        CLASSERT(OBD_CKSUM_CRC32 == (0x00000001));
-        CLASSERT(OBD_CKSUM_ADLER == (0x00000002));
+        CLASSERT(OBD_CKSUM_CRC32 == OBD_CKSUM_CRC32);
+        CLASSERT(OBD_CKSUM_ADLER == OBD_CKSUM_ADLER);
 
         /* Checks for struct lov_mds_md_v1 */
         LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n",
@@ -1157,22 +1114,22 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
-        CLASSERT(MDS_ATTR_MODE == 1);
-        CLASSERT(MDS_ATTR_UID == 2);
-        CLASSERT(MDS_ATTR_GID == 4);
-        CLASSERT(MDS_ATTR_SIZE == 8);
-        CLASSERT(MDS_ATTR_ATIME == 16);
-        CLASSERT(MDS_ATTR_MTIME == 32);
-        CLASSERT(MDS_ATTR_CTIME == 64);
-        CLASSERT(MDS_ATTR_ATIME_SET == 128);
-        CLASSERT(MDS_ATTR_MTIME_SET == 256);
-        CLASSERT(MDS_ATTR_FORCE == 512);
-        CLASSERT(MDS_ATTR_ATTR_FLAG == 1024);
-        CLASSERT(MDS_ATTR_KILL_SUID == 2048);
-        CLASSERT(MDS_ATTR_KILL_SGID == 4096);
-        CLASSERT(MDS_ATTR_CTIME_SET == 8192);
-        CLASSERT(MDS_ATTR_FROM_OPEN == 16384);
-        CLASSERT(MDS_ATTR_BLOCKS == 32768);
+        CLASSERT(MDS_ATTR_MODE == 0x1ULL);
+        CLASSERT(MDS_ATTR_UID == 0x2ULL);
+        CLASSERT(MDS_ATTR_GID == 0x4ULL);
+        CLASSERT(MDS_ATTR_SIZE == 0x8ULL);
+        CLASSERT(MDS_ATTR_ATIME == 0x10ULL);
+        CLASSERT(MDS_ATTR_MTIME == 0x20ULL);
+        CLASSERT(MDS_ATTR_CTIME == 0x40ULL);
+        CLASSERT(MDS_ATTR_ATIME_SET == 0x80ULL);
+        CLASSERT(MDS_ATTR_MTIME_SET == 0x100ULL);
+        CLASSERT(MDS_ATTR_FORCE == 0x200ULL);
+        CLASSERT(MDS_ATTR_ATTR_FLAG == 0x400ULL);
+        CLASSERT(MDS_ATTR_KILL_SUID == 0x800ULL);
+        CLASSERT(MDS_ATTR_KILL_SGID == 0x1000ULL);
+        CLASSERT(MDS_ATTR_CTIME_SET == 0x2000ULL);
+        CLASSERT(MDS_ATTR_FROM_OPEN == 0x4000ULL);
+        CLASSERT(MDS_ATTR_BLOCKS == 0x8000ULL);
 
         /* Checks for struct mds_rec_create */
         LASSERTF((int)sizeof(struct mds_rec_create) == 96, " found %lld\n",
@@ -2132,5 +2089,33 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lustre_disk_data, ldd_params));
         LASSERTF((int)sizeof(((struct lustre_disk_data *)0)->ldd_params) == 4096, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_disk_data *)0)->ldd_params));
+
+        /* Checks for type posix_acl_xattr_entry */
+        LASSERTF((int)sizeof(xattr_acl_entry) == 8, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_entry));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_id));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
+
+        /* Checks for type posix_acl_xattr_header */
+        LASSERTF((int)sizeof(xattr_acl_header) == 4, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_header));
+        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_version));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
+        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_entries));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
 }
 
diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c
index b65f4abe34..bd8aa1af86 100644
--- a/lustre/utils/wirecheck.c
+++ b/lustre/utils/wirecheck.c
@@ -101,26 +101,6 @@ check_lustre_handle(void)
         CHECK_MEMBER(lustre_handle, cookie);
 }
 
-void
-check_lustre_msg_v1(void)
-{
-        BLANK_LINE();
-        CHECK_STRUCT(lustre_msg_v1);
-        CHECK_MEMBER(lustre_msg_v1, lm_handle);
-        CHECK_MEMBER(lustre_msg_v1, lm_magic);
-        CHECK_MEMBER(lustre_msg_v1, lm_type);
-        CHECK_MEMBER(lustre_msg_v1, lm_version);
-        CHECK_MEMBER(lustre_msg_v1, lm_opc);
-        CHECK_MEMBER(lustre_msg_v1, lm_last_xid);
-        CHECK_MEMBER(lustre_msg_v1, lm_last_committed);
-        CHECK_MEMBER(lustre_msg_v1, lm_transno);
-        CHECK_MEMBER(lustre_msg_v1, lm_status);
-        CHECK_MEMBER(lustre_msg_v1, lm_flags);
-        CHECK_MEMBER(lustre_msg_v1, lm_conn_cnt);
-        CHECK_MEMBER(lustre_msg_v1, lm_bufcount);
-        CHECK_MEMBER(lustre_msg_v1, lm_buflens[0]);
-}
-
 void
 check_lustre_msg_v2(void)
 {
@@ -1122,7 +1102,6 @@ main(int argc, char **argv)
         BLANK_LINE ();
 
         COMMENT("Constants...");
-        CHECK_DEFINE(LUSTRE_MSG_MAGIC_V1);
         CHECK_DEFINE(LUSTRE_MSG_MAGIC_V2);
         CHECK_DEFINE(PTLRPC_MSG_VERSION);
 
@@ -1243,10 +1222,7 @@ main(int argc, char **argv)
         BLANK_LINE();
         CHECK_STRUCT(obd_uuid);
         check_lustre_handle();
-        check_lustre_msg_v1();
         check_lustre_msg_v2();
-        printf("        LASSERT(offsetof(struct lustre_msg_v1, lm_magic) == "
-               "offsetof(struct lustre_msg_v2, lm_magic));\n");
         check_ptlrpc_body();
         check_obd_connect_data();
         check_obdo();
diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c
index e067dab3f0..22c6f2b73c 100644
--- a/lustre/utils/wiretest.c
+++ b/lustre/utils/wiretest.c
@@ -28,13 +28,11 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwirecheck)
-         * running on Linux hideous 2.6.9-prep.qp3.5.34.4qsnet #3 Mon Aug 13 08:38:55 EEST 2007 i686 
-         * with gcc version 3.4.6 20060404 (Red Hat 3.4.6-3) */
+         * running on Linux rhel5.vbox 2.6.18-prep #1 SMP Fri Feb 22 14:24:02 EET 2008 i686 i686 i386
+         * with gcc version 4.1.2 20070626 (Red Hat 4.1.2-14) */
 
 
         /* Constants... */
-        LASSERTF(LUSTRE_MSG_MAGIC_V1 == 0x0BD00BD0," found %lld\n",
-                 (long long)LUSTRE_MSG_MAGIC_V1);
         LASSERTF(LUSTRE_MSG_MAGIC_V2 == 0x0BD00BD3," found %lld\n",
                  (long long)LUSTRE_MSG_MAGIC_V2);
         LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n",
@@ -141,8 +139,6 @@ void lustre_assert_wire_constants(void)
                  (long long)REINT_RENAME);
         LASSERTF(REINT_OPEN == 6, " found %lld\n",
                  (long long)REINT_OPEN);
-        LASSERTF(REINT_SETXATTR == 7, " found %lld\n",
-                 (long long)REINT_SETXATTR);
         LASSERTF(REINT_MAX == 8, " found %lld\n",
                  (long long)REINT_MAX);
         LASSERTF(MGS_CONNECT == 250, " found %lld\n",
@@ -203,8 +199,6 @@ void lustre_assert_wire_constants(void)
                  (long long)LCK_GROUP);
         LASSERTF(LCK_MAXMODE == 65, " found %lld\n",
                  (long long)LCK_MAXMODE);
-        LASSERTF(LCK_MODE_NUM == 7, " found %lld\n",
-                 (long long)LCK_MODE_NUM);
         CLASSERT(LDLM_PLAIN == 10);
         CLASSERT(LDLM_EXTENT == 11);
         CLASSERT(LDLM_FLOCK == 12);
@@ -247,62 +241,6 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_handle *)0)->cookie));
 
-        /* Checks for struct lustre_msg_v1 */
-        LASSERTF((int)sizeof(struct lustre_msg_v1) == 64, " found %lld\n",
-                 (long long)(int)sizeof(struct lustre_msg_v1));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_handle) == 0, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_handle));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_handle) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_handle));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_magic) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_magic));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_magic) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_magic));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_type) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_type));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_type) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_type));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_version) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_version));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_version) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_version));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_opc) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_opc));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_opc) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_opc));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_last_xid) == 24, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_last_xid));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_xid) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_xid));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_last_committed) == 32, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_last_committed));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_committed) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_last_committed));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_transno) == 40, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_transno));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_transno) == 8, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_transno));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_status) == 48, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_status));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_status) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_status));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_flags) == 52, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_flags));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_flags) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_flags));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_conn_cnt) == 56, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_conn_cnt));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_conn_cnt) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_conn_cnt));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_bufcount) == 60, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_bufcount));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_bufcount) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_bufcount));
-        LASSERTF((int)offsetof(struct lustre_msg_v1, lm_buflens[0]) == 64, " found %lld\n",
-                 (long long)(int)offsetof(struct lustre_msg_v1, lm_buflens[0]));
-        LASSERTF((int)sizeof(((struct lustre_msg_v1 *)0)->lm_buflens[0]) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct lustre_msg_v1 *)0)->lm_buflens[0]));
-
         /* Checks for struct lustre_msg_v2 */
         LASSERTF((int)sizeof(struct lustre_msg_v2) == 32, " found %lld\n",
                  (long long)(int)sizeof(struct lustre_msg_v2));
@@ -342,7 +280,6 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lustre_msg_v2, lm_buflens[0]));
         LASSERTF((int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]));
-        LASSERT(offsetof(struct lustre_msg_v1, lm_magic) == offsetof(struct lustre_msg_v2, lm_magic));
 
         /* Checks for struct ptlrpc_body */
         LASSERTF((int)sizeof(struct ptlrpc_body) == 88, " found %lld\n",
@@ -475,6 +412,8 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_CONNECT_REQPORTAL == 0x00000040ULL);
         CLASSERT(OBD_CONNECT_ACL == 0x00000080ULL);
         CLASSERT(OBD_CONNECT_XATTR == 0x00000100ULL);
+        CLASSERT(OBD_CONNECT_REAL == 0x08000000ULL);
+        CLASSERT(OBD_CONNECT_CKSUM == 0x20000000ULL);
         CLASSERT(OBD_CONNECT_TRUNCLOCK == 0x00000400ULL);
         CLASSERT(OBD_CONNECT_IBITS == 0x00001000ULL);
         CLASSERT(OBD_CONNECT_JOIN == 0x00002000ULL);
@@ -486,13 +425,11 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_CONNECT_QUOTA64 == 0x00080000ULL);
         CLASSERT(OBD_CONNECT_MDS_CAPA == 0x00100000ULL);
         CLASSERT(OBD_CONNECT_OSS_CAPA == 0x00200000ULL);
-        CLASSERT(OBD_CONNECT_CANCELSET == 0x00400000ULL);
+        CLASSERT(OBD_CONNECT_MDS_MDS == 0x04000000ULL);
         CLASSERT(OBD_CONNECT_SOM == 0x00800000ULL);
         CLASSERT(OBD_CONNECT_AT == 0x01000000ULL);
+        CLASSERT(OBD_CONNECT_CANCELSET == 0x00400000ULL);
         CLASSERT(OBD_CONNECT_LRU_RESIZE == 0x02000000ULL);
-        CLASSERT(OBD_CONNECT_MDS_MDS == 0x04000000ULL);
-        CLASSERT(OBD_CONNECT_REAL == 0x08000000ULL);
-        CLASSERT(OBD_CONNECT_CKSUM == 0x20000000ULL);
 
         /* Checks for struct obdo */
         LASSERTF((int)sizeof(struct obdo) == 208, " found %lld\n",
@@ -639,9 +576,9 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_TRUNCLOCK == (0x00000800));
         CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000));
         CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000));
-        CLASSERT(OBD_CKSUM_CRC32 == (0x00000001));
-        CLASSERT(OBD_CKSUM_ADLER == (0x00000002));
- 
+        CLASSERT(OBD_CKSUM_CRC32 == OBD_CKSUM_CRC32);
+        CLASSERT(OBD_CKSUM_ADLER == OBD_CKSUM_ADLER);
+
         /* Checks for struct lov_mds_md_v1 */
         LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n",
                  (long long)(int)sizeof(struct lov_mds_md_v1));
@@ -1175,22 +1112,22 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
-        CLASSERT(MDS_ATTR_MODE == 1);
-        CLASSERT(MDS_ATTR_UID == 2);
-        CLASSERT(MDS_ATTR_GID == 4);
-        CLASSERT(MDS_ATTR_SIZE == 8);
-        CLASSERT(MDS_ATTR_ATIME == 16);
-        CLASSERT(MDS_ATTR_MTIME == 32);
-        CLASSERT(MDS_ATTR_CTIME == 64);
-        CLASSERT(MDS_ATTR_ATIME_SET == 128);
-        CLASSERT(MDS_ATTR_MTIME_SET == 256);
-        CLASSERT(MDS_ATTR_FORCE == 512);
-        CLASSERT(MDS_ATTR_ATTR_FLAG == 1024);
-        CLASSERT(MDS_ATTR_KILL_SUID == 2048);
-        CLASSERT(MDS_ATTR_KILL_SGID == 4096);
-        CLASSERT(MDS_ATTR_CTIME_SET == 8192);
-        CLASSERT(MDS_ATTR_FROM_OPEN == 16384);
-        CLASSERT(MDS_ATTR_BLOCKS == 32768);
+        CLASSERT(MDS_ATTR_MODE == 0x1ULL);
+        CLASSERT(MDS_ATTR_UID == 0x2ULL);
+        CLASSERT(MDS_ATTR_GID == 0x4ULL);
+        CLASSERT(MDS_ATTR_SIZE == 0x8ULL);
+        CLASSERT(MDS_ATTR_ATIME == 0x10ULL);
+        CLASSERT(MDS_ATTR_MTIME == 0x20ULL);
+        CLASSERT(MDS_ATTR_CTIME == 0x40ULL);
+        CLASSERT(MDS_ATTR_ATIME_SET == 0x80ULL);
+        CLASSERT(MDS_ATTR_MTIME_SET == 0x100ULL);
+        CLASSERT(MDS_ATTR_FORCE == 0x200ULL);
+        CLASSERT(MDS_ATTR_ATTR_FLAG == 0x400ULL);
+        CLASSERT(MDS_ATTR_KILL_SUID == 0x800ULL);
+        CLASSERT(MDS_ATTR_KILL_SGID == 0x1000ULL);
+        CLASSERT(MDS_ATTR_CTIME_SET == 0x2000ULL);
+        CLASSERT(MDS_ATTR_FROM_OPEN == 0x4000ULL);
+        CLASSERT(MDS_ATTR_BLOCKS == 0x8000ULL);
 
         /* Checks for struct mds_rec_create */
         LASSERTF((int)sizeof(struct mds_rec_create) == 96, " found %lld\n",
@@ -2151,35 +2088,32 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct lustre_disk_data *)0)->ldd_params) == 4096, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_disk_data *)0)->ldd_params));
 
-#ifdef LIBLUSTRE_POSIX_ACL
         /* Checks for type posix_acl_xattr_entry */
-        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, " found %lld\n",
-                 (long long)(int)sizeof(posix_acl_xattr_entry));
-        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0, " found %lld\n",
-                 (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
-        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2, " found %lld\n",
-                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
-        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2, " found %lld\n",
-                 (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
-        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2, " found %lld\n",
-                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
-        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4, " found %lld\n",
-                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
-        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
+        LASSERTF((int)sizeof(xattr_acl_entry) == 8, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_entry));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_id));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
 
         /* Checks for type posix_acl_xattr_header */
-        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, " found %lld\n",
-                 (long long)(int)sizeof(posix_acl_xattr_header));
-        LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0, " found %lld\n",
-                 (long long)(int)offsetof(posix_acl_xattr_header, a_version));
-        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
-        LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, " found %lld\n",
-                 (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
-        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, " found %lld\n",
-                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
-#endif
-
+        LASSERTF((int)sizeof(xattr_acl_header) == 4, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_header));
+        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_version));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
+        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_entries));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
 }
 
-- 
GitLab