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

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

parents 83af3495 2209533f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1838,6 +1838,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);

@@ -2082,7 +2085,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();
@@ -2145,10 +2148,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);