Whamcloud - gitweb
Branch HEAD
authorfanyong <fanyong>
Tue, 7 Jul 2009 01:59:33 +0000 (01:59 +0000)
committerfanyong <fanyong>
Tue, 7 Jul 2009 01:59:33 +0000 (01:59 +0000)
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.

lustre/lvfs/lustre_quota_fmt.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_lproc.c
lustre/quota/lproc_quota.c
lustre/quota/quota_master.c
lustre/tests/sanity.sh

index e633f15..e782624 100644 (file)
@@ -1082,6 +1082,8 @@ int lustre_get_qids(struct file *fp, struct inode *inode, int type,
 
         ENTRY;
 
 
         ENTRY;
 
+        LASSERT(ergo(fp == NULL, inode != NULL));
+
         if (check_quota_file(fp, inode, type, LUSTRE_QUOTA_V2) == 0)
                 version = LUSTRE_QUOTA_V2;
         else {
         if (check_quota_file(fp, inode, type, LUSTRE_QUOTA_V2) == 0)
                 version = LUSTRE_QUOTA_V2;
         else {
index 627261d..dafe372 100644 (file)
@@ -1765,13 +1765,6 @@ static int mdt_quotactl_handle(struct mdt_thread_info *info)
 
         switch (oqctl->qc_cmd) {
         case Q_QUOTAON:
 
         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:
                 rc = mqo->mqo_on(info->mti_env, next, oqctl->qc_type);
                 break;
         case Q_QUOTAOFF:
index 1874ff8..39285bc 100644 (file)
@@ -713,8 +713,12 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer,
                 return count;
         }
 
                 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");
 
         mdt->mdt_som_conf = val;
         LCONSOLE_INFO("Enabling SOM\n");
index 3231926..7e607f9 100644 (file)
@@ -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");
         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;
         }
 
         oqctl->qc_type = type;
@@ -306,8 +306,12 @@ int lprocfs_quota_wr_type(struct file *file, const char *buffer,
         }
 
         if (type != 0) {
         }
 
         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;
         }
 
         return count;
index 9edffbe..21265c2 100644 (file)
@@ -854,7 +854,13 @@ int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
                 RETURN(-EINVAL);
 
         down(&obt->obt_quotachecking);
                 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);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         down(&mds->mds_qonoff_sem);
         rc2 = mds_admin_quota_on(obd, oqctl);
index 64d07a4..899d1a6 100644 (file)
@@ -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)
         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
 
         gl1=$(get_ost_param "ldlm_glimpse_enqueue")
         stat $DIR/$tfile >/dev/null