From 42d964016e2760d75144f41cc78ad8bdca8dc240 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Wed, 25 May 2016 14:29:11 -0700 Subject: f2fs: propagate error given by f2fs_find_entry If we get ENOMEM or EIO in f2fs_find_entry, we should stop right away. Otherwise, for example, we can get duplicate directory entry by ->chash and ->clevel. Signed-off-by: Jaegeuk Kim --- fs/f2fs/namei.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/f2fs/namei.c') diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 496f4e3018b2..3f6119e94a78 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -232,6 +232,9 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino) if (de) { f2fs_dentry_kunmap(dir, page); f2fs_put_page(page, 0); + } else if (IS_ERR(page)) { + err = PTR_ERR(page); + goto out; } else { err = __f2fs_add_link(dir, &dot, NULL, dir->i_ino, S_IFDIR); if (err) @@ -242,6 +245,8 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino) if (de) { f2fs_dentry_kunmap(dir, page); f2fs_put_page(page, 0); + } else if (IS_ERR(page)) { + err = PTR_ERR(page); } else { err = __f2fs_add_link(dir, &dotdot, NULL, pino, S_IFDIR); } -- cgit v1.2.3-58-ga151