From: Shan Hai Date: Sat, 29 Dec 2018 05:34:53 +0000 (+0800) Subject: ext4: update i_disksize when new eof exceeds it X-Git-Tag: v4.1.12-124.31.3~325 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=556c8219a2f4617d9cb2cc02d5556c52a6e0c9d1;p=users%2Fjedix%2Flinux-maple.git ext4: update i_disksize when new eof exceeds it Orabug: 28940828 This patch is a helper for back porting upstream commit 45d8ec4d9fd5 (ext4: update i_disksize if direct write past ondisk size), add a condition to allow updating i_disksize through calling ext4_ind_direct_IO when the new eof exceeds both i_size and i_disksize. Signed-off-by: Shan Hai Reviewed-by: Ashish Samant Signed-off-by: Brian Maly --- diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a71df7f34c3f..b582acda2bc1 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3148,6 +3148,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, { struct file *file = iocb->ki_filp; struct inode *inode = file->f_mapping->host; + struct ext4_inode_info *ei = EXT4_I(inode); ssize_t ret; size_t count = iov_iter_count(iter); int overwrite = 0; @@ -3157,7 +3158,8 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, ext4_io_end_t *io_end = NULL; /* Use the old path for reads and writes beyond i_size. */ - if (iov_iter_rw(iter) != WRITE || final_size > inode->i_size) + if (iov_iter_rw(iter) != WRITE || final_size > inode->i_size || + final_size > ei->i_disksize) return ext4_ind_direct_IO(iocb, iter, offset); BUG_ON(iocb->private == NULL);