Whamcloud - gitweb
b=6427
[fs/lustre-release.git] / lustre / lmv / lmv_obd.c
index 509d209..d69c956 100644 (file)
@@ -96,7 +96,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct obd_uuid *uuid,
                 CDEBUG(D_INFO, "lmv idx %d is %s conn "LPX64"\n",
                        i, tgt->uuid.uuid, tgt->ltd_exp->exp_handle.h_cookie);
 
-                if (strncmp(uuid->uuid, tgt->uuid.uuid, sizeof uuid->uuid) == 0)
+                if (obd_uuid_equals(uuid, &tgt->uuid))
                         break;
         }
 
@@ -552,27 +552,27 @@ static int lmv_setup(struct obd_device *obd, obd_count len, void *buf)
         struct lmv_obd *lmv = &obd->u.lmv;
         ENTRY;
 
-        if (lcfg->lcfg_inllen1 < 1) {
+        if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
                 CERROR("LMV setup requires a descriptor\n");
                 RETURN(-EINVAL);
         }
 
-        if (lcfg->lcfg_inllen2 < 1) {
+        if (LUSTRE_CFG_BUFLEN(lcfg, 2) < 1) {
                 CERROR("LMV setup requires an MDT UUID list\n");
                 RETURN(-EINVAL);
         }
 
-        desc = (struct lmv_desc *)lcfg->lcfg_inlbuf1;
-        if (sizeof(*desc) > lcfg->lcfg_inllen1) {
+        desc = (struct lmv_desc *)lustre_cfg_buf(lcfg, 1);
+        if (sizeof(*desc) > LUSTRE_CFG_BUFLEN(lcfg, 1)) {
                 CERROR("descriptor size wrong: %d > %d\n",
-                       (int)sizeof(*desc), lcfg->lcfg_inllen1);
+                       (int)sizeof(*desc), LUSTRE_CFG_BUFLEN(lcfg, 1));
                 RETURN(-EINVAL);
         }
 
-        uuids = (struct obd_uuid *)lcfg->lcfg_inlbuf2;
-        if (sizeof(*uuids) * desc->ld_tgt_count != lcfg->lcfg_inllen2) {
+        uuids = (struct obd_uuid *)lustre_cfg_buf(lcfg, 2);
+        if (sizeof(*uuids) * desc->ld_tgt_count != LUSTRE_CFG_BUFLEN(lcfg, 2)) {
                 CERROR("UUID array size wrong: %u * %u != %u\n",
-                       sizeof(*uuids), desc->ld_tgt_count, lcfg->lcfg_inllen2);
+                       sizeof(*uuids), desc->ld_tgt_count, LUSTRE_CFG_BUFLEN(lcfg, 2));
                 RETURN(-EINVAL);
         }
 
@@ -1153,8 +1153,9 @@ repeat:
         CDEBUG(D_OTHER, "getattr_lock for %*s on "DLID4" -> "DLID4"\n",
                namelen, filename, OLID4(id), OLID4(&rid));
 
-        rc = md_getattr_lock(lmv->tgts[id_group(&rid)].ltd_exp, &rid,
-                             filename, namelen, (valid | OBD_MD_FID),
+        rc = md_getattr_lock(lmv->tgts[id_group(&rid)].ltd_exp,
+                             &rid, filename, namelen,
+                             valid == OBD_MD_FLID ? valid : valid | OBD_MD_FID,
                              ea_size, request);
         if (rc == 0) {
                 /*
@@ -1164,7 +1165,8 @@ repeat:
                  */
                 body = lustre_msg_buf((*request)->rq_repmsg, 0, sizeof(*body));
                 LASSERT(body != NULL);
-                LASSERT((body->valid & OBD_MD_FID) != 0);
+                LASSERT((body->valid & OBD_MD_FID) != 0
+                                || body->valid == OBD_MD_FLID);
 
                 if (body->valid & OBD_MD_MDS) {
                         struct ptlrpc_request *req = NULL;
@@ -1646,6 +1648,7 @@ int lmv_init_ea_size(struct obd_export *exp, int easize,
 }
 
 int lmv_obd_create_single(struct obd_export *exp, struct obdo *oa,
+                          void *acl, int acl_size,
                           struct lov_stripe_md **ea, struct obd_trans_info *oti)
 {
         struct obd_device *obd = exp->exp_obd;
@@ -1658,8 +1661,8 @@ int lmv_obd_create_single(struct obd_export *exp, struct obdo *oa,
         LASSERT(ea == NULL);
         LASSERT(oa->o_mds < lmv->desc.ld_tgt_count);
 
-        rc = obd_create(lmv->tgts[oa->o_mds].ltd_exp,
-                        oa, &obj_mdp, oti);
+        rc = obd_create(lmv->tgts[oa->o_mds].ltd_exp, oa,
+                        acl, acl_size, &obj_mdp, oti);
 
         RETURN(rc);
 }
@@ -1679,6 +1682,7 @@ int lmv_getready(struct obd_export *exp)
  * values for "master" object, as it will be used.
  */
 int lmv_obd_create(struct obd_export *exp, struct obdo *oa,
+                   void *acl, int acl_size,
                    struct lov_stripe_md **ea, struct obd_trans_info *oti)
 {
         struct obd_device *obd = exp->exp_obd;
@@ -1695,12 +1699,15 @@ int lmv_obd_create(struct obd_export *exp, struct obdo *oa,
         LASSERT(oa != NULL);
         
         if (ea == NULL) {
-                rc = lmv_obd_create_single(exp, oa, NULL, oti);
+                rc = lmv_obd_create_single(exp, oa, acl, acl_size, NULL, oti);
                 if (rc)
                         CERROR("Can't create object, rc = %d\n", rc);
                 RETURN(rc);
         }
 
+        /* acl is only suppied when mds create single remote obj */
+        LASSERT(acl == NULL && acl_size == 0);
+
         if (*ea == NULL) {
                 rc = obd_alloc_diskmd(exp, (struct lov_mds_md **)ea);
                 if (rc < 0) {
@@ -1753,7 +1760,8 @@ int lmv_obd_create(struct obd_export *exp, struct obdo *oa,
                 oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLTYPE | OBD_MD_FLMODE |
                         OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLID;
 
-                rc = obd_create(lmv->tgts[c].ltd_exp, oa, &obj_mdp, oti);
+                rc = obd_create(lmv->tgts[c].ltd_exp, oa, NULL, 0,
+                                &obj_mdp, oti);
                 if (rc) {
                         CERROR("obd_create() failed on MDT target %d, "
                                "error %d\n", c, rc);