From: fanyong Date: Tue, 7 Jul 2009 01:59:33 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_220~55 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=342caced07fdaca95d5ab4091e947116738ef69a;p=fs%2Flustre-release.git Branch HEAD b=19802 i=vitaly.fertman i=robert.read mdt_quota_off should process "-EALREADY" case. b=20002 i=tianzy i=robert.read check "auto_quota_on()" return value before "build_lqs()" called b=20017 i=vitaly.fertman i=tappro MDS should return some error when quota on with SOM conflict found. --- diff --git a/lustre/lvfs/lustre_quota_fmt.c b/lustre/lvfs/lustre_quota_fmt.c index e633f15..e782624 100644 --- a/lustre/lvfs/lustre_quota_fmt.c +++ b/lustre/lvfs/lustre_quota_fmt.c @@ -1082,6 +1082,8 @@ int lustre_get_qids(struct file *fp, struct inode *inode, int type, ENTRY; + LASSERT(ergo(fp == NULL, inode != NULL)); + if (check_quota_file(fp, inode, type, LUSTRE_QUOTA_V2) == 0) version = LUSTRE_QUOTA_V2; else { diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 627261d..dafe372 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1765,13 +1765,6 @@ static int mdt_quotactl_handle(struct mdt_thread_info *info) switch (oqctl->qc_cmd) { case Q_QUOTAON: - if (info->mti_mdt->mdt_som_conf) { - /* Quota cannot be used together with SOM while - * SOM stored blocks in i_blocks but not in SOM EA. */ - LCONSOLE_ERROR("Fail to turn Quota on: SOM is enabled " - "and temporary conflicts with quota.\n"); - RETURN(-ENOTSUPP); - } rc = mqo->mqo_on(info->mti_env, next, oqctl->qc_type); break; case Q_QUOTAOFF: diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 1874ff8..39285bc 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -713,8 +713,12 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer, return count; } - if ((rc = mdt_quota_off(mdt))) - return rc; + if ((rc = mdt_quota_off(mdt))) { + if (rc == -EALREADY) + rc = 0; + else + return rc; + } mdt->mdt_som_conf = val; LCONSOLE_INFO("Enabling SOM\n"); diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index 3231926..7e607f9 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -226,7 +226,7 @@ static int auto_quota_on(struct obd_device *obd, int type, if (obt->obt_qctxt.lqc_immutable) { LCONSOLE_ERROR("Failed to turn Quota on, immutable mode " "(is SOM enabled?)\n"); - GOTO(out, rc); + GOTO(out, rc = -ECANCELED); } oqctl->qc_type = type; @@ -306,8 +306,12 @@ int lprocfs_quota_wr_type(struct file *file, const char *buffer, } if (type != 0) { - auto_quota_on(obd, type - 1, obt->obt_sb, is_mds); - build_lqs(obd); + int rc = auto_quota_on(obd, type - 1, obt->obt_sb, is_mds); + + if (rc == 0) + build_lqs(obd); + else if (rc != -EALREADY) + return rc; } return count; diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 9edffbe..21265c2 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -854,7 +854,13 @@ int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl) RETURN(-EINVAL); down(&obt->obt_quotachecking); - LASSERT(!obt->obt_qctxt.lqc_immutable); + if (obt->obt_qctxt.lqc_immutable) { + LCONSOLE_ERROR("Failed to turn Quota on, immutable mode " + "(is SOM enabled?)\n"); + up(&obt->obt_quotachecking); + RETURN(-ECANCELED); + } + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); down(&mds->mds_qonoff_sem); rc2 = mds_admin_quota_on(obd, oqctl); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 64d07a4..899d1a6 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5962,7 +5962,14 @@ test_132() { #1028, SOM som_mode_switch $som1 $gl1 $gl2 som2=$(do_facet $mymds "$LCTL get_param mdt.*.som" | awk -F= ' {print $2}' | head -n 1) - [ $som1 != $som2 ] || error "som is still "$som2 + if [ $som1 == $som2 ]; then + error "som is still "$som2 + if [ x$som2 = x"enabled" ]; then + som2="disabled" + else + som2="enabled" + fi + fi gl1=$(get_ost_param "ldlm_glimpse_enqueue") stat $DIR/$tfile >/dev/null