File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed
Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -1892,15 +1892,27 @@ int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
18921892void f2fs_stop_ckpt_thread (struct f2fs_sb_info * sbi )
18931893{
18941894 struct ckpt_req_control * cprc = & sbi -> cprc_info ;
1895+ struct task_struct * ckpt_task ;
18951896
1896- if (cprc -> f2fs_issue_ckpt ) {
1897- struct task_struct * ckpt_task = cprc -> f2fs_issue_ckpt ;
1897+ if (! cprc -> f2fs_issue_ckpt )
1898+ return ;
18981899
1899- cprc -> f2fs_issue_ckpt = NULL ;
1900- kthread_stop (ckpt_task );
1900+ ckpt_task = cprc -> f2fs_issue_ckpt ;
1901+ cprc -> f2fs_issue_ckpt = NULL ;
1902+ kthread_stop (ckpt_task );
19011903
1902- flush_remained_ckpt_reqs (sbi , NULL );
1903- }
1904+ f2fs_flush_ckpt_thread (sbi );
1905+ }
1906+
1907+ void f2fs_flush_ckpt_thread (struct f2fs_sb_info * sbi )
1908+ {
1909+ struct ckpt_req_control * cprc = & sbi -> cprc_info ;
1910+
1911+ flush_remained_ckpt_reqs (sbi , NULL );
1912+
1913+ /* Let's wait for the previous dispatched checkpoint. */
1914+ while (atomic_read (& cprc -> queued_ckpt ))
1915+ io_schedule_timeout (DEFAULT_IO_TIMEOUT );
19041916}
19051917
19061918void f2fs_init_ckpt_req_control (struct f2fs_sb_info * sbi )
Original file line number Diff line number Diff line change @@ -3540,6 +3540,7 @@ unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
35403540 * checkpoint.c
35413541 */
35423542void f2fs_stop_checkpoint (struct f2fs_sb_info * sbi , bool end_io );
3543+ void f2fs_flush_ckpt_thread (struct f2fs_sb_info * sbi );
35433544struct page * f2fs_grab_meta_page (struct f2fs_sb_info * sbi , pgoff_t index );
35443545struct page * f2fs_get_meta_page (struct f2fs_sb_info * sbi , pgoff_t index );
35453546struct page * f2fs_get_meta_page_retry (struct f2fs_sb_info * sbi , pgoff_t index );
Original file line number Diff line number Diff line change @@ -1661,9 +1661,8 @@ static int f2fs_freeze(struct super_block *sb)
16611661 if (is_sbi_flag_set (F2FS_SB (sb ), SBI_IS_DIRTY ))
16621662 return - EINVAL ;
16631663
1664- /* ensure no checkpoint required */
1665- if (!llist_empty (& F2FS_SB (sb )-> cprc_info .issue_list ))
1666- return - EINVAL ;
1664+ /* Let's flush checkpoints and stop the thread. */
1665+ f2fs_flush_ckpt_thread (F2FS_SB (sb ));
16671666
16681667 /* to avoid deadlock on f2fs_evict_inode->SB_FREEZE_FS */
16691668 set_sbi_flag (F2FS_SB (sb ), SBI_IS_FREEZING );
You can’t perform that action at this time.
0 commit comments