Merge f8a7c34232
("ext4: dax: fix overflowing extents beyond inode size when partially writing") into android12-5.10-lts
Steps on the way to 5.10.227 Change-Id: Ifa9c84d819e26b5ec9a4503dbf77f3e48ff0782c Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
5d9c84863f
@ -310,10 +310,10 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset,
|
||||
* Clean up the inode after DIO or DAX extending write has completed and the
|
||||
* inode size has been updated using ext4_handle_inode_extension().
|
||||
*/
|
||||
static void ext4_inode_extension_cleanup(struct inode *inode, ssize_t count)
|
||||
static void ext4_inode_extension_cleanup(struct inode *inode, bool need_trunc)
|
||||
{
|
||||
lockdep_assert_held_write(&inode->i_rwsem);
|
||||
if (count < 0) {
|
||||
if (need_trunc) {
|
||||
ext4_truncate_failed_write(inode);
|
||||
/*
|
||||
* If the truncate operation failed early, then the inode may
|
||||
@ -550,7 +550,7 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||
* writeback of delalloc blocks.
|
||||
*/
|
||||
WARN_ON_ONCE(ret == -EIOCBQUEUED);
|
||||
ext4_inode_extension_cleanup(inode, ret);
|
||||
ext4_inode_extension_cleanup(inode, ret < 0);
|
||||
}
|
||||
|
||||
out:
|
||||
@ -634,7 +634,7 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||
|
||||
if (extend) {
|
||||
ret = ext4_handle_inode_extension(inode, offset, ret);
|
||||
ext4_inode_extension_cleanup(inode, ret);
|
||||
ext4_inode_extension_cleanup(inode, ret < (ssize_t)count);
|
||||
}
|
||||
out:
|
||||
inode_unlock(inode);
|
||||
|
Loading…
Reference in New Issue
Block a user