Skip to content

Commit bc0ca9d

Browse files
jankaratytso
authored andcommitted
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: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 9cb0041 commit bc0ca9d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎fs/ext4/inline.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,11 +849,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
849849
handle_t *handle;
850850
struct page *page;
851851
struct ext4_iloc iloc;
852+
int retries;
852853

853854
ret = ext4_get_inode_loc(inode, &iloc);
854855
if (ret)
855856
return ret;
856857

858+
retry_journal:
857859
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
858860
if (IS_ERR(handle)) {
859861
ret = PTR_ERR(handle);
@@ -875,6 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
875877
inode,
876878
flags,
877879
fsdata);
880+
ext4_journal_stop(handle);
881+
handle = NULL;
882+
if (ret == -ENOSPC &&
883+
ext4_should_retry_alloc(inode->i_sb, &retries))
884+
goto retry_journal;
878885
goto out;
879886
}
880887

0 commit comments

Comments
 (0)