- LASSERT(reqp);
- LASSERT(*reqp);
-
- /* master is locked. we'd like to take locks on slaves
- * and update attributes to be returned from the slaves
- * it's important that lookup is called in two cases:
- * - for first time (dcache has no such a resolving yet
- * - ->d_revalidate() returned false
- * last case possible only if all the objs (master and
- * all slaves aren't valid */
-
- body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
- LASSERT(body != NULL);
-
- obj = lmv_grab_obj(obd, &body->fid1, 0);
- LASSERT(obj);
-
- CDEBUG(D_OTHER, "lookup slaves for %lu/%lu/%lu\n",
- (unsigned long) body->fid1.mds,
- (unsigned long) body->fid1.id,
- (unsigned long) body->fid1.generation);
-
- uctxt.gid1 = 0;
- uctxt.gid2 = 0;
- for (i = 0; i < obj->objcount; i++) {
- struct ll_fid fid = obj->objs[i].fid;
- struct ptlrpc_request *req = NULL;
- struct lookup_intent it;
-
- if (fid_equal(&fid, &obj->fid)) {
- /* skip master obj */
- continue;
- }
-
- CDEBUG(D_OTHER, "lookup slave %lu/%lu/%lu\n",
- (unsigned long) fid.mds,
- (unsigned long) fid.id,
- (unsigned long) fid.generation);
-
- /* is obj valid? */
- memset(&it, 0, sizeof(it));
- it.it_op = IT_GETATTR;
- rc = md_intent_lock(lmv->tgts[fid.mds].exp, &uctxt, &fid,
- NULL, 0, NULL, 0, &fid, &it, 0, &req,
- lmv_dirobj_blocking_ast);
- lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
- if (rc > 0) {
- /* nice, this slave is valid */
- LASSERT(req == NULL);
- CDEBUG(D_OTHER, "cached\n");
- goto release_lock;
- }
-
- if (rc < 0) {
- /* error during revalidation */
- GOTO(cleanup, rc);
- }
-
- /* rc == 0, this means we have no such a lock and can't
- * think obj is still valid. lookup it again */
- LASSERT(req == NULL);
- req = NULL;
- memset(&it, 0, sizeof(it));
- it.it_op = IT_GETATTR;
- rc = md_intent_lock(lmv->tgts[fid.mds].exp, &uctxt, &fid,
- NULL, 0, NULL, 0, NULL, &it, 0, &req,
- lmv_dirobj_blocking_ast);
- lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
- LASSERT(rc <= 0);
- if (rc < 0) {
- /* error during lookup */
- GOTO(cleanup, rc);
- }
-
- lock = ldlm_handle2lock(lockh);
- LASSERT(lock);
- lock->l_ast_data = obj;
- atomic_inc(&obj->count);