Skip to content

Commit d865177

Browse files
Liu Bokdave
authored andcommitted
Btrfs: clear uptodate flags of pages in sys_array eb
We set uptodate flag to pages in the temporary sys_array eb, but do not clear the flag after free eb. As the special btree inode may still hold a reference on those pages, the uptodate flag can remain alive in them. If btrfs_super_chunk_root has been intentionally changed to the offset of this sys_array eb, reading chunk_root will read content of sys_array and it will skip our beautiful checks in btree_readpage_end_io_hook() because of "pages of eb are uptodate => eb is uptodate" This adds the 'clear uptodate' part to force it to read from disk. Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 65d4f4c commit d865177

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/volumes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6631,12 +6631,14 @@ int btrfs_read_sys_array(struct btrfs_root *root)
66316631
sb_array_offset += len;
66326632
cur_offset += len;
66336633
}
6634+
clear_extent_buffer_uptodate(sb);
66346635
free_extent_buffer_stale(sb);
66356636
return ret;
66366637

66376638
out_short_read:
66386639
printk(KERN_ERR "BTRFS: sys_array too short to read %u bytes at offset %u\n",
66396640
len, cur_offset);
6641+
clear_extent_buffer_uptodate(sb);
66406642
free_extent_buffer_stale(sb);
66416643
return -EIO;
66426644
}

0 commit comments

Comments
 (0)