Whamcloud - gitweb
b=15134
[fs/lustre-release.git] / lustre / quota / quota_interface.c
index 5cf9505..2ef1b67 100644 (file)
 # include <linux/init.h>
 # include <linux/fs.h>
 # include <linux/jbd.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-#  include <linux/smp_lock.h>
-#  include <linux/buffer_head.h>
-#  include <linux/workqueue.h>
-#  include <linux/mount.h>
-# else
-#  include <linux/locks.h>
-# endif
+# include <linux/smp_lock.h>
+# include <linux/buffer_head.h>
+# include <linux/workqueue.h>
+# include <linux/mount.h>
 #else /* __KERNEL__ */
 # include <liblustre.h>
 #endif
@@ -141,6 +137,7 @@ static int filter_quota_clearinfo(struct obd_export *exp, struct obd_device *obd
                 spin_lock(&qctxt->lqc_lock);
                 qctxt->lqc_import = NULL;
                 spin_unlock(&qctxt->lqc_lock);
+                dqacq_interrupt(qctxt);
                 CDEBUG(D_QUOTA, "%s: lqc_import of obd(%p) is invalid now.\n",
                        obd->obd_name, obd);
         }
@@ -287,14 +284,17 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid,
                                 /* in order to complete this write, we need extra
                                  * meta blocks. This function can get it through
                                  * data needed to be written b=16542 */
-                                mb = *pending;
-                                LASSERT(inode && frags > 0);
-                                if (fsfilt_get_mblk(obd, qctxt->lqc_sb, &mb,
-                                                    inode, frags) < 0)
-                                        CDEBUG(D_ERROR,
-                                               "can't get extra meta blocks.\n");
-                                else
-                                        *pending += mb;
+                                if (inode) {
+                                        mb = *pending;
+                                        rc = fsfilt_get_mblk(obd, qctxt->lqc_sb,
+                                                             &mb, inode,frags);
+                                        if (rc)
+                                                CDEBUG(D_ERROR,
+                                                       "can't get extra "
+                                                       "meta blocks.\n");
+                                        else
+                                                *pending += mb;
+                                }
                                 lqs->lqs_bwrite_pending += *pending;
                         } else {
                                 *pending = count;
@@ -381,7 +381,7 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid,
 
                 /* please reference to dqacq_completion for the below */
                 /* a new request is finished, try again */
-                if (rc == -EAGAIN) {
+                if (rc == QUOTA_REQ_RETURNED) {
                         CDEBUG(D_QUOTA, "finish a quota req, try again\n");
                         continue;
                 }