X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_config.c;h=ed3415e4c526fff0587b6a2a0d973226552b8564;hb=742897a967cff5be53c447d14b17ae405c2b31f2;hp=4fc3a4daf3d833fa0c55e5005f0b31a4b89d37b1;hpb=39f63cf54c624d89439b5b473035c1afe35e10fa;p=fs%2Flustre-release.git diff --git a/lustre/quota/qsd_config.c b/lustre/quota/qsd_config.c index 4fc3a4d..ed3415e 100644 --- a/lustre/quota/qsd_config.c +++ b/lustre/quota/qsd_config.c @@ -31,11 +31,11 @@ #define DEBUG_SUBSYSTEM S_LQUOTA #include -#include +#include #include "qsd_internal.h" -static struct list_head qfs_list = LIST_HEAD_INIT(qfs_list); +static LIST_HEAD(qfs_list); /* protect the qfs_list */ static DEFINE_SPINLOCK(qfs_list_lock); @@ -119,35 +119,13 @@ out: RETURN(qfs); } -/* - * Quota configuration handlers in charge of processing all per-filesystem quota - * parameters set via conf_param. - * - * \param lcfg - quota configuration log to be processed - */ -int qsd_process_config(struct lustre_cfg *lcfg) +int qsd_config(char *valstr, char *fsname, int pool) { - struct qsd_fsinfo *qfs; - char *fsname = lustre_cfg_string(lcfg, 0); - char *cfgstr = lustre_cfg_string(lcfg, 1); - char *keystr, *valstr; - int rc, pool, enabled = 0; - bool reint = false; - ENTRY; - - CDEBUG(D_QUOTA, "processing quota parameter: fs:%s cfgstr:%s\n", fsname, - cfgstr); - - if (class_match_param(cfgstr, PARAM_QUOTA, &keystr) != 0) - RETURN(-EINVAL); - - if (!class_match_param(keystr, QUOTA_METAPOOL_NAME, &valstr)) - pool = LQUOTA_RES_MD; - else if (!class_match_param(keystr, QUOTA_DATAPOOL_NAME, &valstr)) - pool = LQUOTA_RES_DT; - else - RETURN(-EINVAL); + struct qsd_fsinfo *qfs; + int rc, enabled = 0, old_enabled = 0; + bool reint = false; + ENTRY; qfs = qsd_get_fsinfo(fsname, 0); if (qfs == NULL) { CERROR("failed to find quota filesystem information for %s\n", @@ -159,6 +137,8 @@ int qsd_process_config(struct lustre_cfg *lcfg) enabled |= 1 << USRQUOTA; if (strchr(valstr, 'g')) enabled |= 1 << GRPQUOTA; + if (strchr(valstr, 'p')) + enabled |= 1 << PRJQUOTA; mutex_lock(&qfs->qfs_mutex); if (qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] == enabled) @@ -168,6 +148,7 @@ int qsd_process_config(struct lustre_cfg *lcfg) if ((qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] & enabled) != enabled) reint = true; + old_enabled = qfs->qfs_enabled[pool - LQUOTA_FIRST_RES]; qfs->qfs_enabled[pool - LQUOTA_FIRST_RES] = enabled; /* trigger reintegration for all qsd */ @@ -190,6 +171,12 @@ int qsd_process_config(struct lustre_cfg *lcfg) for (type = USRQUOTA; type < LL_MAXQUOTAS; type++) { qqi = qsd->qsd_type_array[type]; + /* only trigger reintegration if this + * type of quota is not enabled before */ + if ((old_enabled & 1 << type) || + !(enabled & 1 << type)) + continue; + if (qqi->qqi_acct_failed) { LCONSOLE_ERROR("%s: can't enable quota " "enforcement since space " @@ -209,3 +196,33 @@ out: qsd_put_fsinfo(qfs); RETURN(0); } + +/* + * Quota configuration handlers in charge of processing all per-filesystem quota + * parameters set via conf_param. + * + * \param lcfg - quota configuration log to be processed + */ +int qsd_process_config(struct lustre_cfg *lcfg) +{ + char *fsname = lustre_cfg_string(lcfg, 0); + char *cfgstr = lustre_cfg_string(lcfg, 1); + char *keystr, *valstr; + int pool; + + ENTRY; + CDEBUG(D_QUOTA, "processing quota parameter: fs:%s cfgstr:%s\n", fsname, + cfgstr); + + if (class_match_param(cfgstr, PARAM_QUOTA, &keystr) != 0) + RETURN(-EINVAL); + + if (!class_match_param(keystr, QUOTA_METAPOOL_NAME, &valstr)) + pool = LQUOTA_RES_MD; + else if (!class_match_param(keystr, QUOTA_DATAPOOL_NAME, &valstr)) + pool = LQUOTA_RES_DT; + else + RETURN(-EINVAL); + + return qsd_config(valstr, fsname, pool); +}