Whamcloud - gitweb
(1) small file count in sanity to avoid large directory which is not supported currently;
authorhuanghua <huanghua>
Thu, 10 Aug 2006 10:38:59 +0000 (10:38 +0000)
committerhuanghua <huanghua>
Thu, 10 Aug 2006 10:38:59 +0000 (10:38 +0000)
(2) in mdt_getattr_internal(), set different flag for regular file and dir;
(3) ajust wiretest to fix current implementation.

lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_lib.c
lustre/tests/sanity.sh
lustre/utils/wiretest.c

index bb5671b..d683cdf 100644 (file)
@@ -395,6 +395,10 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
         LASSERT_REPSWABBED (req, offset);
         offset++;
 
+        if (!(md->body->valid & OBD_MD_FLEASIZE) &&
+            !(md->body->valid & OBD_MD_FLDIREA))
+                RETURN(0);
+
         if (md->body->valid & OBD_MD_FLEASIZE) {
                 int lmmsize;
                 struct lov_mds_md *lmm;
@@ -418,6 +422,11 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
                 rc = 0;
 
                 offset++;
+        } else if (md->body->valid & OBD_MD_FLDIREA) {
+                /* TODO: umka, please handle this case */
+                LASSERT(S_ISDIR(md->body->mode));
+                CDEBUG(D_ERROR, "I got ea for dir. What to do?\n");
+                offset++;
         }
 
         /* for ACL, it's possible that FLACL is set but aclsize is zero.  only
index df591a8..a95859c 100644 (file)
@@ -247,6 +247,8 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
 
         if (ma->ma_valid & MA_INODE)
                 mdt_pack_attr2body(repbody, la, mdt_object_fid(o));
+        else
+                RETURN(-EFAULT);
 
         if (mdt_body_has_lov(la, reqbody)) {
                 if (/*ma->ma_lmm_size && */(ma->ma_valid & MA_LOV)) {
@@ -255,7 +257,11 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                                         PFID(mdt_object_fid(o)));
                         mdt_dump_lmm(D_INFO, ma->ma_lmm);
                         repbody->eadatasize = ma->ma_lmm_size;
-                        repbody->valid |= OBD_MD_FLEASIZE;
+                        if (S_ISDIR(la->la_mode))
+                                repbody->valid |= OBD_MD_FLDIREA;
+                        else
+                                repbody->valid |= OBD_MD_FLEASIZE;
+
                 }
         } else if (S_ISLNK(la->la_mode) &&
                           reqbody->valid & OBD_MD_LINKNAME) {
index a7254c4..5f1ebc8 100644 (file)
@@ -54,11 +54,18 @@ void mdt_dump_lmm(int level, struct lov_mds_md *lmm)
                le32_to_cpu(lmm->lmm_stripe_size),
                le32_to_cpu(lmm->lmm_stripe_count));
         for (i = 0, lod = lmm->lmm_objects;
-             i < le32_to_cpu(lmm->lmm_stripe_count); i++, lod++)
+             i < le32_to_cpu(lmm->lmm_stripe_count); i++, lod++) {
                 CDEBUG_EX(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
                        i, le32_to_cpu(lod->l_ost_idx),
                        le64_to_cpu(lod->l_object_gr),
                        le64_to_cpu(lod->l_object_id));
+                if (i > LOV_MAX_STRIPE_COUNT) {
+                        CDEBUG_EX(level, "Do we really have so much"
+                                         " stripe:0x%x?\n",
+                                        le32_to_cpu(lmm->lmm_stripe_count));
+                        return;
+                }
+        }
 }
 
 void mdt_shrink_reply(struct mdt_thread_info *info)
index 2d854b3..56c7449 100644 (file)
@@ -2257,7 +2257,7 @@ test_57a() {
 run_test 57a "verify MDS filesystem created with large inodes =="
 
 test_57b() {
-       FILECOUNT=100
+       FILECOUNT=10
        FILE1=$DIR/d57b/f1
        FILEN=$DIR/d57b/f$FILECOUNT
        rm -rf $DIR/d57b || error "removing $DIR/d57b"
@@ -2410,7 +2410,7 @@ run_test 65a "directory with no stripe info ===================="
 
 test_65b() {
        mkdir -p $DIR/d65
-       $LSTRIPE $DIR/d65 $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
+       $LSTRIPE $DIR/d65 $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
        touch $DIR/d65/f2
        $LVERIFY $DIR/d65 $DIR/d65/f2 || error "lverify failed"
 }
index fd6c2f2..66eb6f2 100644 (file)
@@ -127,7 +127,7 @@ void lustre_assert_wire_constants(void)
                  (long long)MDS_QUOTACHECK);
         LASSERTF(MDS_QUOTACTL == 48, " found %lld\n",
                  (long long)MDS_QUOTACTL);
-        LASSERTF(MDS_LAST_OPC == 52, " found %lld\n",
+        LASSERTF(MDS_LAST_OPC == 51, " found %lld\n",
                  (long long)MDS_LAST_OPC);
         LASSERTF(REINT_SETATTR == 1, " found %lld\n",
                  (long long)REINT_SETATTR);