]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
f2fs: avoid f2fs_bug_on() in cp_error case
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 31 Jul 2018 16:09:01 +0000 (09:09 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 10 Aug 2018 23:19:05 +0000 (16:19 -0700)
There is a subtle race condition to invoke f2fs_bug_on() in shutdown tests. I've
confirmed that the last checkpoint is preserved in consistent state, so it'd be
fine to just return error at this moment.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 6055d2d12640cc645f399624e02e7b09b4bb432c..21ffb784764ce3bc702d26abc358645ac6ee15f4 100644 (file)
@@ -1075,6 +1075,10 @@ int f2fs_remove_inode_page(struct inode *inode)
                f2fs_truncate_data_blocks_range(&dn, 1);
 
        /* 0 is possible, after f2fs_new_inode() has failed */
+       if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) {
+               f2fs_put_dnode(&dn);
+               return -EIO;
+       }
        f2fs_bug_on(F2FS_I_SB(inode),
                        inode->i_blocks != 0 && inode->i_blocks != 8);