Whamcloud - gitweb
add 2.6.27 kernel support
[fs/lustre-release.git] / lustre / lvfs / lustre_quota_fmt.c
index e633f15..9508437 100644 (file)
@@ -50,7 +50,9 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/quotaio_v1.h>
+#ifdef HAVE_QUOTAIO_V1_H
+# include <linux/quotaio_v1.h>
+#endif
 
 #include <asm/byteorder.h>
 #include <asm/uaccess.h>
@@ -97,6 +99,12 @@ int check_quota_file(struct file *f, struct inode *inode, int type,
         static const uint quota_magics[] = LUSTRE_INITQMAGICS;
         const uint *quota_versions = lustre_initqversions[version];
 
+        if (!inode && !f) {
+                CERROR("check_quota_file failed!\n");
+                libcfs_debug_dumpstack(NULL);
+                return -EINVAL;
+        }
+
         if (f) {
                 fs = get_fs();
                 set_fs(KERNEL_DS);
@@ -837,7 +845,7 @@ int lustre_read_dquot(struct lustre_dquot *dquot)
         /* Invalidated quota? */
         if (!dquot->dq_info || !(filp = dquot->dq_info->qi_files[type])) {
                 CDEBUG(D_ERROR, "VFS: Quota invalidated while reading!\n");
-                return -EIO;
+                return -ESRCH;
         }
 
         version = dquot->dq_info->qi_version;
@@ -1082,6 +1090,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 {