Whamcloud - gitweb
branch: HEAD
authorericm <ericm>
Wed, 29 Oct 2008 19:34:24 +0000 (19:34 +0000)
committerericm <ericm>
Wed, 29 Oct 2008 19:34:24 +0000 (19:34 +0000)
AT: fix reply offset calculate and check.
b=17404
r=h.huang
r=nathan

lustre/ptlrpc/gss/sec_gss.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/sec.c
lustre/ptlrpc/sec_null.c
lustre/ptlrpc/sec_plain.c

index 3312239..1229091 100644 (file)
@@ -1869,7 +1869,10 @@ int gss_svc_sign(struct ptlrpc_request *req,
         rs->rs_repdata_len = rc;
 
         if (likely(req->rq_packed_final)) {
-                req->rq_reply_off = gss_at_reply_off_integ;
+                if (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)
+                        req->rq_reply_off = gss_at_reply_off_integ;
+                else
+                        req->rq_reply_off = 0;
         } else {
                 if (svc == SPTLRPC_SVC_NULL)
                         rs->rs_repbuf->lm_cksum = crc32_le(!(__u32) 0,
@@ -2601,7 +2604,8 @@ static int gss_svc_seal(struct ptlrpc_request *req,
         memcpy(lustre_msg_buf(rs->rs_repbuf, 1, 0), token.data, token.len);
 
         /* reply offset */
-        if (likely(req->rq_packed_final))
+        if (req->rq_packed_final &&
+            (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT))
                 req->rq_reply_off = gss_at_reply_off_priv;
         else
                 req->rq_reply_off = 0;
index 97ea280..42790f1 100644 (file)
@@ -779,6 +779,7 @@ __u32 lustre_msghdr_get_flags(struct lustre_msg *msg)
                 return 0;
         }
 }
+EXPORT_SYMBOL(lustre_msghdr_get_flags);
 
 void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags)
 {
index d29a21d..977ac89 100644 (file)
@@ -933,7 +933,8 @@ int sptlrpc_cli_unwrap_reply(struct ptlrpc_request *req)
         LASSERT(req->rq_repmsg == NULL);
         LASSERT(req->rq_reply_off + req->rq_nob_received <= req->rq_repbuf_len);
 
-        if (req->rq_reply_off == 0) {
+        if (req->rq_reply_off == 0 &&
+            (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)) {
                 CERROR("real reply with offset 0\n");
                 return -EPROTO;
         }
index ea7d5ae..c63401b 100644 (file)
@@ -371,7 +371,10 @@ int null_authorize(struct ptlrpc_request *req)
         rs->rs_repdata_len = req->rq_replen;
 
         if (likely(req->rq_packed_final)) {
-                req->rq_reply_off = lustre_msg_early_size();
+                if (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)
+                        req->rq_reply_off = lustre_msg_early_size();
+                else
+                        req->rq_reply_off = 0;
         } else {
                 rs->rs_repbuf->lm_cksum =
                                 crc32_le(!(__u32) 0,
index 291a9fb..fd4e723 100644 (file)
@@ -712,7 +712,10 @@ int plain_authorize(struct ptlrpc_request *req)
         rs->rs_repdata_len = len;
 
         if (likely(req->rq_packed_final)) {
-                req->rq_reply_off = plain_at_offset;
+                if (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)
+                        req->rq_reply_off = plain_at_offset;
+                else
+                        req->rq_reply_off = 0;
         } else {
                 msg->lm_cksum = crc32_le(!(__u32) 0,
                                 lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0),