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
This commit is contained in:
Linus Torvalds 2010-03-26 15:14:29 -07:00
Родитель 6f063aea55 d067633b44
Коммит e4d50423d7
2 изменённых файлов: 11 добавлений и 12 удалений

Просмотреть файл

@ -323,14 +323,14 @@ int nilfs_write_logs(struct list_head *logs, struct the_nilfs *nilfs)
int nilfs_wait_on_logs(struct list_head *logs) int nilfs_wait_on_logs(struct list_head *logs)
{ {
struct nilfs_segment_buffer *segbuf; struct nilfs_segment_buffer *segbuf;
int err; int err, ret = 0;
list_for_each_entry(segbuf, logs, sb_list) { list_for_each_entry(segbuf, logs, sb_list) {
err = nilfs_segbuf_wait(segbuf); err = nilfs_segbuf_wait(segbuf);
if (err) if (err && !ret)
return err; ret = err;
} }
return 0; return ret;
} }
/* /*

Просмотреть файл

@ -1510,6 +1510,12 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
if (mode != SC_LSEG_SR || sci->sc_stage.scnt < NILFS_ST_CPFILE) if (mode != SC_LSEG_SR || sci->sc_stage.scnt < NILFS_ST_CPFILE)
break; break;
nilfs_clear_logs(&sci->sc_segbufs);
err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
if (unlikely(err))
return err;
if (sci->sc_stage.flags & NILFS_CF_SUFREED) { if (sci->sc_stage.flags & NILFS_CF_SUFREED) {
err = nilfs_sufile_cancel_freev(nilfs->ns_sufile, err = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
sci->sc_freesegs, sci->sc_freesegs,
@ -1517,12 +1523,6 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci,
NULL); NULL);
WARN_ON(err); /* do not happen */ WARN_ON(err); /* do not happen */
} }
nilfs_clear_logs(&sci->sc_segbufs);
err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
if (unlikely(err))
return err;
nadd = min_t(int, nadd << 1, SC_MAX_SEGDELTA); nadd = min_t(int, nadd << 1, SC_MAX_SEGDELTA);
sci->sc_stage = prev_stage; sci->sc_stage = prev_stage;
} }
@ -1897,8 +1897,7 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
list_splice_tail_init(&sci->sc_write_logs, &logs); list_splice_tail_init(&sci->sc_write_logs, &logs);
ret = nilfs_wait_on_logs(&logs); ret = nilfs_wait_on_logs(&logs);
if (ret) nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret ? : err);
nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret);
list_splice_tail_init(&sci->sc_segbufs, &logs); list_splice_tail_init(&sci->sc_segbufs, &logs);
nilfs_cancel_segusage(&logs, nilfs->ns_sufile); nilfs_cancel_segusage(&logs, nilfs->ns_sufile);