Commit bc0ca9df authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: retry allocation when inline->extent conversion failed

Similarly as other ->write_begin functions in ext4, also
ext4_da_write_inline_data_begin() should retry allocation if the
conversion failed because of ENOSPC. This avoids returning ENOSPC
prematurely because of uncommitted block deletions.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 9cb00419
...@@ -849,11 +849,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -849,11 +849,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
handle_t *handle; handle_t *handle;
struct page *page; struct page *page;
struct ext4_iloc iloc; struct ext4_iloc iloc;
int retries;
ret = ext4_get_inode_loc(inode, &iloc); ret = ext4_get_inode_loc(inode, &iloc);
if (ret) if (ret)
return ret; return ret;
retry_journal:
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
...@@ -875,6 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -875,6 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
inode, inode,
flags, flags,
fsdata); fsdata);
ext4_journal_stop(handle);
handle = NULL;
if (ret == -ENOSPC &&
ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry_journal;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment