[PATCH] raid5-cache: check stripe finish out of order

From
Shaohua Li <hidden>
Date
2015-09-04 21:14:05
stripes could finish out of order. Hence r5l_move_io_unit_list() of
__r5l_stripe_write_finished might not move any entry and leave
stripe_end_ios list empty.

This applies on top of http://marc.info/?l=linux-raid&m=144122700510667

Signed-off-by: Shaohua Li <redacted>
---
 drivers/md/raid5-cache.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 410b85b..2dea05f 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -545,8 +545,13 @@ static void __r5l_stripe_write_finished(struct r5l_io_unit *io)
 
 	spin_lock_irqsave(&log->io_list_lock, flags);
 	__r5l_set_io_unit_state(io, IO_UNIT_STRIPE_END);
+	/* might move 0 entry */
 	r5l_move_io_unit_list(&log->flushed_ios, &log->stripe_end_ios,
 		IO_UNIT_STRIPE_END);
+	if (list_empty(&log->stripe_end_ios)) {
+		spin_unlock_irqrestore(&log->io_list_lock, flags);
+		return;
+	}
 
 	last = list_last_entry(&log->stripe_end_ios,
 			struct r5l_io_unit, log_sibling);
-- 
1.8.1
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help