From: Nathaniel Clark Date: Fri, 10 Jan 2014 22:08:19 +0000 (-0500) Subject: LU-4472 mdc: Fix mdc_page_locate ASSERT X-Git-Tag: 2.5.56~25 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=dbb6623ef78a60c4fe71e798d52f8ec37281c12f;p=fs%2Flustre-release.git LU-4472 mdc: Fix mdc_page_locate ASSERT Storing hash 0 at same as hash 1 should be okay, don't ASSERT in this case. Signed-off-by: Nathaniel Clark Change-Id: I9b9488e5374d22dcfc9e7f2c969da3b02778097a Reviewed-on: http://review.whamcloud.com/8821 Tested-by: Jenkins Reviewed-by: Fan Yong Reviewed-by: Lai Siyao Reviewed-by: Peng Tao Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index 82b5b48..cc12ddf 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -442,9 +442,7 @@ static inline __u64 hash_x_index(__u64 hash, int hash64) { 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 diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index cc2816b..a49e9cd 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -179,10 +179,7 @@ static inline unsigned long hash_x_index(__u64 hash, int hash64) 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); } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index e111015..1503bf9 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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); } - 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) {