aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segbuf.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-03-22 06:33:43 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-03-23 12:17:20 -0400
commitd067633b4483f3c7d971d8f889f35340a8635bb5 (patch)
tree4b27e195b6006b1fffe8c952d0a208b1e0491583 /fs/nilfs2/segbuf.c
parent110d735a0ae69bdd11af9acb6ea3b979137eb118 (diff)
nilfs2: fix imperfect completion wait in nilfs_wait_on_logs
nilfs_wait_on_logs has a potential to slip out before completion of all bio requests when it met an error. This synchronization fault may cause unexpected results, for instance, violative access to freed segment buffers from an end-bio callback routine. This fixes the issue by ensuring that nilfs_wait_on_logs waits all given logs. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segbuf.c')
-rw-r--r--fs/nilfs2/segbuf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index 636eaafd6ea2..6129a431aa34 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -323,14 +323,14 @@ int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs)
323int nilfs_wait_on_logs(struct list_head *logs) 323int nilfs_wait_on_logs(struct list_head *logs)
324{ 324{
325 struct nilfs_segment_buffer *segbuf; 325 struct nilfs_segment_buffer *segbuf;
326 int err; 326 int err, ret = 0;
327 327
328 list_for_each_entry(segbuf, logs, sb_list) { 328 list_for_each_entry(segbuf, logs, sb_list) {
329 err = nilfs_segbuf_wait(segbuf); 329 err = nilfs_segbuf_wait(segbuf);
330 if (err) 330 if (err && !ret)
331 return err; 331 ret = err;
332 } 332 }
333 return 0; 333 return ret;
334} 334}
335 335
336/* 336/*