Skip to content

Commit cde2d7a

Browse files
committed
ext4: flush the extent status cache during EXT4_IOC_SWAP_BOOT
Previously we weren't swapping only some of the extent_status LRU fields during the processing of the EXT4_IOC_SWAP_BOOT ioctl. The much safer thing to do is to just completely flush the extent status tree when doing the swap. Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: Zheng Liu <[email protected]> Cc: [email protected]
1 parent 6ae6514 commit cde2d7a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ext4/ioctl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ static void swap_inode_data(struct inode *inode1, struct inode *inode2)
7777
memswap(ei1->i_data, ei2->i_data, sizeof(ei1->i_data));
7878
memswap(&ei1->i_flags, &ei2->i_flags, sizeof(ei1->i_flags));
7979
memswap(&ei1->i_disksize, &ei2->i_disksize, sizeof(ei1->i_disksize));
80-
memswap(&ei1->i_es_tree, &ei2->i_es_tree, sizeof(ei1->i_es_tree));
81-
memswap(&ei1->i_es_lru_nr, &ei2->i_es_lru_nr, sizeof(ei1->i_es_lru_nr));
80+
ext4_es_remove_extent(inode1, 0, EXT_MAX_BLOCKS);
81+
ext4_es_remove_extent(inode2, 0, EXT_MAX_BLOCKS);
82+
ext4_es_lru_del(inode1);
83+
ext4_es_lru_del(inode2);
8284

8385
isize = i_size_read(inode1);
8486
i_size_write(inode1, i_size_read(inode2));

0 commit comments

Comments
 (0)