On 2018/1/29 16:04, Sheng Yong wrote:
> sb_getblk does not guarantee the buffer head is uptodate. If bh is not
> uptodate, the data (may be used as boot code) in area before

Why boot code can be stored into the position f2fs superblock locates?

And even we have updated the buffer, we will still commit superblock's
datas into that buffer, boot code can be messed up anyway, right?

Thanks,

> F2FS_SUPER_OFFSET may get corrupted when super block is committed.
> 
> Signed-off-by: Sheng Yong <shengyo...@huawei.com>
> ---
>  fs/f2fs/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 8173ae688814..7def48cb2b22 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2334,7 +2334,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool 
> recover)
>       }
>  
>       /* write back-up superblock first */
> -     bh = sb_getblk(sbi->sb, sbi->valid_super_block ? 0: 1);
> +     bh = sb_bread(sbi->sb, sbi->valid_super_block ? 0 : 1);
>       if (!bh)
>               return -EIO;
>       err = __f2fs_commit_super(bh, F2FS_RAW_SUPER(sbi));
> @@ -2345,7 +2345,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool 
> recover)
>               return err;
>  
>       /* write current valid superblock */
> -     bh = sb_getblk(sbi->sb, sbi->valid_super_block);
> +     bh = sb_bread(sbi->sb, sbi->valid_super_block);
>       if (!bh)
>               return -EIO;
>       err = __f2fs_commit_super(bh, F2FS_RAW_SUPER(sbi));
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to