Whamcloud - gitweb
- more debug messages for #46 failure
[fs/lustre-release.git] / lustre / lmv / lmv_intent.c
index bf3f7b3..d860e86 100644 (file)
@@ -144,7 +144,6 @@ repeat:
                  * request to the right MDS */
                 mds = raw_name2idx(obj->objcount, (char *)name, len);
                 CDEBUG(D_OTHER, "forward to MDS #%u\n", mds);
-
                 rpfid = obj->objs[mds].fid;
                 lmv_put_obj(obj);
         }
@@ -171,6 +170,15 @@ repeat:
                                      flags, reqp, cb_blocking);
         if (rc != 0) {
                 LASSERT(rc < 0);
+                CERROR("can't handle remote %s: dir %lu/%lu/%lu(%lu/%lu/%lu):"
+                       "%*s: %d\n", LL_IT2STR(it),
+                       (unsigned long) pfid->mds,
+                       (unsigned long) pfid->id,
+                       (unsigned long) pfid->generation,
+                       (unsigned long) rpfid.mds,
+                       (unsigned long) rpfid.id,
+                       (unsigned long) rpfid.generation,
+                       len, name, rc);
                 RETURN(rc);
         }
 
@@ -325,11 +333,10 @@ void lmv_update_body_from_obj(struct mds_body *body, struct lmv_inode *obj)
 {
         /* update size */
         body->size += obj->size;
-
-        /* update atime */
-        /* update ctime */
-        /* update mtime */
-        /* update nlink */
+/*        body->atime = obj->atime;
+        body->ctime = obj->ctime;
+        body->mtime = obj->mtime;
+        body->nlink = obj->nlink;*/
 }
 
 int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
@@ -352,7 +359,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
          * 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.
+         *  - 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
@@ -394,7 +401,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
                                     NULL, 0, NULL, 0, &fid, &it, 0, &req,
                                     lmv_dirobj_blocking_ast);
                 
-                lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
+                lockh = (struct lustre_handle *)&it.d.lustre.it_lock_handle;
                 if (rc > 0) {
                         /* nice, this slave is valid */
                         LASSERT(req == NULL);
@@ -433,6 +440,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
                 LASSERT(body2);
 
                 obj->objs[i].size = body2->size;
+                
                 CDEBUG(D_OTHER, "fresh: %lu\n",
                        (unsigned long)obj->objs[i].size);
 
@@ -501,10 +509,12 @@ repeat:
          * because returned values will be put in struct inode */
 
         obj = lmv_grab_obj(obd, pfid);
-        if (obj && len) {
-                /* directory is already splitted. calculate mds */
-                mds = raw_name2idx(obj->objcount, (char *)name, len);
-                rpfid = obj->objs[mds].fid;
+        if (obj) {
+                if (len) {
+                        /* directory is already splitted. calculate mds */
+                        mds = raw_name2idx(obj->objcount, (char *)name, len);
+                        rpfid = obj->objs[mds].fid;
+                }
                 lmv_put_obj(obj);
         }
 
@@ -517,7 +527,6 @@ repeat:
                 CWARN("lookup for %lu/%lu/%lu and data should be uptodate\n",
                       (unsigned long)rpfid.mds, (unsigned long)rpfid.id,
                       (unsigned long)rpfid.generation);
-                
                 LASSERT(*reqp == NULL);
                 RETURN(rc);
         }
@@ -540,7 +549,7 @@ repeat:
                 obj = lmv_create_obj(exp, &rpfid, NULL);
                 if (IS_ERR(obj))
                         RETURN(PTR_ERR(obj));
-                
+                lmv_put_obj(obj);
                 goto repeat;
         }
 
@@ -562,9 +571,8 @@ repeat:
                         obj = lmv_create_obj(exp, &body->fid1, mea);
                         if (IS_ERR(obj))
                                 RETURN(PTR_ERR(obj));
-                } else {
-                        lmv_put_obj(obj);
                 }
+                lmv_put_obj(obj);
         }
 
         RETURN(rc);
@@ -617,8 +625,8 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
         struct ptlrpc_request *mreq = *reqp;
         struct lmv_obd *lmv = &obd->u.lmv;
         struct lustre_handle master_lockh;
-        unsigned long size = 0;
         struct ldlm_lock *lock;
+        unsigned long size = 0;
         struct mds_body *body;
         struct ll_uctxt uctxt;
         struct lmv_obj *obj;
@@ -664,7 +672,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                                         /* it even got the reply refresh attrs
                                          * from that reply */
                                         body = lustre_msg_buf(mreq->rq_repmsg,
-                                                              1,sizeof(*body));
+                                                              1, sizeof(*body));
                                         LASSERT(body != NULL);
                                         goto update; 
                                 }
@@ -737,6 +745,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                 
 update:
                 obj->objs[i].size = body->size;
+                
                 CDEBUG(D_OTHER, "fresh: %lu\n",
                        (unsigned long)obj->objs[i].size);
 
@@ -744,6 +753,7 @@ update:
                         ptlrpc_req_finished(req);
 release_lock:
                 size += obj->objs[i].size;
+
                 if (it.d.lustre.it_lock_mode)
                         ldlm_lock_decref(lockh, it.d.lustre.it_lock_mode);
         }
@@ -752,12 +762,14 @@ release_lock:
                 /* some attrs got refreshed, we have reply and it's time to put
                  * fresh attrs to it */
                 CDEBUG(D_OTHER, "return refreshed attrs: size = %lu\n",
-                       (unsigned long) size);
+                       (unsigned long)size);
+                
                 body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
                 LASSERT(body);
 
-                /* FIXME: what about another attributes? */
+                /* FIXME: what about other attributes? */
                 body->size = size;
+                
                 if (mreq == NULL) {
                         /* very important to maintain lli->mds the same because
                          * of revalidation. mreq == NULL means that caller has