Hi All,

Attached is a proposed patch, which should solve some issues with mixed
endians. Unfortunately I was not able to access the latest code on the
CVS to see what other fixes might be there.
--- lustre/ptlrpc/pack_generic.c	2006-09-01 03:53:21.000000000 +0300
+++ pack_generic.c	2006-12-06 14:16:45.000000000 +0200
@@ -64,9 +64,6 @@
 {
         __u32 ver = lustre_msg_get_version(msg);
 
-        if (lustre_msg_swabbed(msg))
-                 return (__swab32(ver) & LUSTRE_VERSION_MASK) != version;
-
         return (ver & LUSTRE_VERSION_MASK) != version;
 }
 
@@ -646,14 +643,6 @@
         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) {
@@ -669,6 +658,14 @@
                 __swab32s(&m->lm_bufcount);
         }
 
+        /* 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);
+        }
+
         if (m->lm_version != PTLRPC_MSG_VERSION) {
                 CERROR("wrong lustre_msg version %08x\n", m->lm_version);
                 RETURN(-EINVAL);
@@ -703,14 +701,6 @@
 {
         int flipped, required_len, i;
 
-        required_len = lustre_msg_hdr_size_v2(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;
-        }
-
         flipped = lustre_msg_swabbed(m);
 
         if (flipped) {
@@ -719,6 +709,13 @@
                 __swab32s(&m->lm_repsize);
         }
 
+        required_len = lustre_msg_hdr_size_v2(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]);
@@ -747,8 +744,10 @@
          * rather than a short message.
          *
          */
+      
         required_len = offsetof(struct lustre_msg, lm_magic) +
                        sizeof(m->lm_magic);
+        
         if (len < required_len) {
                 /* can't even look inside the message */
                 CERROR("message length %d too small for magic/version check\n",
_______________________________________________
Lustre-devel mailing list
[email protected]
https://mail.clusterfs.com/mailman/listinfo/lustre-devel

Reply via email to