Whamcloud - gitweb
LU-15055 lod: run qmt_pool_* only from the MDT0000 config 59/47059/6
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Wed, 13 Apr 2022 14:43:12 +0000 (16:43 +0200)
committerOleg Drokin <green@whamcloud.com>
Mon, 27 Jun 2022 04:57:15 +0000 (04:57 +0000)
On the first mds (with MDT0000/QMT0000), if there is more than one MDT
target, qmt_pool_{new/del/rem/add} functions will be call several
times on QMT0000 for the same pool.

This resulting to the following error in dmseg:
LustreError: 5659:0:(qmt_pool.c:1390:qmt_pool_add_rem()) add to: can't
scratch-QMT0000 scratch-OST0000_UUID pool pool1: rc = -17

This patch run qmt_pool_* only from a record config from the MDT0000.
The qmt_pool_add_rem() dmesg error is checked on sanity-quota test_1b.

Test-Parameters: mdtcount=2 mdscount=1 testlist=sanity-quota
Fixes: 09f9fb32 ("LU-11023 quota: quota pools for OSTs")
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: Ia6b712abe25a4d68770753e3408c3321181db1aa
Reviewed-on: https://review.whamcloud.com/47059
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_dev.c
lustre/quota/qmt_pool.c
lustre/tests/sanity-quota.sh

index e535d2e..7021419 100644 (file)
@@ -2219,11 +2219,22 @@ static struct obd_device *obd_find_qmt0(char *obd_name)
        return qmt;
 }
 
        return qmt;
 }
 
+/* Run QMT0000 pool operations only for MDT0000 */
+static inline bool lod_pool_need_qmt0(const char *obd_name)
+{
+       __u32 idx;
+       int type;
+
+       type = server_name2index(obd_name, &idx, NULL);
+
+       return type == LDD_F_SV_TYPE_MDT && idx == 0;
+}
+
 static int lod_pool_new_q(struct obd_device *obd, char *poolname)
 {
        int err = lod_pool_new(obd, poolname);
 
 static int lod_pool_new_q(struct obd_device *obd, char *poolname)
 {
        int err = lod_pool_new(obd, poolname);
 
-       if (!err) {
+       if (!err && lod_pool_need_qmt0(obd->obd_name)) {
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_new(obd, poolname);
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_new(obd, poolname);
@@ -2237,7 +2248,7 @@ static int lod_pool_remove_q(struct obd_device *obd, char *poolname,
 {
        int err = lod_pool_remove(obd, poolname, ostname);
 
 {
        int err = lod_pool_remove(obd, poolname, ostname);
 
-       if (!err) {
+       if (!err && lod_pool_need_qmt0(obd->obd_name)) {
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_rem(obd, poolname, ostname);
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_rem(obd, poolname, ostname);
@@ -2250,7 +2261,7 @@ static int lod_pool_add_q(struct obd_device *obd, char *poolname, char *ostname)
 {
        int err = lod_pool_add(obd, poolname, ostname);
 
 {
        int err = lod_pool_add(obd, poolname, ostname);
 
-       if (!err) {
+       if (!err && lod_pool_need_qmt0(obd->obd_name)) {
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_add(obd, poolname, ostname);
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_add(obd, poolname, ostname);
@@ -2263,7 +2274,7 @@ static int lod_pool_del_q(struct obd_device *obd, char *poolname)
 {
        int err = lod_pool_del(obd, poolname);
 
 {
        int err = lod_pool_del(obd, poolname);
 
-       if (!err) {
+       if (!err && lod_pool_need_qmt0(obd->obd_name)) {
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_del(obd, poolname);
                obd = obd_find_qmt0(obd->obd_name);
                if (obd)
                        obd_pool_del(obd, poolname);
index 4b6004a..dcfb7c7 100644 (file)
@@ -1397,9 +1397,10 @@ static int qmt_pool_add_rem(struct obd_device *obd, char *poolname,
        rc = add ? qmt_sarr_pool_add(qpi, idx, 32) :
                   qmt_sarr_pool_rem(qpi, idx);
        if (rc) {
        rc = add ? qmt_sarr_pool_add(qpi, idx, 32) :
                   qmt_sarr_pool_rem(qpi, idx);
        if (rc) {
-               CERROR("%s: can't %s %s pool %s: rc = %d\n",
-                      add ? "add to" : "remove", obd->obd_name,
-                      slavename, poolname, rc);
+               /* message is checked in sanity-quota test_1b */
+               CERROR("%s: can't %s %s pool '%s': rc = %d\n",
+                      obd->obd_name, add ? "add to" : "remove", slavename,
+                      poolname, rc);
                GOTO(out_putref, rc);
        }
        qmt_pool_slv_nr_change(&env, qpi, idx, add);
                GOTO(out_putref, rc);
        }
        qmt_pool_slv_nr_change(&env, qpi, idx, add);
index cfcc258..d36cefe 100755 (executable)
@@ -708,6 +708,12 @@ test_1b() {
        pool_add_targets $qpool 0 $(($OSTCOUNT - 1)) ||
                error "pool_add_targets failed"
 
        pool_add_targets $qpool 0 $(($OSTCOUNT - 1)) ||
                error "pool_add_targets failed"
 
+       # check qmt_pool_add dmesg error
+       local msg_rgx="QMT0000: can't add to $FSNAME-OST0000.*pool.*$qpool"
+       local dmesg_err
+       dmesg_err=$(do_facet mds1 dmesg | grep "$msg_rgx" | tail -1)
+       [[ -z "$dmesg_err" ]] || error "found qmt_pool_add error: $dmesg_err"
+
        $LFS setquota -u $TSTUSR -B ${limit}M --pool $qpool $DIR ||
                error "set user quota failed"
 
        $LFS setquota -u $TSTUSR -B ${limit}M --pool $qpool $DIR ||
                error "set user quota failed"