Whamcloud - gitweb
LU-2152 iam: it->load fix
authorNiu Yawei <niu@whamcloud.com>
Mon, 15 Oct 2012 03:42:01 +0000 (23:42 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Oct 2012 20:04:43 +0000 (16:04 -0400)
Current iam it->load for lfix doesn't work properly because
iam_lfix_ilookup() isn't implemented at all.

This patch also added one more reintegration test for quota to
test the global index transfer in multiple bulks, and proc entry
for global index copy is added to verify the limits on slaves
easily.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ifb1dca0551b2aa4db3d37ff4ac6b3fcded34b7cc
Reviewed-on: http://review.whamcloud.com/4266
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/include/obd_support.h
lustre/obdclass/dt_object.c
lustre/osd-ldiskfs/osd_iam_lfix.c
lustre/quota/lproc_quota.c
lustre/quota/qsd_lib.c
lustre/tests/sanity-quota.sh

index 480d1b2..d7bf1ac 100644 (file)
@@ -375,6 +375,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_OBD_LLOG_SETUP          0x605
 #define OBD_FAIL_OBD_LOG_CANCEL_REP      0x606
 #define OBD_FAIL_OBD_IDX_READ_NET        0x607
+#define OBD_FAIL_OBD_IDX_READ_BREAK     0x608
 
 #define OBD_FAIL_TGT_REPLY_NET           0x700
 #define OBD_FAIL_TGT_CONN_RACE           0x701
index ce0f45a..2465179 100644 (file)
@@ -675,6 +675,11 @@ static int dt_index_page_build(const struct lu_env *env, union lu_page *lp,
                hash = iops->store(env, it);
                ii->ii_hash_end = hash;
 
+               if (OBD_FAIL_CHECK(OBD_FAIL_OBD_IDX_READ_BREAK)) {
+                       if (lip->lip_nr != 0)
+                               GOTO(out, rc = 0);
+               }
+
                if (nob < size) {
                        if (lip->lip_nr == 0)
                                GOTO(out, rc = -EINVAL);
index 31938dc..ac1a1be 100644 (file)
@@ -331,8 +331,7 @@ static int iam_lfix_lookup(struct iam_leaf *l, const struct iam_key *k)
 
 static int iam_lfix_ilookup(struct iam_leaf *l, const struct iam_ikey *ik)
 {
-        assert(0);
-        return IAM_LOOKUP_OK;
+       return iam_lfix_lookup(l, (const struct iam_key *)ik);
 }
 
 static void iam_lfix_key_set(struct iam_leaf *l, const struct iam_key *k)
index 9c65526..0d5e710 100644 (file)
@@ -201,6 +201,9 @@ static int lprocfs_quota_seq_show(struct seq_file *p, void *v)
 
                        seq_printf(p, "global_pool%d_%s_%s\n", poolid,
                                   RES_NAME(rtype), QTYPE_NAME(qtype));
+               } else if (fid_seq(fid) == FID_SEQ_LOCAL_NAME) {
+                       /* global index copy object */
+                       seq_printf(p, "global_index_copy:\n");
                } else {
                        return -ENOTSUPP;
                }
@@ -231,7 +234,8 @@ static int lprocfs_quota_seq_show(struct seq_file *p, void *v)
                           "u }\n", "usage:",
                           ((struct lquota_acct_rec *)rec)->ispace,
                           toqb(((struct lquota_acct_rec *)rec)->bspace));
-       else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB)
+       else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB ||
+                fid_seq(fid) == FID_SEQ_LOCAL_NAME)
                seq_printf(p, "  %-8s { hard: %20"LPF64"u, soft: %20"LPF64
                           "u, granted: %20"LPF64"u, time: %20"LPF64"u }\n",
                           "limits:",
index 2514a63..64c537e 100644 (file)
@@ -401,7 +401,7 @@ static int qsd_qtype_init(const struct lu_env *env, struct qsd_instance *qsd,
                GOTO(out, rc = PTR_ERR(qqi->qqi_site));
        }
 
-       /* register proc entry for accounting object */
+       /* register proc entry for accounting & global index copy objects */
        rc = lprocfs_seq_create(qsd->qsd_proc,
                                qtype == USRQUOTA ? "acct_user" : "acct_group",
                                0444, &lprocfs_quota_seq_fops,
@@ -411,6 +411,16 @@ static int qsd_qtype_init(const struct lu_env *env, struct qsd_instance *qsd,
                       qsd->qsd_svname, rc);
                GOTO(out, rc);
        }
+
+       rc = lprocfs_seq_create(qsd->qsd_proc,
+                               qtype == USRQUOTA ? "limit_user" : "limit_group",
+                               0444, &lprocfs_quota_seq_fops,
+                               qqi->qqi_glb_obj);
+       if (rc) {
+               CERROR("%s: can't add procfs entry for global index copy %d\n",
+                      qsd->qsd_svname, rc);
+               GOTO(out, rc);
+       }
        EXIT;
 out:
        if (rc)
index 366bbdf..7ac5f48 100644 (file)
@@ -1044,6 +1044,42 @@ test_7c() {
 }
 run_test 7c "Quota reintegration (restart mds during reintegration)"
 
+# Quota reintegration (Transfer index in multiple bulks)
+test_7d(){
+       local TESTFILE=$DIR/$tdir/$tfile
+       local TESTFILE1="$DIR/$tdir/$tfile"-1
+       local limit=20 #20M
+
+       setup_quota_test
+       trap cleanup_quota_test EXIT
+
+       set_ost_qtype "none" || error "disable ost quota failed"
+       $LFS setquota -u $TSTUSR -B ${limit}M $DIR
+       $LFS setquota -u $TSTUSR2 -B ${limit}M $DIR
+
+       #define OBD_FAIL_OBD_IDX_READ_BREAK 0x608
+       lustre_fail mds 0x608 0
+
+       # enable quota to tirgger reintegration
+       set_ost_qtype "u" || error "enable ost quota failed"
+       wait_ost_reint "u" || error "reintegration failed"
+
+       lustre_fail mds 0
+
+       # hardlimit should have been fetched by slave during global
+       # reintegration, write will exceed quota
+       $RUNAS $DD of=$TESTFILE count=$((limit + 1)) oflag=sync &&
+               quota_error u $TSTUSR "$TSTUSR write success, expect EDQUOT"
+
+       $RUNAS2 $DD of=$TESTFILE1 count=$((limit + 1)) oflag=sync &&
+               quota_error u $TSTUSR2 "$TSTUSR2 write success, expect EDQUOT"
+
+       cleanup_quota_test
+       resetquota -u $TSTUSR
+       resetquota -u $TSTUSR2
+}
+run_test 7d "Quota reintegration (Transfer index in multiple bulks)"
+
 # run dbench with quota enabled
 test_8() {
        local BLK_LIMIT="100g" #100G
@@ -1995,7 +2031,7 @@ test_36() {
 
        local proc="qmt.*.md-0x0.glb-usr"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 401 ] || error "Migrate inode user limit failed: $id_cnt"
+       [ $id_cnt -eq 403 ] || error "Migrate inode user limit failed: $id_cnt"
        limit=$(getquota -u 1 global isoftlimit)
        [ $limit -eq 1024 ] || error "User inode softlimit: $limit"
        limit=$(getquota -u 1 global ihardlimit)
@@ -2003,7 +2039,7 @@ test_36() {
 
        proc="qmt.*.md-0x0.glb-grp"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 401 ] || error "Migrate inode group limit failed: $id_cnt"
+       [ $id_cnt -eq 403 ] || error "Migrate inode group limit failed: $id_cnt"
        limit=$(getquota -g 1 global isoftlimit)
        [ $limit -eq 1024 ] || error "Group inode softlimit: $limit"
        limit=$(getquota -g 1 global ihardlimit)
@@ -2011,7 +2047,7 @@ test_36() {
 
        proc=" qmt.*.dt-0x0.glb-usr"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 401 ] || error "Migrate block user limit failed: $id_cnt"
+       [ $id_cnt -eq 403 ] || error "Migrate block user limit failed: $id_cnt"
        limit=$(getquota -u 60001 global bsoftlimit)
        [ $limit -eq 10485760 ] || error "User block softlimit: $limit"
        limit=$(getquota -u 60001 global bhardlimit)
@@ -2019,7 +2055,7 @@ test_36() {
 
        proc="qmt.*.dt-0x0.glb-grp"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 401 ] || error "Migrate block user limit failed: $id_cnt"
+       [ $id_cnt -eq 403 ] || error "Migrate block user limit failed: $id_cnt"
        limit=$(getquota -g 60001 global bsoftlimit)
        [ $limit -eq 10485760 ] || error "Group block softlimit: $limit"
        limit=$(getquota -g 60001 global bhardlimit)