aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-26 18:14:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-26 18:14:29 -0400
commite4d50423d773fb8d5b714430ba5358e8a1b87c14 (patch)
treefc6f6bd830cb8b2a1a94734c35b18d0f2ac7ea8c
parent6f063aea557f66eea8c35034a25df85cae5ced33 (diff)
parentd067633b4483f3c7d971d8f889f35340a8635bb5 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2: nilfs2: fix imperfect completion wait in nilfs_wait_on_logs nilfs2: fix hang-up of cleaner after log writer returned with error nilfs2: fix duplicate call to nilfs_segctor_cancel_freev
-rw-r--r--fs/nilfs2/segbuf.c8
-rw-r--r--fs/nilfs2/segment.c15
2 files changed, 11 insertions, 12 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/*
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 69576a95e13f..c161d89061b5 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1510,6 +1510,12 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
1510 if (mode != SC_LSEG_SR || sci->sc_stage.scnt < NILFS_ST_CPFILE) 1510 if (mode != SC_LSEG_SR || sci->sc_stage.scnt < NILFS_ST_CPFILE)
1511 break; 1511 break;
1512 1512
1513 nilfs_clear_logs(&sci->sc_segbufs);
1514
1515 err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
1516 if (unlikely(err))
1517 return err;
1518
1513 if (sci->sc_stage.flags & NILFS_CF_SUFREED) { 1519 if (sci->sc_stage.flags & NILFS_CF_SUFREED) {
1514 err = nilfs_sufile_cancel_freev(nilfs->ns_sufile, 1520 err = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
1515 sci->sc_freesegs, 1521 sci->sc_freesegs,
@@ -1517,12 +1523,6 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
1517 NULL); 1523 NULL);
1518 WARN_ON(err); /* do not happen */ 1524 WARN_ON(err); /* do not happen */
1519 } 1525 }
1520 nilfs_clear_logs(&sci->sc_segbufs);
1521
1522 err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
1523 if (unlikely(err))
1524 return err;
1525
1526 nadd = min_t(int, nadd << 1, SC_MAX_SEGDELTA); 1526 nadd = min_t(int, nadd << 1, SC_MAX_SEGDELTA);
1527 sci->sc_stage = prev_stage; 1527 sci->sc_stage = prev_stage;
1528 } 1528 }
@@ -1897,8 +1897,7 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
1897 1897
1898 list_splice_tail_init(&sci->sc_write_logs, &logs); 1898 list_splice_tail_init(&sci->sc_write_logs, &logs);
1899 ret = nilfs_wait_on_logs(&logs); 1899 ret = nilfs_wait_on_logs(&logs);
1900 if (ret) 1900 nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret ? : err);
1901 nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret);
1902 1901
1903 list_splice_tail_init(&sci->sc_segbufs, &logs); 1902 list_splice_tail_init(&sci->sc_segbufs, &logs);
1904 nilfs_cancel_segusage(&logs, nilfs->ns_sufile); 1903 nilfs_cancel_segusage(&logs, nilfs->ns_sufile);