diff --git a/lustre/autoMakefile.am b/lustre/autoMakefile.am
index 866c1fc943f094622a39ad56b35b710d14cf9c6c..8db3ee06e647a6dd713785c3c3906ec93341f966 100644
--- a/lustre/autoMakefile.am
+++ b/lustre/autoMakefile.am
@@ -58,12 +58,11 @@ if CLIENT
 SUBDIRS += $(CLIENT_SUBDIRS)
 endif
 
-if QUOTA
-SUBDIRS += $(QUOTA_SUBDIRS)
-endif
-
 # this needs to be after the client subdirs
 if LIBLUSTRE
+if QUOTA_LIBLUSTRE
+SUBDIRS += $(QUOTA_SUBDIRS)
+endif
 if !CLIENT
 SUBDIRS += $(CLIENT_SUBDIRS)
 endif
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 1559db3dd550f5366e4e9e24d062623c44e3d17f..aa85fdfdd8ea9abba987ba86656c014700e0480f 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1756,7 +1756,8 @@ AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
-AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes -o x$enable_quota_liblustre = xyes)
+AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
+AM_CONDITIONAL(QUOTA_LIBLUSTRE, test x$enable_quota_liblustre = xyes)
 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h
index b8f24c17f9c7171812244c404563115705dd4204..97e93b813fa9bb99b193df93398f5a72b9c23d83 100644
--- a/lustre/include/lustre_quota.h
+++ b/lustre/include/lustre_quota.h
@@ -276,6 +276,9 @@ struct lustre_quota_ctxt {
         struct lprocfs_stats  *lqc_stats; /* lquota statistics */
 };
 
+#define QUOTA_MASTER_READY(qctxt)   (qctxt)->lqc_setup = 1
+#define QUOTA_MASTER_UNREADY(qctxt) (qctxt)->lqc_setup = 0
+
 struct lustre_qunit_size {
         struct hlist_node lqs_hash; /* the hash entry */
         unsigned int lqs_id;        /* id of user/group */
@@ -359,6 +362,9 @@ struct lustre_quota_info {
 struct lustre_quota_ctxt {
 };
 
+#define QUOTA_MASTER_READY(qctxt)
+#define QUOTA_MASTER_UNREADY(qctxt)
+
 #endif /* !HAVE_QUOTA_SUPPORT */
 
 /* If the (quota limit < qunit * slave count), the slave which can't
diff --git a/lustre/liblustre/Makefile.am b/lustre/liblustre/Makefile.am
index cf60902e3e8da2ace74c3468c73f6e4d71efadba..2a0f0e93b9872978203172591b65029751ba21cd 100644
--- a/lustre/liblustre/Makefile.am
+++ b/lustre/liblustre/Makefile.am
@@ -19,7 +19,7 @@ LUSTRE_LIBS = libllite.a \
               $(top_builddir)/lustre/obdclass/liblustreclass.a \
               $(top_builddir)/lustre/lvfs/liblvfs.a
 
-if QUOTA
+if QUOTA_LIBLUSTRE
 QUOTA_LIBS = $(top_builddir)/lustre/quota/libquota.a
 endif
 
diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index 815da94877fb39fc99bae2429382645d275fc9cb..a77af7b523f813b1111a3c7a5686eded4b1e8760 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -1055,11 +1055,9 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
         case OBD_NOTIFY_CONFIG:
                 mds_allow_cli(obd, (unsigned long)data);
 
-#ifdef HAVE_QUOTA_SUPPORT
                 /* quota_type has been processed, we can now handle
                  * incoming quota requests */
-                obd->u.obt.obt_qctxt.lqc_setup = 1;
-#endif
+                QUOTA_MASTER_READY(&obd->u.obt.obt_qctxt);
         default:
                 RETURN(0);
         }
diff --git a/lustre/quota/autoMakefile.am b/lustre/quota/autoMakefile.am
index 66f7a0b067e522a6475155f3128fbc0532a1a591..9b831351584868379c316710e3d33dfd5c7ec0fe 100644
--- a/lustre/quota/autoMakefile.am
+++ b/lustre/quota/autoMakefile.am
@@ -41,7 +41,7 @@ libquota_a_CPPFLAGS = $(LLCPPFLAGS)
 libquota_a_CFLAGS = $(LLCFLAGS)
 endif
 
-if MODULES
+if QUOTA
 modulefs_DATA = lquota$(KMODEXT)
 endif
 
diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c
index bd22456e33daacc57ed648508a3a9da24c48568c..75d476246e5f825784d791024d1aa00541e077fc 100644
--- a/lustre/quota/quota_context.c
+++ b/lustre/quota/quota_context.c
@@ -1136,7 +1136,7 @@ qctxt_init(struct obd_device *obd, dqacq_handler_t handler)
         qctxt->lqc_cqs_least_iunit = 2;
         qctxt->lqc_cqs_qs_factor = 2;
         qctxt->lqc_flags = 0;
-        qctxt->lqc_setup = 0;
+        QUOTA_MASTER_UNREADY(qctxt);
         qctxt->lqc_bunit_sz = default_bunit_sz;
         qctxt->lqc_btune_sz = default_bunit_sz / 100 * default_btune_ratio;
         qctxt->lqc_iunit_sz = default_iunit_sz;