Whamcloud - gitweb
LU-8998 lod: accomodate to composite layout
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index 2c45545..6f9105e 100644 (file)
@@ -371,9 +371,48 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
 
         rc = ptlrpc_queue_wait(req);
 
-        if (opcode == MDS_REINT)
+       if (opcode == MDS_REINT)
                mdc_put_mod_rpc_slot(req, NULL);
 
+       /* For XATTR_LUSTRE_LOV.add, we'd save the LOVEA for replay. */
+       if (opcode == MDS_REINT && rc == 0) {
+               struct mdt_body *body;
+               struct req_capsule *pill = &req->rq_pill;
+
+               body = req_capsule_server_get(pill, &RMF_MDT_BODY);
+               if (body == NULL)
+                       GOTO(out, rc = -EPROTO);
+
+               if (body->mbo_valid & OBD_MD_FLEASIZE) {
+                       void *eadata, *lmm;
+
+                       eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD,
+                                                       body->mbo_eadatasize);
+                       if (eadata == NULL)
+                               GOTO(out, rc = -EPROTO);
+
+                       if (req_capsule_get_size(pill, &RMF_EADATA,
+                                                RCL_CLIENT) <
+                                       body->mbo_eadatasize) {
+                               rc = sptlrpc_cli_enlarge_reqbuf(req, 4,
+                                                       body->mbo_eadatasize);
+                               if (rc)
+                                       GOTO(out, rc = -ENOMEM);
+                       } else {
+                               req_capsule_shrink(pill, &RMF_EADATA,
+                                                  body->mbo_eadatasize,
+                                                  RCL_CLIENT);
+                       }
+
+                       req_capsule_set_size(pill, &RMF_EADATA, RCL_CLIENT,
+                                            body->mbo_eadatasize);
+
+                       lmm = req_capsule_client_get(pill, &RMF_EADATA);
+                       if (lmm)
+                               memcpy(lmm, eadata, body->mbo_eadatasize);
+               }
+       }
+out:
         if (rc)
                 ptlrpc_req_finished(req);
         else