Unverified Commit d3ae2925 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12683 nilfs2: fix state management in error path of log writing function

parents 46b93d6d c096cc70
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1799,6 +1799,9 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci,
	nilfs_abort_logs(&logs, ret ? : err);

	list_splice_tail_init(&sci->sc_segbufs, &logs);
	if (list_empty(&logs))
		return; /* if the first segment buffer preparation failed */

	nilfs_cancel_segusage(&logs, nilfs->ns_sufile);
	nilfs_free_incomplete_logs(&logs, nilfs);

@@ -2040,7 +2043,7 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)

		err = nilfs_segctor_begin_construction(sci, nilfs);
		if (unlikely(err))
			goto out;
			goto failed;

		/* Update time stamp */
		sci->sc_seg_ctime = ktime_get_real_seconds();
@@ -2103,10 +2106,9 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
	return err;

 failed_to_write:
	if (sci->sc_stage.flags & NILFS_CF_IFILE_STARTED)
		nilfs_redirty_inodes(&sci->sc_dirty_files);

 failed:
	if (mode == SC_LSEG_SR && nilfs_sc_cstage_get(sci) >= NILFS_ST_IFILE)
		nilfs_redirty_inodes(&sci->sc_dirty_files);
	if (nilfs_doing_gc())
		nilfs_redirty_inodes(&sci->sc_gc_inodes);
	nilfs_segctor_abort_construction(sci, nilfs, err);