f2fs: fix error handling in fsync_node_pages
authorChao Yu <yuchao0@huawei.com>
Tue, 11 Oct 2016 14:57:06 +0000 (22:57 +0800)
committerJaegeuk Kim <jaegeuk@google.com>
Mon, 25 Sep 2017 22:04:55 +0000 (15:04 -0700)
commit 9de69279750e9740bc7221c7051a40c0516a58fb upstream.

In fsync_node_pages, if f2fs was taged with CP_ERROR_FLAG, make sure bio
cache was flushed before return.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 97eb2c0811b5dae121e31048dde9f0fc1c866638..bc38e5a92b4bf59d7af0cdac5a3dd4977d0548a0 100644 (file)
@@ -1338,7 +1338,8 @@ retry:
                        if (unlikely(f2fs_cp_error(sbi))) {
                                f2fs_put_page(last_page, 0);
                                pagevec_release(&pvec);
-                               return -EIO;
+                               ret = -EIO;
+                               goto out;
                        }
 
                        if (!IS_DNODE(page) || !is_cold_node(page))
@@ -1411,7 +1412,7 @@ continue_unlock:
                unlock_page(last_page);
                goto retry;
        }
-
+out:
        if (nwritten)
                f2fs_submit_merged_bio_cond(sbi, NULL, NULL, ino, NODE, WRITE);
        return ret ? -EIO: 0;