Message ID | 20210412102333.2676-2-jack@suse.cz |
---|---|
State | Rejected |
Headers | show |
Series | ext4: Fix data corruption when extending DIO write races with buffered read | expand |
Hi Jan, I love your patch! Yet something to improve: [auto build test ERROR on ext4/dev] [also build test ERROR on xfs-linux/for-next linus/master v5.12-rc7 next-20210409] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev config: riscv-randconfig-r004-20210412 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9829f5e6b1bca9b61efc629770d28bb9014dec45) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/0d289243d061378ac42188ff5079287885575bb3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524 git checkout 0d289243d061378ac42188ff5079287885575bb3 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> fs/zonefs/super.c:732:49: error: too few arguments to function call, expected 5, have 4 zonefs_file_write_dio_end_io(iocb, size, ret, 0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ fs/zonefs/super.c:654:12: note: 'zonefs_file_write_dio_end_io' declared here static int zonefs_file_write_dio_end_io(struct kiocb *iocb, ssize_t size, ^ >> fs/zonefs/super.c:961:14: error: incompatible function pointer types initializing 'int (*)(struct kiocb *, ssize_t, ssize_t, int, unsigned int)' (aka 'int (*)(struct kiocb *, long, long, int, unsigned int)') with an expression of type 'int (struct kiocb *, ssize_t, int, unsigned int)' (aka 'int (struct kiocb *, long, int, unsigned int)') [-Werror,-Wincompatible-function-pointer-types] .end_io = zonefs_file_read_dio_end_io, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. vim +732 fs/zonefs/super.c 8dcc1a9d90c10f Damien Le Moal 2019-12-25 688 02ef12a663c7ac Johannes Thumshirn 2020-05-12 689 static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 690 { 02ef12a663c7ac Johannes Thumshirn 2020-05-12 691 struct inode *inode = file_inode(iocb->ki_filp); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 692 struct zonefs_inode_info *zi = ZONEFS_I(inode); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 693 struct block_device *bdev = inode->i_sb->s_bdev; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 694 unsigned int max; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 695 struct bio *bio; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 696 ssize_t size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 697 int nr_pages; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 698 ssize_t ret; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 699 02ef12a663c7ac Johannes Thumshirn 2020-05-12 700 max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 701 max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 702 iov_iter_truncate(from, max); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 703 a8affc03a9b375 Christoph Hellwig 2021-03-11 704 nr_pages = iov_iter_npages(from, BIO_MAX_VECS); 89ee72376be23a Johannes Thumshirn 2020-07-16 705 if (!nr_pages) 89ee72376be23a Johannes Thumshirn 2020-07-16 706 return 0; 89ee72376be23a Johannes Thumshirn 2020-07-16 707 f91ca2a370bec5 Christoph Hellwig 2021-01-26 708 bio = bio_alloc(GFP_NOFS, nr_pages); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 709 if (!bio) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 710 return -ENOMEM; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 711 02ef12a663c7ac Johannes Thumshirn 2020-05-12 712 bio_set_dev(bio, bdev); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 713 bio->bi_iter.bi_sector = zi->i_zsector; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 714 bio->bi_write_hint = iocb->ki_hint; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 715 bio->bi_ioprio = iocb->ki_ioprio; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 716 bio->bi_opf = REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 717 if (iocb->ki_flags & IOCB_DSYNC) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 718 bio->bi_opf |= REQ_FUA; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 719 02ef12a663c7ac Johannes Thumshirn 2020-05-12 720 ret = bio_iov_iter_get_pages(bio, from); 6bea0225a4bf14 Damien Le Moal 2020-12-09 721 if (unlikely(ret)) 6bea0225a4bf14 Damien Le Moal 2020-12-09 722 goto out_release; 6bea0225a4bf14 Damien Le Moal 2020-12-09 723 02ef12a663c7ac Johannes Thumshirn 2020-05-12 724 size = bio->bi_iter.bi_size; 6bea0225a4bf14 Damien Le Moal 2020-12-09 725 task_io_account_write(size); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 726 02ef12a663c7ac Johannes Thumshirn 2020-05-12 727 if (iocb->ki_flags & IOCB_HIPRI) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 728 bio_set_polled(bio, iocb); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 729 02ef12a663c7ac Johannes Thumshirn 2020-05-12 730 ret = submit_bio_wait(bio); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 731 6bea0225a4bf14 Damien Le Moal 2020-12-09 @732 zonefs_file_write_dio_end_io(iocb, size, ret, 0); 62ab1aadcccd03 Johannes Thumshirn 2021-01-27 733 trace_zonefs_file_dio_append(inode, size, ret); 6bea0225a4bf14 Damien Le Moal 2020-12-09 734 6bea0225a4bf14 Damien Le Moal 2020-12-09 735 out_release: 6bea0225a4bf14 Damien Le Moal 2020-12-09 736 bio_release_pages(bio, false); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 737 bio_put(bio); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 738 02ef12a663c7ac Johannes Thumshirn 2020-05-12 739 if (ret >= 0) { 02ef12a663c7ac Johannes Thumshirn 2020-05-12 740 iocb->ki_pos += size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 741 return size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 742 } 02ef12a663c7ac Johannes Thumshirn 2020-05-12 743 02ef12a663c7ac Johannes Thumshirn 2020-05-12 744 return ret; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 745 } 02ef12a663c7ac Johannes Thumshirn 2020-05-12 746 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Jan,
I love your patch! Yet something to improve:
[auto build test ERROR on ext4/dev]
[also build test ERROR on xfs-linux/for-next linus/master v5.12-rc7 next-20210409]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: um-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/0d289243d061378ac42188ff5079287885575bb3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524
git checkout 0d289243d061378ac42188ff5079287885575bb3
# save the attached .config to linux build tree
make W=1 ARCH=um
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
fs/zonefs/super.c: In function 'zonefs_file_dio_append':
fs/zonefs/super.c:732:2: error: too few arguments to function 'zonefs_file_write_dio_end_io'
732 | zonefs_file_write_dio_end_io(iocb, size, ret, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/zonefs/super.c:654:12: note: declared here
654 | static int zonefs_file_write_dio_end_io(struct kiocb *iocb, ssize_t size,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/zonefs/super.c: At top level:
>> fs/zonefs/super.c:961:14: error: initialization of 'int (*)(struct kiocb *, ssize_t, ssize_t, int, unsigned int)' {aka 'int (*)(struct kiocb *, long int, long int, int, unsigned int)'} from incompatible pointer type 'int (*)(struct kiocb *, ssize_t, int, unsigned int)' {aka 'int (*)(struct kiocb *, long int, int, unsigned int)'} [-Werror=incompatible-pointer-types]
961 | .end_io = zonefs_file_read_dio_end_io,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/zonefs/super.c:961:14: note: (near initialization for 'zonefs_read_dio_ops.end_io')
cc1: some warnings being treated as errors
vim +961 fs/zonefs/super.c
8dcc1a9d90c10fa Damien Le Moal 2019-12-25 959
8dcc1a9d90c10fa Damien Le Moal 2019-12-25 960 static const struct iomap_dio_ops zonefs_read_dio_ops = {
8dcc1a9d90c10fa Damien Le Moal 2019-12-25 @961 .end_io = zonefs_file_read_dio_end_io,
8dcc1a9d90c10fa Damien Le Moal 2019-12-25 962 };
8dcc1a9d90c10fa Damien Le Moal 2019-12-25 963
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Jan, I love your patch! Yet something to improve: [auto build test ERROR on ext4/dev] [also build test ERROR on xfs-linux/for-next linus/master v5.12-rc7 next-20210412] [cannot apply to tytso-fscrypt/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev config: openrisc-randconfig-r032-20210412 (attached as .config) compiler: or1k-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/0d289243d061378ac42188ff5079287885575bb3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jan-Kara/ext4-Fix-data-corruption-when-extending-DIO-write-races-with-buffered-read/20210412-182524 git checkout 0d289243d061378ac42188ff5079287885575bb3 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): fs/zonefs/super.c: In function 'zonefs_file_dio_append': >> fs/zonefs/super.c:732:2: error: too few arguments to function 'zonefs_file_write_dio_end_io' 732 | zonefs_file_write_dio_end_io(iocb, size, ret, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/zonefs/super.c:654:12: note: declared here 654 | static int zonefs_file_write_dio_end_io(struct kiocb *iocb, ssize_t size, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/zonefs/super.c: At top level: >> fs/zonefs/super.c:961:14: error: initialization of 'int (*)(struct kiocb *, ssize_t, ssize_t, int, unsigned int)' {aka 'int (*)(struct kiocb *, int, int, int, unsigned int)'} from incompatible pointer type 'int (*)(struct kiocb *, ssize_t, int, unsigned int)' {aka 'int (*)(struct kiocb *, int, int, unsigned int)'} [-Werror=incompatible-pointer-types] 961 | .end_io = zonefs_file_read_dio_end_io, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/zonefs/super.c:961:14: note: (near initialization for 'zonefs_read_dio_ops.end_io') cc1: some warnings being treated as errors vim +/zonefs_file_write_dio_end_io +732 fs/zonefs/super.c 8dcc1a9d90c10f Damien Le Moal 2019-12-25 688 02ef12a663c7ac Johannes Thumshirn 2020-05-12 689 static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 690 { 02ef12a663c7ac Johannes Thumshirn 2020-05-12 691 struct inode *inode = file_inode(iocb->ki_filp); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 692 struct zonefs_inode_info *zi = ZONEFS_I(inode); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 693 struct block_device *bdev = inode->i_sb->s_bdev; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 694 unsigned int max; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 695 struct bio *bio; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 696 ssize_t size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 697 int nr_pages; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 698 ssize_t ret; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 699 02ef12a663c7ac Johannes Thumshirn 2020-05-12 700 max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 701 max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 702 iov_iter_truncate(from, max); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 703 a8affc03a9b375 Christoph Hellwig 2021-03-11 704 nr_pages = iov_iter_npages(from, BIO_MAX_VECS); 89ee72376be23a Johannes Thumshirn 2020-07-16 705 if (!nr_pages) 89ee72376be23a Johannes Thumshirn 2020-07-16 706 return 0; 89ee72376be23a Johannes Thumshirn 2020-07-16 707 f91ca2a370bec5 Christoph Hellwig 2021-01-26 708 bio = bio_alloc(GFP_NOFS, nr_pages); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 709 if (!bio) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 710 return -ENOMEM; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 711 02ef12a663c7ac Johannes Thumshirn 2020-05-12 712 bio_set_dev(bio, bdev); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 713 bio->bi_iter.bi_sector = zi->i_zsector; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 714 bio->bi_write_hint = iocb->ki_hint; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 715 bio->bi_ioprio = iocb->ki_ioprio; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 716 bio->bi_opf = REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 717 if (iocb->ki_flags & IOCB_DSYNC) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 718 bio->bi_opf |= REQ_FUA; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 719 02ef12a663c7ac Johannes Thumshirn 2020-05-12 720 ret = bio_iov_iter_get_pages(bio, from); 6bea0225a4bf14 Damien Le Moal 2020-12-09 721 if (unlikely(ret)) 6bea0225a4bf14 Damien Le Moal 2020-12-09 722 goto out_release; 6bea0225a4bf14 Damien Le Moal 2020-12-09 723 02ef12a663c7ac Johannes Thumshirn 2020-05-12 724 size = bio->bi_iter.bi_size; 6bea0225a4bf14 Damien Le Moal 2020-12-09 725 task_io_account_write(size); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 726 02ef12a663c7ac Johannes Thumshirn 2020-05-12 727 if (iocb->ki_flags & IOCB_HIPRI) 02ef12a663c7ac Johannes Thumshirn 2020-05-12 728 bio_set_polled(bio, iocb); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 729 02ef12a663c7ac Johannes Thumshirn 2020-05-12 730 ret = submit_bio_wait(bio); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 731 6bea0225a4bf14 Damien Le Moal 2020-12-09 @732 zonefs_file_write_dio_end_io(iocb, size, ret, 0); 62ab1aadcccd03 Johannes Thumshirn 2021-01-27 733 trace_zonefs_file_dio_append(inode, size, ret); 6bea0225a4bf14 Damien Le Moal 2020-12-09 734 6bea0225a4bf14 Damien Le Moal 2020-12-09 735 out_release: 6bea0225a4bf14 Damien Le Moal 2020-12-09 736 bio_release_pages(bio, false); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 737 bio_put(bio); 02ef12a663c7ac Johannes Thumshirn 2020-05-12 738 02ef12a663c7ac Johannes Thumshirn 2020-05-12 739 if (ret >= 0) { 02ef12a663c7ac Johannes Thumshirn 2020-05-12 740 iocb->ki_pos += size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 741 return size; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 742 } 02ef12a663c7ac Johannes Thumshirn 2020-05-12 743 02ef12a663c7ac Johannes Thumshirn 2020-05-12 744 return ret; 02ef12a663c7ac Johannes Thumshirn 2020-05-12 745 } 02ef12a663c7ac Johannes Thumshirn 2020-05-12 746 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 194f5d00fa32..2505313d96b0 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -369,7 +369,8 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, } static int ext4_dio_write_end_io(struct kiocb *iocb, ssize_t size, - int error, unsigned int flags) + ssize_t orig_size, int error, + unsigned int flags) { loff_t offset = iocb->ki_pos; struct inode *inode = file_inode(iocb->ki_filp); diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index bdd0d89bbf0a..a4bbf22f69bc 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -28,6 +28,7 @@ struct iomap_dio { const struct iomap_dio_ops *dops; loff_t i_size; loff_t size; + loff_t orig_size; atomic_t ref; unsigned flags; int error; @@ -85,7 +86,8 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) ssize_t ret = dio->error; if (dops && dops->end_io) - ret = dops->end_io(iocb, dio->size, ret, dio->flags); + ret = dops->end_io(iocb, dio->size, dio->orig_size, ret, + dio->flags); if (likely(!ret)) { ret = dio->size; @@ -473,6 +475,7 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, dio->iocb = iocb; atomic_set(&dio->ref, 1); dio->size = 0; + dio->orig_size = count; dio->i_size = i_size_read(inode); dio->dops = dops; dio->error = 0; diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index a007ca0711d9..ed23ed56e345 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -442,6 +442,7 @@ static int xfs_dio_write_end_io( struct kiocb *iocb, ssize_t size, + ssize_t orig_size, int error, unsigned flags) { diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 049e36c69ed7..e3e0ee4b8c6e 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -652,7 +652,8 @@ static loff_t zonefs_file_llseek(struct file *file, loff_t offset, int whence) } static int zonefs_file_write_dio_end_io(struct kiocb *iocb, ssize_t size, - int error, unsigned int flags) + ssize_t orig_size, int error, + unsigned int flags) { struct inode *inode = file_inode(iocb->ki_filp); struct zonefs_inode_info *zi = ZONEFS_I(inode); diff --git a/include/linux/iomap.h b/include/linux/iomap.h index d202fd2d0f91..b175641e9540 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -252,8 +252,8 @@ int iomap_writepages(struct address_space *mapping, #define IOMAP_DIO_COW (1 << 1) /* covers COW extent(s) */ struct iomap_dio_ops { - int (*end_io)(struct kiocb *iocb, ssize_t size, int error, - unsigned flags); + int (*end_io)(struct kiocb *iocb, ssize_t size, ssize_t orig_size, + int error, unsigned flags); blk_qc_t (*submit_io)(struct inode *inode, struct iomap *iomap, struct bio *bio, loff_t file_offset); };
When extending a file with direct IO write, ext4 needs to know whether IO has succeeded for the whole range that was prepared for it (the common fast path). In that case we can piggy back the orphan list update with the inode size update. In case write was actually shorter than originally intended, we must leave inode on the orphan list until we cleanup blocks beyond i_size. So provide the original IO size to the direct IO ->end_io handler. Signed-off-by: Jan Kara <jack@suse.cz> --- fs/ext4/file.c | 3 ++- fs/iomap/direct-io.c | 5 ++++- fs/xfs/xfs_file.c | 1 + fs/zonefs/super.c | 3 ++- include/linux/iomap.h | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-)