summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-23 09:30:14 +0200
committerTheodore Ts'o <tytso@mit.edu>2020-06-03 23:16:55 -0400
commit45dd052e67ad17c7a24874a783f41aeab15bc294 (patch)
tree8babffcf81e916cbe3e5a21b7bace3a040c0e11d /fs/ext4
parentcddf8a2c4a8286ae60fc866eab59c8bc524e93a0 (diff)
downloadlwn-45dd052e67ad17c7a24874a783f41aeab15bc294.tar.gz
lwn-45dd052e67ad17c7a24874a783f41aeab15bc294.zip
fs: handle FIEMAP_FLAG_SYNC in fiemap_prep
By moving FIEMAP_FLAG_SYNC handling to fiemap_prep we ensure it is handled once instead of duplicated, but can still be done under fs locks, like xfs/iomap intended with its duplicate handling. Also make sure the error value of filemap_write_and_wait is propagated to user space. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Link: https://lore.kernel.org/r/20200523073016.2944131-8-hch@lst.de Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c2
-rw-r--r--fs/ext4/ioctl.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index cea083efb650..7d088ff1e902 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4938,7 +4938,7 @@ int ext4_get_es_cache(struct inode *inode, struct fiemap_extent_info *fieinfo,
fieinfo->fi_flags &= ~FIEMAP_FLAG_CACHE;
}
- error = fiemap_prep(inode, fieinfo, start, &len, FIEMAP_FLAG_SYNC);
+ error = fiemap_prep(inode, fieinfo, start, &len, 0);
if (error)
return error;
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 0746532ba463..f81acbbb1b12 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -759,9 +759,6 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg)
fieinfo.fi_extents_max * sizeof(struct fiemap_extent)))
return -EFAULT;
- if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
- filemap_write_and_wait(inode->i_mapping);
-
error = ext4_get_es_cache(inode, &fieinfo, fiemap.fm_start,
fiemap.fm_length);
fiemap.fm_flags = fieinfo.fi_flags;