Whamcloud - gitweb
LU-530 group quotas not enforced
authorNiu Yawei <niu@whamcloud.com>
Thu, 28 Jul 2011 10:47:46 +0000 (03:47 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Aug 2011 16:57:59 +0000 (12:57 -0400)
In filter_quota_getflag(), we shouldn't break the loop when the file's owner
doesn't have quota limit, otherwise, the check for file's group will be skipped
and the out of quota flag will not be returned to client at the end.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I3e92ba4c061409d5a911d46916535c71f7843e0b
Reviewed-on: http://review.whamcloud.com/1156
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/quota/quota_interface.c

index 5b3057c..f2c5f9e 100644 (file)
@@ -202,15 +202,17 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa)
 
                 lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)),
                                        qctxt, 0);
-                if (lqs == NULL || IS_ERR(lqs)) {
+                if (IS_ERR(lqs)) {
                         rc = PTR_ERR(lqs);
-                        if (rc)
-                                CDEBUG(D_QUOTA, "search lqs for %s %d failed, "
-                                       "(rc = %d)\n",
-                                       cnt == USRQUOTA ? "user" : "group",
-                                       cnt == USRQUOTA ? oa->o_uid : oa->o_gid,
-                                       rc);
+                        CDEBUG(D_QUOTA, "search lqs for %s %d failed, "
+                               "(rc = %d)\n",
+                               cnt == USRQUOTA ? "user" : "group",
+                               GET_OA_ID(cnt, oa), rc);
                         break;
+                } else if (lqs == NULL) {
+                        /* continue to check group quota if the file's owner
+                         * doesn't have quota limit. LU-530 */
+                        continue;
                 } else {
                         cfs_spin_lock(&lqs->lqs_lock);
                         if (lqs->lqs_bunit_sz <= qctxt->lqc_sync_blk) {