Whamcloud - gitweb
small fix about RQF_MDT_EPOCH: check buffer len first.
authorhuanghua <huanghua>
Sun, 17 Sep 2006 15:52:06 +0000 (15:52 +0000)
committerhuanghua <huanghua>
Sun, 17 Sep 2006 15:52:06 +0000 (15:52 +0000)
lustre/mdc/mdc_lib.c
lustre/mdt/mdt_lib.c

index 1e957f2..2ad40ba 100644 (file)
@@ -220,10 +220,13 @@ void mdc_setattr_pack(struct ptlrpc_request *req, int offset,
         struct mdt_epoch *epoch;
         
         rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));        
-        epoch = lustre_msg_buf(req->rq_reqmsg, offset + 1, sizeof(*epoch));
         mdc_setattr_pack_rec(rec, op_data);
-        if (epoch)
+
+        if (op_data->flags & (MF_SOM_CHANGE | MF_EPOCH_OPEN)) {
+                epoch = lustre_msg_buf(req->rq_reqmsg, offset + 1,
+                                        sizeof(*epoch));
                 mdc_epoch_pack(epoch, op_data);
+        }
 
         if (ealen == 0)
                 return;
index a0cb3a7..a1e5baf 100644 (file)
@@ -199,7 +199,13 @@ static int mdt_epoch_unpack(struct mdt_thread_info *info)
         struct req_capsule *pill = &info->mti_pill;
         ENTRY;
 
-        info->mti_epoch = req_capsule_client_get(pill, &RMF_MDT_EPOCH);
+        if (req_capsule_get_size(pill, &RMF_MDT_EPOCH, RCL_CLIENT)) 
+                info->mti_epoch = req_capsule_client_get(pill, &RMF_MDT_EPOCH);
+        else 
+                /* it is set to NULL already. 
+                info->mti_epoch = NULL;
+                */
+                ;
         RETURN(info->mti_epoch == NULL ? -EFAULT : 0);
 }
 
@@ -214,7 +220,7 @@ static int mdt_setattr_unpack(struct mdt_thread_info *info)
         if (rc)
                 RETURN(rc);
 
-        /* Epoch may be absent, skip errors. */
+        /* Epoch may be absent */
         mdt_epoch_unpack(info);
 
         if (req_capsule_field_present(pill, &RMF_EADATA, RCL_CLIENT)) {