Skip to contentSkip to conversation

f2fs: read isize while holding i_mutex in fiemap

PATCH New Fan Li 1 participant 1 message Jan 4, 2016 F2FS file system

lore
Share & tools
lore

Fan Li

author
#0 lore raw

PATCH 1/1 f2fs: read isize while holding i_mutex in fiemap

make sure the isize we read doesn't change during the process.

---
 fs/f2fs/data.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/data.c +3 -1
index 11b2111..5c38f44 100644
@@ -792,7 +792,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;
@@ -808,6 +808,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;
 
Signature · 4 lines
1.7.9.5


------------------------------------------------------------------------------