From 63019671751e6da6df424db5e99b9f50f127044a Mon Sep 17 00:00:00 2001 From: huanghua Date: Thu, 10 Aug 2006 10:38:59 +0000 Subject: [PATCH] (1) small file count in sanity to avoid large directory which is not supported currently; (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 | 9 +++++++++ lustre/mdt/mdt_handler.c | 8 +++++++- lustre/mdt/mdt_lib.c | 9 ++++++++- lustre/tests/sanity.sh | 4 ++-- lustre/utils/wiretest.c | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index bb5671b..d683cdf 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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 diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index df591a8..a95859c 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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) { diff --git a/lustre/mdt/mdt_lib.c b/lustre/mdt/mdt_lib.c index a7254c4..5f1ebc8 100644 --- a/lustre/mdt/mdt_lib.c +++ b/lustre/mdt/mdt_lib.c @@ -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) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2d854b3..56c7449 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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" } diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index fd6c2f2..66eb6f2 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -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); -- 1.8.3.1