summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFan Li <fanofcode.li@samsung.com>2016-01-04 15:56:50 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2016-01-06 19:15:49 -0800
commitde1475cc53b2d6442443dcf5d66ed0fc50ed3c7e (patch)
treec0f535152439e214a003c764ad96241c13418330 /fs
parent957efb0c2144cc5ff1795f43bf2d2ca430eaa227 (diff)
downloadlinux-de1475cc53b2d6442443dcf5d66ed0fc50ed3c7e.tar.gz
linux-de1475cc53b2d6442443dcf5d66ed0fc50ed3c7e.tar.bz2
linux-de1475cc53b2d6442443dcf5d66ed0fc50ed3c7e.zip
f2fs: read isize while holding i_mutex in fiemap
make sure the isize we read doesn't change during the process. Signed-off-by: Fan li <fanofcode.li@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/data.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 89a978c57da9..ac5bea0f5f09 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -784,7 +784,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
{
struct buffer_head map_bh;
sector_t start_blk, last_blk;
- loff_t isize = i_size_read(inode);
+ loff_t isize;
u64 logical = 0, phys = 0, size = 0;
u32 flags = 0;
int ret = 0;
@@ -800,6 +800,8 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
}
mutex_lock(&inode->i_mutex);
+
+ isize = i_size_read(inode);
if (start >= isize)
goto out;