Whamcloud - gitweb
LU-4472 mdc: Fix mdc_page_locate ASSERT 21/8821/7
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Fri, 10 Jan 2014 22:08:19 +0000 (17:08 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 22 Feb 2014 06:49:59 +0000 (06:49 +0000)
Storing hash 0 at same as hash 1 should be okay, don't ASSERT in this
case.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I9b9488e5374d22dcfc9e7f2c969da3b02778097a
Reviewed-on: http://review.whamcloud.com/8821
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/liblustre/llite_lib.h
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_request.c

index 82b5b48..cc12ddf 100644 (file)
@@ -442,9 +442,7 @@ static inline __u64 hash_x_index(__u64 hash, int hash64)
 {
        if (BITS_PER_LONG == 32 && hash64)
                hash >>= 32;
 {
        if (BITS_PER_LONG == 32 && hash64)
                hash >>= 32;
-       /* 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. */
+       /* save hash 0 with hash 1 */
        return ~0ULL - (hash + !hash);
 }
 #endif
        return ~0ULL - (hash + !hash);
 }
 #endif
index cc2816b..a49e9cd 100644 (file)
@@ -179,10 +179,7 @@ static inline unsigned long hash_x_index(__u64 hash, int hash64)
        if (BITS_PER_LONG == 32 && hash64)
                hash >>= 32;
 #endif
        if (BITS_PER_LONG == 32 && hash64)
                hash >>= 32;
 #endif
-       /* 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.
-        */
+       /* save hash 0 with hash 1 */
        return ~0UL - (hash + !hash);
 }
 
        return ~0UL - (hash + !hash);
 }
 
index e111015..1503bf9 100644 (file)
@@ -1233,8 +1233,12 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,
                                *start = le64_to_cpu(dp->ldp_hash_start);
                                *end   = le64_to_cpu(dp->ldp_hash_end);
                        }
                                *start = le64_to_cpu(dp->ldp_hash_start);
                                *end   = le64_to_cpu(dp->ldp_hash_end);
                        }
-                       LASSERTF(*start <= *hash, "start = "LPX64",end = "
-                                LPX64",hash = "LPX64"\n", *start, *end, *hash);
+                       if (unlikely(*start == 1 && *hash == 0))
+                               *hash = *start;
+                       else
+                               LASSERTF(*start <= *hash, "start = "LPX64
+                                        ",end = "LPX64",hash = "LPX64"\n",
+                                        *start, *end, *hash);
                        CDEBUG(D_VFSTRACE, "page%lu [%llu %llu], hash"LPU64"\n",
                               offset, *start, *end, *hash);
                        if (*hash > *end) {
                        CDEBUG(D_VFSTRACE, "page%lu [%llu %llu], hash"LPU64"\n",
                               offset, *start, *end, *hash);
                        if (*hash > *end) {