Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cdcb713 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: put the inode page when error was occurred



We should put the inode page when error was occurred.

Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6d20aff8
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -963,22 +963,22 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
		} else if (page->index == 0) {
			err = f2fs_convert_inline_page(&dn, page);
			if (err)
				goto unlock_fail;
				goto put_fail;
		} else {
			struct page *p = grab_cache_page(inode->i_mapping, 0);
			if (!p) {
				err = -ENOMEM;
				goto unlock_fail;
				goto put_fail;
			}
			err = f2fs_convert_inline_page(&dn, p);
			f2fs_put_page(p, 1);
			if (err)
				goto unlock_fail;
				goto put_fail;
		}
	}
	err = f2fs_reserve_block(&dn, index);
	if (err)
		goto unlock_fail;
		goto put_fail;
put_next:
	f2fs_put_dnode(&dn);
	f2fs_unlock_op(sbi);
@@ -1021,6 +1021,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
	clear_cold_data(page);
	return 0;

put_fail:
	f2fs_put_dnode(&dn);
unlock_fail:
	f2fs_unlock_op(sbi);
	f2fs_put_page(page, 1);