From 81860d817411a0c33594b42e7daa4f57665274a3 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 25 May 2015 07:19:56 -0400 Subject: [PATCH] LU-6636 libcfs: minor fix in cfs_hash_for_each_relax() cfs_hash_for_each_relax() should break iteration when callback returns non-zero value. Signed-off-by: Niu Yawei Change-Id: I92d35be4b11931cae252646ab2d1f8e5599037f1 Reviewed-on: http://review.whamcloud.com/14927 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin --- libcfs/libcfs/hash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcfs/libcfs/hash.c b/libcfs/libcfs/hash.c index 43dc673..f2a7ca5 100644 --- a/libcfs/libcfs/hash.c +++ b/libcfs/libcfs/hash.c @@ -1648,8 +1648,12 @@ cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, if (rc) /* callback wants to break iteration */ break; } + if (rc) /* callback wants to break iteration */ + break; } cfs_hash_bd_unlock(hs, &bd, 0); + if (rc) /* callback wants to break iteration */ + break; } cfs_hash_unlock(hs, 0); -- 1.8.3.1