f2fs: avoid node page to be written twice in gc_node_segment
[cascardo/linux.git] / fs / f2fs / gc.c
index 943a31d..075ea1e 100644 (file)
@@ -423,6 +423,12 @@ next_step:
                if (IS_ERR(node_page))
                        continue;
 
+               /* block may become invalid during get_node_page */
+               if (check_valid_map(sbi, segno, off) == 0) {
+                       f2fs_put_page(node_page, 1);
+                       continue;
+               }
+
                /* set page dirty and write it */
                if (gc_type == FG_GC) {
                        f2fs_wait_on_page_writeback(node_page, NODE);