[lustre-devel] [PATCH 10/22] Revert "staging: lustre: lnet: conrpc: Use list_for_each_entry_safe"

NeilBrown neilb at suse.com
Sun Jul 29 20:37:41 PDT 2018


This reverts commit a9a6cb4f4693253349358f8163d826eb0cfecfbc.

These loops really want to remove everything, and using a
  while(!list_empty())
loop makes this more obvious.

Signed-off-by: NeilBrown <neilb at suse.com>
---
 drivers/staging/lustre/lnet/selftest/conrpc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 95cbd1a14e1b..3afde0141db5 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -1327,7 +1327,6 @@ lstcon_rpc_cleanup_wait(void)
 {
 	struct lstcon_rpc_trans *trans;
 	struct lstcon_rpc *crpc;
-	struct lstcon_rpc *temp;
 	struct list_head *pacer;
 	struct list_head zlist;
 
@@ -1367,7 +1366,9 @@ lstcon_rpc_cleanup_wait(void)
 
 	spin_unlock(&console_session.ses_rpc_lock);
 
-	list_for_each_entry_safe(crpc, temp, &zlist, crp_link) {
+	while (!list_empty(&zlist)) {
+		crpc = list_entry(zlist.next, lstcon_rpc_t, crp_link);
+
 		list_del(&crpc->crp_link);
 		kfree(crpc);
 	}




More information about the lustre-devel mailing list