Whamcloud - gitweb
LU-1445 fld: Checking lsr_flage after gotten from the cache.
authorwangdi <di.wang@whamcloud.com>
Mon, 11 Jun 2012 21:32:59 +0000 (14:32 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 5 Jul 2012 09:28:13 +0000 (05:28 -0400)
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 <di.wang@whamcloud.com>
Change-Id: I42c01bdb6521b69d6ce6b79e2b5eeec512d0d657
Reviewed-on: http://review.whamcloud.com/3164
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
lustre/fld/fld_cache.c

index 11cf0c5..8550f91 100644 (file)
@@ -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: