back-up raw_super in sbi
PATCH 1/1 back-up raw_super in sbi
write_checkpoint() tries to get cp_blkaddr from superblock buffer, if the buffer happen to be destroied by something else, it may bring in unpredictable effect on f2fs.
this patch fix it by back-up a raw_super copy.
--- fs/f2fs/checkpoint.c | 3 ++- fs/f2fs/f2fs.h | 10 ++++++++++ fs/f2fs/node.c | 2 +- fs/f2fs/super.c | 12 ++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-)
fs/f2fs/checkpoint.c +2 -1
@@ -276,13 +276,14 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, long nr_to_write) {struct address_space *mapping =META_MAPPING (sbi); -pgoff_t index =0 , end =LONG_MAX , prev =LONG_MAX ; +pgoff_t index, end =LONG_MAX , prev =LONG_MAX ;struct pagevec pvec;long nwritten =0 ;struct writeback_control wbc = { .for_reclaim =0 , }; + index =__start_cp_addr (sbi);pagevec_init (&pvec,0 );while (index <= end) {
fs/f2fs/f2fs.h +10 -0
@@ -1167,6 +1167,16 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); } +static inline block_t __start_main_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_RAW_SUPER (sbi)->main_blkaddr); +} + +static inline block_t __start_sum_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); +} +static inline bool inc_valid_node_count (struct f2fs_sb_info *sbi,struct inode *inode) {
fs/f2fs/node.c +1 -1
@@ -1161,7 +1161,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,pagevec_init (&pvec,0 ); next_step: - index =0 ; + index =__start_main_addr (sbi); end =LONG_MAX ;while (index <= end) {
fs/f2fs/super.c +8 -4
@@ -1040,6 +1040,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {
@@ -1055,9 +1058,8 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); - +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET , +sizeof (struct f2fs_super_block ));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {brelse (buffer);
@@ -1090,8 +1092,10 @@ retry: out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }return 0 ; }
Signature · 9 lines
1.9.1 ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
Jaegeuk Kim
maintainerHi Yunlei,
Quoted 21 lines · Yunlei He
write_checkpoint()tries to getcp_blkaddrfrom superblock buffer, if the buffer happen to be destroied by something else, it may bring in unpredictable effect on f2fs.this patch fix it by back-up a
raw_supercopy.Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/checkpoint.c | 3 ++- fs/f2fs/f2fs.h | 10 ++++++++++ fs/f2fs/node.c | 2 +- fs/f2fs/super.c | 12 ++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-)fs/f2fs/checkpoint.c +0
-0@@ -276,13 +276,14 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, long nr_to_write) {
fs/f2fs/checkpoint.c long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, · line 286
Quoted 10 lines
fs/f2fs/checkpoint.c +2
-1struct address_space *mapping =META_MAPPING (sbi); -pgoff_t index =0 , end =LONG_MAX , prev =LONG_MAX ; +pgoff_t index, end =LONG_MAX , prev =LONG_MAX ;struct pagevec pvec;long nwritten =0 ;struct writeback_control wbc = { .for_reclaim =0 , }; + index =__start_cp_addr (sbi);
No need to do this.
Quoted 11 lines
fs/f2fs/checkpoint.c +0
-0pagevec_init (&pvec,0 );while (index <= end) {fs/f2fs/f2fs.h +0
-0@@ -1167,6 +1167,16 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); }
fs/f2fs/f2fs.h static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi) · line 1179
Quoted 10 lines
fs/f2fs/f2fs.h +10
-0+static inline block_t __start_main_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_RAW_SUPER (sbi)->main_blkaddr); +} + +static inline block_t __start_sum_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); +} +
Ditto.
fs/f2fs/node.c int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino, · line 1164
Quoted 13 lines
fs/f2fs/f2fs.h +0
-0static inline bool inc_valid_node_count (struct f2fs_sb_info *sbi,struct inode *inode) {fs/f2fs/node.c +1
-1@@ -1161,7 +1161,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,pagevec_init (&pvec,0 ); next_step: - index =0 ; + index =__start_main_addr (sbi);
No, its index is for nid.
Quoted 30 lines
fs/f2fs/node.c +0
-0end =LONG_MAX ;while (index <= end) {fs/f2fs/super.c +5
-3@@ -1040,6 +1040,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {@@ -1055,9 +1058,8 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); - +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET , +sizeof (struct f2fs_super_block ));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {brelse (buffer);
fs/f2fs/super.c retry: · line 1098
Quoted 8 lines
fs/f2fs/super.c +3
-1@@ -1090,8 +1092,10 @@ retry: out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }
Need to consider f2fs_commit_super and kfree() in put_super.
Could you check out this patch?
--- fs/f2fs/super.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
fs/f2fs/super.c +14 -4
@@ -567,6 +567,7 @@ static void f2fs_put_super(struct super_block *sb) sb->s_fs_info =NULL ;brelse (sbi->raw_super_buf); +kfree (sbi->raw_super);kfree (sbi); }
@@ -1040,6 +1041,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {
@@ -1055,8 +1059,7 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET ,sizeof (*super));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {
@@ -1090,14 +1093,17 @@ retry: out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }return 0 ; }int f2fs_commit_super (struct f2fs_sb_info *sbi,bool recover) { +struct f2fs_super_block *super =F2FS_RAW_SUPER (sbi);struct buffer_head *sbh = sbi->raw_super_buf;struct buffer_head *bh;int err;
@@ -1108,7 +1114,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)return -EIO ;lock_buffer (bh); -memcpy (bh->b_data, sbh->b_data, sbh->b_size); +memcpy (bh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super));WARN_ON (sbh->b_size !=F2FS_BLKSIZE );set_buffer_uptodate (bh);set_buffer_dirty (bh);
@@ -1124,6 +1130,10 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)/* write current valid superblock */ lock_buffer (sbh); +if (memcmp (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super))) { +f2fs_msg (sbi->sb,KERN_INFO ,"Write modified valid superblock" ); +memcpy (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super)); + }set_buffer_dirty (sbh);unlock_buffer (sbh);
Signature · 9 lines
2.4.9 (Apple Git-60) ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
Quoted 108 lines · Jaegeuk Kim
Hi Yunlei,
Quoted 21 lines · Yunlei He
write_checkpoint()tries to getcp_blkaddrfrom superblock buffer, if the buffer happen to be destroied by something else, it may bring in unpredictable effect on f2fs.this patch fix it by back-up a
raw_supercopy.Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/checkpoint.c | 3 ++- fs/f2fs/f2fs.h | 10 ++++++++++ fs/f2fs/node.c | 2 +- fs/f2fs/super.c | 12 ++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-)fs/f2fs/checkpoint.c +0
-0@@ -276,13 +276,14 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, long nr_to_write) {fs/f2fs/checkpoint.c long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, · line 286
Quoted 10 lines
fs/f2fs/checkpoint.c +2
-1struct address_space *mapping =META_MAPPING (sbi); -pgoff_t index =0 , end =LONG_MAX , prev =LONG_MAX ; +pgoff_t index, end =LONG_MAX , prev =LONG_MAX ;struct pagevec pvec;long nwritten =0 ;struct writeback_control wbc = { .for_reclaim =0 , }; + index =__start_cp_addr (sbi);No need to do this.
Quoted 11 lines
fs/f2fs/checkpoint.c +0
-0pagevec_init (&pvec,0 );while (index <= end) {fs/f2fs/f2fs.h +0
-0@@ -1167,6 +1167,16 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); }fs/f2fs/f2fs.h static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi) · line 1179
Quoted 10 lines
fs/f2fs/f2fs.h +10
-0+static inline block_t __start_main_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_RAW_SUPER (sbi)->main_blkaddr); +} + +static inline block_t __start_sum_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); +} +Ditto.
fs/f2fs/node.c int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino, · line 1164
Quoted 13 lines
fs/f2fs/f2fs.h +0
-0static inline bool inc_valid_node_count (struct f2fs_sb_info *sbi,struct inode *inode) {fs/f2fs/node.c +1
-1@@ -1161,7 +1161,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,pagevec_init (&pvec,0 ); next_step: - index =0 ; + index =__start_main_addr (sbi);No, its index is for nid.
Quoted 31 lines
fs/f2fs/node.c +0
-0end =LONG_MAX ;while (index <= end) {fs/f2fs/super.c +5
-3@@ -1040,6 +1040,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {@@ -1055,9 +1058,8 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); - +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET , +sizeof (struct f2fs_super_block ));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {brelse (buffer);@@ -1090,8 +1092,10 @@ retry:
Quoted 9 lines
fs/f2fs/super.c retry: · line 1099
Quoted 7 lines
fs/f2fs/super.c +3
-1out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }Need to consider
f2fs_commit_superandkfree()input_super.
We also need to consider f2fs_fill_super error processing procedure:
@@ -1388,6 +1388,7 @@ free_options:
kfree(options);
free_sb_buf:
brelse(raw_super_buf);+ kfree(raw_super);
Quoted 69 lines
Could you check out this patch?
--- fs/f2fs/super.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)fs/f2fs/super.c +10
-4@@ -567,6 +567,7 @@ static void f2fs_put_super(struct super_block *sb) sb->s_fs_info =NULL ;brelse (sbi->raw_super_buf); +kfree (sbi->raw_super);kfree (sbi); }@@ -1040,6 +1041,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {@@ -1055,8 +1059,7 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET ,sizeof (*super));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {@@ -1090,14 +1093,17 @@ retry: out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }return 0 ; }int f2fs_commit_super (struct f2fs_sb_info *sbi,bool recover) { +struct f2fs_super_block *super =F2FS_RAW_SUPER (sbi);struct buffer_head *sbh = sbi->raw_super_buf;struct buffer_head *bh;int err;@@ -1108,7 +1114,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)return -EIO ;lock_buffer (bh); -memcpy (bh->b_data, sbh->b_data, sbh->b_size); +memcpy (bh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super));WARN_ON (sbh->b_size !=F2FS_BLKSIZE );set_buffer_uptodate (bh);set_buffer_dirty (bh);
fs/f2fs/super.c int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) · line 1139
Quoted 10 lines
fs/f2fs/super.c +4
-0@@ -1124,6 +1130,10 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)/* write current valid superblock */ lock_buffer (sbh); +if (memcmp (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super))) { +f2fs_msg (sbi->sb,KERN_INFO ,"Write modified valid superblock" ); +memcpy (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super)); + }set_buffer_dirty (sbh);unlock_buffer (sbh);
It looks good to me, but can we releasing grabbed block buffer 'sbi->raw_super_buf' as Chao Yu said.
Thanks.
Yunlei
------------------------------------------------------------------------------
Jaegeuk Kim
maintainerHi,
Quoted 122 lines · He YunLei
Quoted 108 lines · Jaegeuk Kim
Hi Yunlei,
Quoted 21 lines · Yunlei He
write_checkpoint()tries to getcp_blkaddrfrom superblock buffer, if the buffer happen to be destroied by something else, it may bring in unpredictable effect on f2fs.this patch fix it by back-up a
raw_supercopy.Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/checkpoint.c | 3 ++- fs/f2fs/f2fs.h | 10 ++++++++++ fs/f2fs/node.c | 2 +- fs/f2fs/super.c | 12 ++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-)fs/f2fs/checkpoint.c +0
-0@@ -276,13 +276,14 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, long nr_to_write) {fs/f2fs/checkpoint.c long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, · line 286
Quoted 10 lines
fs/f2fs/checkpoint.c +2
-1struct address_space *mapping =META_MAPPING (sbi); -pgoff_t index =0 , end =LONG_MAX , prev =LONG_MAX ; +pgoff_t index, end =LONG_MAX , prev =LONG_MAX ;struct pagevec pvec;long nwritten =0 ;struct writeback_control wbc = { .for_reclaim =0 , }; + index =__start_cp_addr (sbi);No need to do this.
Quoted 11 lines
fs/f2fs/checkpoint.c +0
-0pagevec_init (&pvec,0 );while (index <= end) {fs/f2fs/f2fs.h +0
-0@@ -1167,6 +1167,16 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); }fs/f2fs/f2fs.h static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi) · line 1179
Quoted 10 lines
fs/f2fs/f2fs.h +10
-0+static inline block_t __start_main_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_RAW_SUPER (sbi)->main_blkaddr); +} + +static inline block_t __start_sum_addr (struct f2fs_sb_info *sbi) +{ +return le32_to_cpu (F2FS_CKPT (sbi)->cp_pack_start_sum); +} +Ditto.
fs/f2fs/node.c int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino, · line 1164
Quoted 13 lines
fs/f2fs/f2fs.h +0
-0static inline bool inc_valid_node_count (struct f2fs_sb_info *sbi,struct inode *inode) {fs/f2fs/node.c +1
-1@@ -1161,7 +1161,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,pagevec_init (&pvec,0 ); next_step: - index =0 ; + index =__start_main_addr (sbi);No, its index is for nid.
Quoted 31 lines
fs/f2fs/node.c +0
-0end =LONG_MAX ;while (index <= end) {fs/f2fs/super.c +5
-3@@ -1040,6 +1040,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {@@ -1055,9 +1058,8 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); - +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET , +sizeof (struct f2fs_super_block ));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {brelse (buffer);@@ -1090,8 +1092,10 @@ retry:Quoted 9 lines
fs/f2fs/super.c retry: · line 1099
Quoted 7 lines
fs/f2fs/super.c +3
-1out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }Need to consider
f2fs_commit_superandkfree()input_super.We also need to consider
f2fs_fill_supererror processing procedure:
Review free_options: · line 1391
Quoted 4 lines
(quoted diff) +1
-0@@ -1388,6 +1388,7 @@ free_options: kfree(options); free_sb_buf: brelse(raw_super_buf); + kfree(raw_super);
Agreed.
Quoted 70 lines
Quoted 70 lines
Could you check out this patch?
--- fs/f2fs/super.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)fs/f2fs/super.c +10
-4@@ -567,6 +567,7 @@ static void f2fs_put_super(struct super_block *sb) sb->s_fs_info =NULL ;brelse (sbi->raw_super_buf); +kfree (sbi->raw_super);kfree (sbi); }@@ -1040,6 +1041,9 @@ static int read_raw_super_block(struct super_block *sb,struct f2fs_super_block *super;int err =0 ; + super =kzalloc (sizeof (struct f2fs_super_block ),GFP_KERNEL ); +if (!super) +return -ENOMEM ; retry: buffer =sb_bread (sb, block);if (!buffer) {@@ -1055,8 +1059,7 @@ retry: } } - super = (struct f2fs_super_block *) - ((char *)(buffer)->b_data +F2FS_SUPER_OFFSET ); +memcpy (super, buffer->b_data +F2FS_SUPER_OFFSET ,sizeof (*super));/* sanity checking of raw super */ if (sanity_check_raw_super (sb, super)) {@@ -1090,14 +1093,17 @@ retry: out:/* No valid superblock */ -if (!*raw_super) +if (!*raw_super) { +kfree (super);return err; + }return 0 ; }int f2fs_commit_super (struct f2fs_sb_info *sbi,bool recover) { +struct f2fs_super_block *super =F2FS_RAW_SUPER (sbi);struct buffer_head *sbh = sbi->raw_super_buf;struct buffer_head *bh;int err;@@ -1108,7 +1114,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)return -EIO ;lock_buffer (bh); -memcpy (bh->b_data, sbh->b_data, sbh->b_size); +memcpy (bh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super));WARN_ON (sbh->b_size !=F2FS_BLKSIZE );set_buffer_uptodate (bh);set_buffer_dirty (bh);@@ -1124,6 +1130,10 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
Quoted 12 lines
fs/f2fs/super.c int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) · line 1139
Quoted 10 lines
fs/f2fs/super.c +4
-0/* write current valid superblock */ lock_buffer (sbh); +if (memcmp (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super))) { +f2fs_msg (sbi->sb,KERN_INFO ,"Write modified valid superblock" ); +memcpy (sbh->b_data +F2FS_SUPER_OFFSET , super,sizeof (*super)); + }set_buffer_dirty (sbh);unlock_buffer (sbh);It looks good to me, but can we releasing grabbed block buffer '
sbi->raw_super_buf' as Chao Yu said.
If then, don't we need to recover the polluted superblock?
Quoted 3 lines
Thanks.
Yunlei
------------------------------------------------------------------------------
Hi all,
Quoted 4 lines
Quoted 2 lines
It looks good to me, but can we releasing grabbed block buffer '
sbi->raw_super_buf' as Chao Yu said.If then, don't we need to recover the polluted superblock?
We need, if we change to not grab super block buffer header, instead, we have to record current super block no that raw_super referred to, then in f2fs_commit_super we can try to grab block buffer of super block with stored no.
Could you check the following patches?
Thanks,
------------------------------------------------------------------------------