f2fs: fix to show norecovery mount option
PATCH 1/2 f2fs: fix to show norecovery mount option
Previously, 'norecovery' mount option will be shown as 'disable_roll_forward', fix to show original option name correctly.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/f2fs.h +1 -0
@@ -96,6 +96,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000#define F2FS_MOUNT_RESERVE_ROOT 0x01000000#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 +#define F2FS_MOUNT_NORECOVERY 0x04000000#define F2FS_OPTION (sbi) ((sbi)->mount_opt)#define clear_opt (sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
fs/f2fs/super.c +5 -2
@@ -443,7 +443,7 @@ static int parse_options(struct super_block *sb, char *options)break ;case Opt_norecovery:/* this option mounts f2fs with ro */ -set_opt (sbi,DISABLE_ROLL_FORWARD ); +set_opt (sbi,NORECOVERY );if (!f2fs_readonly (sb))return -EINVAL ;break ;
@@ -1442,6 +1442,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)if (test_opt (sbi,DISABLE_ROLL_FORWARD ))seq_puts (seq,",disable_roll_forward" ); +if (test_opt (sbi,NORECOVERY )) +seq_puts (seq,",norecovery" );if (test_opt (sbi,DISCARD ))seq_puts (seq,",discard" );else
@@ -3595,7 +3597,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto reset_checkpoint;/* recover fsynced data */ -if (!test_opt (sbi,DISABLE_ROLL_FORWARD )) { +if (!test_opt (sbi,DISABLE_ROLL_FORWARD ) && + !test_opt (sbi,NORECOVERY )) {/* * mount should be failed, when device has readonly mode, and * previous checkpoint was not done by clean system shutdown.
Signature · 1 line
2.18.0.rc1
PATCH 2/2 f2fs: fix to wait all node page writeback
There is a race condition that we may miss to wait for all node pages writeback, fix it.
- fsync() - shrink
- f2fs_do_sync_file
- __write_node_page
- set_page_writeback(page#0) : remove DIRTY/TOWRITE flag
- f2fs_fsync_node_pages
: won't find page #0 as TOWRITE flag was removeD
- f2fs_wait_on_node_pages_writeback
: wont' wait page #0 writeback as it was not in fsync_node_list list.
- f2fs_add_fsync_node_entry
Fixes 50fa53eccf9f ("f2fs: fix to avoid broken of dnode block list")
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/node.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/node.c +4 -3
@@ -1561,15 +1561,16 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,if (atomic && !test_opt (sbi,NOBARRIER )) fio.op_flags |=REQ_PREFLUSH |REQ_FUA ; -set_page_writeback (page); -ClearPageError (page); - +/* should add to global list before clearing PAGECACHE status */ if (f2fs_in_warm_node_list (sbi, page)) { seq =f2fs_add_fsync_node_entry (sbi, page);if (seq_id) *seq_id = seq; } +set_page_writeback (page); +ClearPageError (page); + fio.old_blkaddr = ni.blk_addr;f2fs_do_write_node_page (nid, &fio);set_node_addr (sbi, &ni, fio.new_blkaddr,is_fsync_dnode (page));
Signature · 1 line
2.18.0.rc1