lkml.org 
[lkml]   [2022]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 09/13] drbd: future proof usage of list iterator after the loop
Date
With the speculative safe version of the list iterator req will be NULL
if the terminating condition was hit and needs to be reset to req
derived from the head, before calling list_for_each_entry_safe_from().

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
drivers/block/drbd/drbd_main.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 6f450816c4fa..d98205b46f59 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -227,6 +227,8 @@ void tl_release(struct drbd_connection *connection, unsigned int barrier_nr,
list_for_each_entry(req, &connection->transfer_log, tl_requests)
if (req->epoch == expect_epoch)
break;
+ if (!req)
+ req = list_entry(req, &connection->transfer_log, tl_requests);
list_for_each_entry_safe_from(req, r, &connection->transfer_log, tl_requests) {
if (req->epoch != expect_epoch)
break;
--
2.25.1
\
 
 \ /
  Last update: 2022-02-17 19:51    [W:0.199 / U:2.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site