Whamcloud - gitweb
b=21147 be tolerant to setting the same type and version of quota
[fs/lustre-release.git] / lustre / lvfs / upcall_cache.c
index 6de1dac..6ad44b2 100644 (file)
@@ -1,29 +1,48 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  Supplementary groups cache.
+ * GPL HEADER START
  *
- *  Copyright (c) 2004 Cluster File Systems, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *   This file is part of Lustre, http://www.lustre.org.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
  *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/lvfs/upcall_cache.c
+ *
+ * Supplementary groups cache.
  */
 
 #define DEBUG_SUBSYSTEM S_SEC
 
+#ifndef AUTOCONF_INCLUDED
 #include <linux/config.h>
+#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -41,7 +60,6 @@
 #include <linux/stat.h>
 #include <asm/uaccess.h>
 #include <linux/slab.h>
-#include <asm/segment.h>
 
 #include <obd_support.h>
 #include <lustre_lib.h>
@@ -94,7 +112,7 @@ static struct upcall_cache_entry *alloc_entry(__u64 key)
 static void free_entry(struct upcall_cache_entry *entry)
 {
         if (entry->ue_group_info)
-                groups_free(entry->ue_group_info);
+                put_group_info(entry->ue_group_info);
         list_del(&entry->ue_hash);
         CDEBUG(D_OTHER, "destroy cache entry %p for key "LPU64"\n",
                entry, entry->ue_key);
@@ -198,7 +216,7 @@ static int entry_set_group_info(struct upcall_cache_entry *entry, __u32 primary,
         entry->ue_primary = primary;
 
         for (i = 0; i < ginfo->nblocks; i++) {
-                int cp_count = min(NGROUPS_PER_BLOCK, (int)ngroups);
+                int cp_count = min_t(int, NGROUPS_PER_BLOCK, ngroups);
                 int off = i * NGROUPS_PER_BLOCK;
 
                 for (j = 0; j < cp_count; j++)
@@ -320,8 +338,8 @@ find_again:
                         static unsigned long next;
                         /* we're interrupted or upcall failed in the middle */
                         if (time_after(jiffies, next)) {
-                                CERROR("key "LPU64" update failed: check %s\n",
-                                       entry->ue_key, hash->uc_upcall);
+                                CERROR("acquire timeout exceeded for key "LPU64
+                                       "\n", entry->ue_key);
                                 next = jiffies + 1800;
                         }
                         put_entry(entry);
@@ -415,7 +433,7 @@ int upcall_cache_downcall(struct upcall_cache *hash, __u32 err, __u64 key,
         }
 
         if (!UC_CACHE_IS_ACQUIRING(entry)) {
-                CERROR("%s: found uptodate entry %p (key "LPU64") in ioctl\n",
+                CDEBUG(D_RPCTRACE,"%s: found uptodate entry %p (key "LPU64")\n",
                        hash->uc_name, entry, entry->ue_key);
                 GOTO(out, rc = 0);
         }
@@ -500,8 +518,8 @@ struct upcall_cache *upcall_cache_init(const char *name)
         strncpy(hash->uc_name, name, sizeof(hash->uc_name) - 1);
         /* set default value, proc tunable */
         strcpy(hash->uc_upcall, "NONE");
-        hash->uc_entry_expire = 5 * 60 * HZ;
-        hash->uc_acquire_expire = 5 * HZ;
+        hash->uc_entry_expire = 10 * 60 * HZ;
+        hash->uc_acquire_expire = 15 * HZ;
 
         RETURN(hash);
 }