Whamcloud - gitweb
LU-4223 utils: fixing loop leaking in utils
[fs/lustre-release.git] / lustre / include / lustre_lite.h
index d03daab..7729bdb 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -123,7 +123,7 @@ struct lustre_client_ocd {
          * under ->lco_lock.
          */
         __u64              lco_flags;
-        cfs_mutex_t        lco_lock;
+       struct mutex       lco_lock;
         struct obd_export *lco_md_exp;
         struct obd_export *lco_dt_exp;
 };
@@ -146,10 +146,14 @@ static inline void ll_dir_chain_fini(struct ll_dir_chain *chain)
 static inline unsigned long hash_x_index(__u64 hash, int hash64)
 {
 #ifdef __KERNEL__
-        if (BITS_PER_LONG == 32 && hash64)
-                hash >>= 32;
+       if (BITS_PER_LONG == 32 && hash64)
+               hash >>= 32;
 #endif
-        return ~0UL - hash;
+       /* save hash 0 as index 0 because otherwise we'll save it at
+        * page index end (~0UL) and it causes truncate_inode_pages_range()
+        * to loop forever.
+        */
+       return ~0UL - (hash + !hash);
 }
 
 /** @} lite */