From 8c14bfadeac2a01b305ef4434907295b81b58db2 Mon Sep 17 00:00:00 2001 From: Chao Yu Date: Fri, 7 Aug 2015 17:58:43 +0800 Subject: f2fs: handle error of f2fs_iget correctly In recover_orphan_inode, whenever f2fs_iget fail, we will make kernel panic, but it's not reasonable, because f2fs_iget can fail due to a lot of reasons including out of memory. So we change error handling method as below: a) when finding no entry for the orphan inode, bug_on for catching bugs; b) for other reasons, report it to caller. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs/f2fs/super.c') diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a79b6b5a4eeb..4db5cd9fb4b9 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1245,7 +1245,9 @@ try_onemore: f2fs_join_shrinker(sbi); /* if there are nt orphan nodes free them */ - recover_orphan_inodes(sbi); + err = recover_orphan_inodes(sbi); + if (err) + goto free_node_inode; /* read root inode and dentry */ root = f2fs_iget(sb, F2FS_ROOT_INO(sbi)); -- cgit v1.2.3