Whamcloud - gitweb
LU-1017 handle -EAGAIN properly in lu_object_find_try()
authorNiu Yawei <niu@whamcloud.com>
Tue, 31 Jan 2012 06:06:47 +0000 (22:06 -0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 13 Feb 2012 17:25:40 +0000 (12:25 -0500)
htable_lookup() could return -EAGAIN for dying object, we should
handle it properly in lu_object_find_try().

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I616928cb983d4f64a64f25b7d296b6c9bd18e4ea
Reviewed-on: http://review.whamcloud.com/2066
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lu_object.c

index 0232cdd..6057254 100644 (file)
@@ -504,6 +504,7 @@ static struct lu_object *htable_lookup(struct lu_site *s,
         h = container_of0(hnode, struct lu_object_header, loh_hash);
         if (likely(!lu_object_is_dying(h))) {
                 lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
         h = container_of0(hnode, struct lu_object_header, loh_hash);
         if (likely(!lu_object_is_dying(h))) {
                 lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
+                cfs_list_del_init(&h->loh_lru);
                 return lu_object_top(h);
         }
 
                 return lu_object_top(h);
         }
 
@@ -600,8 +601,6 @@ static struct lu_object *lu_object_find_try(const struct lu_env *env,
         hs = s->ls_obj_hash;
         cfs_hash_bd_get_and_lock(hs, (void *)f, &bd, 1);
         o = htable_lookup(s, &bd, f, waiter, &version);
         hs = s->ls_obj_hash;
         cfs_hash_bd_get_and_lock(hs, (void *)f, &bd, 1);
         o = htable_lookup(s, &bd, f, waiter, &version);
-        if (o != NULL && !cfs_list_empty(&o->lo_header->loh_lru))
-                cfs_list_del_init(&o->lo_header->loh_lru);
         cfs_hash_bd_unlock(hs, &bd, 1);
         if (o != NULL)
                 return o;
         cfs_hash_bd_unlock(hs, &bd, 1);
         if (o != NULL)
                 return o;