From 3a956d8c1939e2ad34047fde96d40d39ec2186cf Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 14 Sep 2015 18:41:26 -0400 Subject: [PATCH] staging/lustre/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 Reviewed-on: http://review.whamcloud.com/14927 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6636 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Liang Zhen Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 286641b..6f4c7d4 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -1623,8 +1623,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); -- 2.7.4