}
LASSERT(fid_num(&body->fid1) != 0);
-
+
nid = body->fid1;
it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE;
op_data.fid1 = nid;
if (obj) {
/* directory is already splitted, so we have to forward
* request to the right MDS */
- mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
+ mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
(char *)name, len);
-
+
CDEBUG(D_OTHER, "forward to MDS #%u ("DFID3")\n",
mds, PFID3(&rpid));
rpid = obj->lo_inodes[mds].li_fid;
op_data.fid2 = *cid;
op_data.name = name;
op_data.namelen = len;
-
+
mds = lmv_fld_lookup(obd, &rpid);
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &op_data,
lmm, lmmsize, it, flags, reqp,
if (rc != 0) {
LASSERT(rc < 0);
- /*
+ /*
* this is possible, that some userspace application will try to
* open file as directory and we will have -ENOTDIR here. As
* this is "usual" situation, we should not print error here,
/* could not find object, FID is not present in response. */
/* if (!(body->valid & OBD_MD_FID))
RETURN(0);*/
-
+
cid = &body->fid1;
obj = lmv_obj_grab(obd, cid);
if (!obj && (mea = lmv_get_mea(*reqp, 1))) {
/* this is splitted dir and we'd want to get attrs */
CDEBUG(D_OTHER, "attrs from slaves for "DFID3"\n",
PFID3(cid));
-
+
rc = lmv_revalidate_slaves(exp, reqp, cid, it, 1,
cb_blocking, extra_lock_flags);
} else if (S_ISDIR(body->mode)) {
CDEBUG(D_OTHER, "object "DFID3" has not lmv obj?\n",
PFID3(cid));
}
-
+
if (obj)
lmv_obj_put(obj);
-
+
RETURN(rc);
}
obj = lmv_obj_grab(obd, pid);
if (obj && len) {
/* directory is already splitted. calculate mds */
- mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
+ mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
(char *)name, len);
rpid = obj->lo_inodes[mds].li_fid;
mds = lmv_fld_lookup(obd, &rpid);
op_data.fid1 = rpid;
op_data.name = name;
op_data.namelen = len;
-
+
/* the same about fid returning. */
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &op_data, lmm,
lmmsize, it, flags, reqp, cb_blocking,
extra_lock_flags);
if (rc < 0)
RETURN(rc);
-
+
if (obj && rc > 0) {
/* this is splitted dir. In order to optimize things a
* bit, we consider obj valid updating missing parts.
CDEBUG(D_OTHER,
"revalidate slaves for "DFID3", rc %d\n",
PFID3(cid), rc);
-
+
LASSERT(cid != 0);
rc = lmv_revalidate_slaves(exp, reqp, cid, it, rc,
cb_blocking, extra_lock_flags);
if (*reqp == NULL)
RETURN(rc);
-
+
/* okay, MDS has returned success. probably name has been
* resolved in remote inode */
rc = lmv_intent_remote(exp, lmm, lmmsize, it, flags,
*/
if (it->d.lustre.it_disposition & DISP_LOOKUP_NEG)
RETURN(0);
-
+
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
/* this is splitted dir and we'd want to get attrs */
CDEBUG(D_OTHER, "attrs from slaves for "DFID3", rc %d\n",
PFID3(cid), rc);
-
+
rc = lmv_revalidate_slaves(exp, reqp, cid, it, 1,
cb_blocking, extra_lock_flags);
lmv_obj_put(obj2);
/* 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 */
obj = lmv_obj_grab(obd, &body->fid1);
LASSERT(obj != NULL);
- CDEBUG(D_OTHER, "lookup slaves for "DFID3"\n",
+ CDEBUG(D_OTHER, "lookup slaves for "DFID3"\n",
PFID3(&body->fid1));
lmv_obj_lock(obj);
-
+
for (i = 0; i < obj->lo_objcount; i++) {
struct lu_fid fid = obj->lo_inodes[i].li_fid;
struct md_op_data op_data = { { 0 } };
op_data.fid1 = fid;
op_data.fid2 = fid;
-
+
mds = lmv_fld_lookup(obd, &fid);
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &op_data,
NULL, 0, &it, 0, &req,
lmv_blocking_ast, 0);
-
+
lockh = (struct lustre_handle *)&it.d.lustre.it_lock_handle;
if (rc > 0 && req == NULL) {
/* nice, this slave is valid */
if (rc < 0) {
/* error during lookup */
GOTO(cleanup, rc);
- }
+ }
lock = ldlm_handle2lock(lockh);
LASSERT(lock);
LASSERT(body2);
obj->lo_inodes[i].li_size = body2->size;
-
+
CDEBUG(D_OTHER, "fresh: %lu\n",
(unsigned long)obj->lo_inodes[i].li_size);
CDEBUG(D_OTHER, "revalidate lookup for "DFID3" to %d MDS\n",
PFID3(cid), mds);
+ op_data.fid2 = *cid;
} else {
mds = lmv_fld_lookup(obd, pid);
repeat:
LASSERT(++loop <= 2);
-
+
/* this is lookup. during lookup we have to update all the
* attributes, because returned values will be put in struct
* inode */
if (obj) {
if (len) {
/* directory is already splitted. calculate mds */
- mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
+ mds = raw_name2idx(obj->lo_hashtype, obj->lo_objcount,
(char *)name, len);
rpid = obj->lo_inodes[mds].li_fid;
mds = lmv_fld_lookup(obd, &rpid);
}
lmv_obj_put(obj);
}
+ memset(&op_data.fid2, 0, sizeof op_data.fid2);
}
op_data.fid1 = rpid;
- op_data.fid2 = *cid;
op_data.name = name;
op_data.namelen = len;
-
+
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &op_data, lmm, lmmsize,
it, flags, reqp, cb_blocking, extra_lock_flags);
if (rc > 0) {
PFID3(&rpid));
RETURN(rc);
}
-
+
if (rc == -ERESTART) {
/* directory got splitted since last update. this shouldn't be
* becasue splitting causes lock revocation, so revalidate had
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body != NULL);
// LASSERT((body->valid & OBD_MD_FID) != 0);
-
+
obj = lmv_obj_grab(obd, &body->fid1);
if (!obj) {
obj = lmv_obj_create(exp, &body->fid1, mea);
master_lock_mode = 0;
lmv_obj_lock(obj);
-
+
for (i = 0; i < obj->lo_objcount; i++) {
struct lu_fid fid = obj->lo_inodes[i].li_fid;
struct md_op_data op_data = { { 0 } };
body = lustre_msg_buf(mreq->rq_repmsg,
1, sizeof(*body));
LASSERT(body != NULL);
- goto update;
+ goto update;
}
/* take already cached attrs into account */
CDEBUG(D_OTHER,
op_data.fid1 = fid;
op_data.fid2 = fid;
-
+
/* is obj valid? */
mds = lmv_fld_lookup(obd, &fid);
rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &op_data,
body = lustre_msg_buf(req->rq_repmsg, 1, sizeof(*body));
LASSERT(body);
-
+
update:
obj->lo_inodes[i].li_size = body->size;
-
+
CDEBUG(D_OTHER, "fresh: %lu\n",
(unsigned long)obj->lo_inodes[i].li_size);
-
+
if (req)
ptlrpc_req_finished(req);
release_lock:
* fresh attrs to it */
CDEBUG(D_OTHER, "return refreshed attrs: size = %lu\n",
(unsigned long)size);
-
+
body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
LASSERT(body);
/* FIXME: what about other attributes? */
body->size = size;
-
+
if (mreq == NULL) {
/* very important to maintain mds num the
* same because of revalidation. mreq == NULL means that