From 7e5be18a3ac2f5138627d7a93670fc88a06cafb5 Mon Sep 17 00:00:00 2001 From: wangdi Date: Mon, 11 Jun 2012 14:32:59 -0700 Subject: [PATCH] LU-1445 fld: Checking lsr_flage after gotten from the cache. Checking lsr_flags after getting the FLD entry from the local cache to make sure the the correct entry is gotten. Signed-off-by: Wang Di Change-Id: I42c01bdb6521b69d6ce6b79e2b5eeec512d0d657 Reviewed-on: http://review.whamcloud.com/3164 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong --- lustre/fld/fld_cache.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lustre/fld/fld_cache.c b/lustre/fld/fld_cache.c index 11cf0c5..8550f91 100644 --- a/lustre/fld/fld_cache.c +++ b/lustre/fld/fld_cache.c @@ -162,7 +162,12 @@ restart_fixup: if (&f_next->fce_list == head) break; - LASSERT(c_range->lsr_start <= n_range->lsr_start); + if (c_range->lsr_flags != n_range->lsr_flags) + continue; + + LASSERTF(c_range->lsr_start <= n_range->lsr_start, + "cur lsr_start "DRANGE" next lsr_start "DRANGE"\n", + PRANGE(c_range), PRANGE(n_range)); /* check merge possibility with next range */ if (c_range->lsr_end == n_range->lsr_start) { @@ -175,12 +180,10 @@ restart_fixup: /* check if current range overlaps with next range. */ if (n_range->lsr_start < c_range->lsr_end) { - if (c_range->lsr_index == n_range->lsr_index) { n_range->lsr_start = c_range->lsr_start; n_range->lsr_end = max(c_range->lsr_end, n_range->lsr_end); - fld_cache_entry_delete(cache, f_curr); } else { if (n_range->lsr_end <= c_range->lsr_end) { @@ -196,9 +199,9 @@ restart_fixup: } /* kill duplicates */ - if (c_range->lsr_start == n_range->lsr_start && - c_range->lsr_end == n_range->lsr_end) - fld_cache_entry_delete(cache, f_curr); + if (c_range->lsr_start == n_range->lsr_start && + c_range->lsr_end == n_range->lsr_end) + fld_cache_entry_delete(cache, f_curr); } EXIT; @@ -390,6 +393,7 @@ void fld_cache_insert(struct fld_cache *cache, cfs_list_t *prev = NULL; const seqno_t new_start = range->lsr_start; const seqno_t new_end = range->lsr_end; + __u32 new_flags = range->lsr_flags; ENTRY; LASSERT(range_is_sane(range)); @@ -415,12 +419,15 @@ void fld_cache_insert(struct fld_cache *cache, cfs_list_for_each_entry_safe(f_curr, n, head, fce_list) { /* add list if next is end of list */ - if (new_end < f_curr->fce_range.lsr_start) + if (new_end < f_curr->fce_range.lsr_start || + (new_end == f_curr->fce_range.lsr_start && + new_flags != f_curr->fce_range.lsr_flags)) break; prev = &f_curr->fce_list; /* check if this range is to left of new range. */ - if (new_start < f_curr->fce_range.lsr_end) { + if (new_start < f_curr->fce_range.lsr_end && + new_flags == f_curr->fce_range.lsr_flags) { fld_cache_overlap_handle(cache, f_curr, f_new); goto out; } @@ -429,6 +436,7 @@ void fld_cache_insert(struct fld_cache *cache, if (prev == NULL) prev = head; + CDEBUG(D_INFO, "insert range "DRANGE"\n", PRANGE(&f_new->fce_range)); /* Add new entry to cache and lru list. */ fld_cache_entry_add(cache, f_new, prev); out: -- 1.8.3.1