提交 684de574 编写于 作者: D Darrick J. Wong 提交者: Theodore Ts'o

ext4: don't keep using page if inline conversion fails

If inline->extent conversion fails (most probably due to ENOSPC) and
we release the temporary page that we allocated to transfer the file
contents, don't keep using the page pointer after releasing the page.
This occasionally leads to complaints about evicting locked pages or
hangs when blocksize > pagesize, because it's possible for the page to
get reallocated elsewhere in the meantime.
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
Reviewed-by: NJan Kara <jack@suse.cz>
Cc: Tao Ma <tm@tao.ma>
上级 df4763be
......@@ -594,6 +594,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
if (ret) {
unlock_page(page);
page_cache_release(page);
page = NULL;
ext4_orphan_add(handle, inode);
up_write(&EXT4_I(inode)->xattr_sem);
sem_held = 0;
......@@ -613,7 +614,8 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry;
block_commit_write(page, from, to);
if (page)
block_commit_write(page, from, to);
out:
if (page) {
unlock_page(page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册