From 21d313e0f66c512e490852b75d94e84f00e7ec1d Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 3 Dec 2016 19:21:20 -0800 Subject: [PATCH] Corretly wait on submitted segment reads The segment waiting loop was rewritten to use n to iterate up to i, but the body of the loop still had i. Take that as a signal to Always Iterate With 'i' and store the last i and then iterate towards it with i again. Signed-off-by: Zach Brown --- kmod/src/manifest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kmod/src/manifest.c b/kmod/src/manifest.c index 2542476c..b927a142 100644 --- a/kmod/src/manifest.c +++ b/kmod/src/manifest.c @@ -295,6 +295,7 @@ int scoutfs_manifest_read_items(struct super_block *sb, struct kvec *key) int err; int nr_refs; int cmp; + int last; int i; int n; @@ -314,9 +315,10 @@ int scoutfs_manifest_read_items(struct super_block *sb, struct kvec *key) refs[i].seg = seg; } + last = i; /* wait for submitted segments and search if we haven't seen failure */ - for (n = 0; n < i; n++) { + for (i = 0; i < last; i++) { seg = refs[i].seg; err = scoutfs_seg_wait(sb, seg);