mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to cover f2fs_fiemap with inode_lock
@ 2018-01-10  6:18 Chao Yu
  2018-01-10 18:41 ` Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2018-01-10  6:18 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

This patch fix to cover f2fs_fiemap with inode_lock in order to make
the whole interface avoiding race with mapping change.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/data.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d6302051a65d..330085d3adfc 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1146,18 +1146,18 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	u32 flags = 0;
 	int ret = 0;
 
+	inode_lock(inode);
+
 	ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC);
 	if (ret)
-		return ret;
+		goto out;
 
 	if (f2fs_has_inline_data(inode)) {
 		ret = f2fs_inline_data_fiemap(inode, fieinfo, start, len);
 		if (ret != -EAGAIN)
-			return ret;
+			goto out;
 	}
 
-	inode_lock(inode);
-
 	if (logical_to_blk(inode, len) == 0)
 		len = blk_to_logical(inode, 1);
 
-- 
2.15.0.55.gc2ece9dc4de6

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-10 18:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10  6:18 [PATCH] f2fs: fix to cover f2fs_fiemap with inode_lock Chao Yu
2018-01-10 18:41 ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome