staging/lustre/libcfs: minor fix in cfs_hash_for_each_relax()
authorNiu Yawei <yawei.niu@intel.com>
Mon, 14 Sep 2015 22:41:26 +0000 (18:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Sep 2015 13:26:53 +0000 (06:26 -0700)
cfs_hash_for_each_relax() should break iteration when callback
returns non-zero value.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-on: http://review.whamcloud.com/14927
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6636
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/libcfs/hash.c

index 286641bb1b418cafe7df2c0b2958a372dad6a53a..6f4c7d47fa3395e251de1c6d1ac2d8257757e5ba 100644 (file)
@@ -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);