Message ID | 1519730585-909-1-git-send-email-nborisov@suse.com |
---|---|
State | New |
Headers | show |
Series | [4.4] f2fs: fix a bug caused by NULL extent tree | expand |
On Tue, Feb 27, 2018 at 01:23:05PM +0200, Nikolay Borisov wrote: > From: Yunlei He <heyunlei@huawei.com> > > Thread A: Thread B: > > -f2fs_remount > -sbi->mount_opt.opt = 0; > <--- -f2fs_iget > -do_read_inode > -f2fs_init_extent_tree > -F2FS_I(inode)->extent_tree is NULL > -default_options && parse_options > -remount return > <--- -f2fs_map_blocks > -f2fs_lookup_extent_tree > -f2fs_bug_on(sbi, !et); > > The same problem with f2fs_new_inode. > > Signed-off-by: Yunlei He <heyunlei@huawei.com> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > Signed-off-by: Nikolay Borisov <nborisov@suse.com> > --- > > Hello Greg, > > I would like to have upstream commit dad48e73127b ("f2fs: fix a bug > caused by NULL extent tree") included in the 4.4 stable kernel. This is the > backport of it. It also needs to go to 4.9.y, right? Can you provide a backport for that? thanks, greg k-h
diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index 7ddba812e11b..6827b9c942dc 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -172,7 +172,7 @@ void f2fs_drop_largest_extent(struct inode *inode, pgoff_t fofs) __drop_largest_extent(inode, fofs, 1); } -void f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) +static void __f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct extent_tree *et; @@ -204,6 +204,14 @@ void f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) write_unlock(&et->lock); } +void f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) +{ + __f2fs_init_extent_tree(inode, i_ext); + + if (!F2FS_I(inode)->extent_tree) + set_inode_flag(F2FS_I(inode), FI_NO_EXTENT); +} + static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs, struct extent_info *ei) {