diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f97b3478eb89..634f0bc75700 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1391,6 +1391,13 @@ retry: | |||
1391 | unlock_page(page); | 1391 | unlock_page(page); |
1392 | ext4_journal_stop(handle); | 1392 | ext4_journal_stop(handle); |
1393 | page_cache_release(page); | 1393 | page_cache_release(page); |
1394 | /* | ||
1395 | * block_write_begin may have instantiated a few blocks | ||
1396 | * outside i_size. Trim these off again. Don't need | ||
1397 | * i_size_read because we hold i_mutex. | ||
1398 | */ | ||
1399 | if (pos + len > inode->i_size) | ||
1400 | vmtruncate(inode, inode->i_size); | ||
1394 | } | 1401 | } |
1395 | 1402 | ||
1396 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 1403 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
@@ -2560,6 +2567,13 @@ retry: | |||
2560 | unlock_page(page); | 2567 | unlock_page(page); |
2561 | ext4_journal_stop(handle); | 2568 | ext4_journal_stop(handle); |
2562 | page_cache_release(page); | 2569 | page_cache_release(page); |
2570 | /* | ||
2571 | * block_write_begin may have instantiated a few blocks | ||
2572 | * outside i_size. Trim these off again. Don't need | ||
2573 | * i_size_read because we hold i_mutex. | ||
2574 | */ | ||
2575 | if (pos + len > inode->i_size) | ||
2576 | vmtruncate(inode, inode->i_size); | ||
2563 | } | 2577 | } |
2564 | 2578 | ||
2565 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 2579 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |